Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced Tuplator with equivalent TupleGenerator from ms-util #195

Merged
merged 1 commit into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import gov.hhs.aspr.ms.gcm.plugins.people.support.PersonId;
import gov.hhs.aspr.ms.gcm.plugins.stochastics.datamanagers.StochasticsDataManager;
import gov.hhs.aspr.ms.gcm.plugins.stochastics.support.RandomNumberGeneratorId;
import util.combinatorics.TupleGenerator;
import util.errors.ContractException;

/**
Expand Down Expand Up @@ -186,7 +187,7 @@ public void removeLabel(final Object label) {
}

private class PartialKeyIterator implements KeyIterator {
private final Tuplator tuplator;
private final TupleGenerator tupleGenerator;
private int index;
private final Key baseKey;
private Key nextKey;
Expand All @@ -211,25 +212,25 @@ public PartialKeyIterator(final Key partialKey) {
}
}

final Tuplator.Builder builder = Tuplator.builder();
final TupleGenerator.Builder builder = TupleGenerator.builder();
for (int i = 0; i < dimensionCount; i++) {
final int labelIndex = keyIndexes[i];
final LabelManager labelManager = labelManagers[labelIndex];
builder.addDimension(labelManager.getLabelCount());
}
tuplator = builder.build();
tupleGenerator = builder.build();

// baseKey = new Key(partialKey);
baseKey = partialKey;
calculateNextKey();
}

private void calculateNextKey() {
if (index >= tuplator.size()) {
if (index >= tupleGenerator.size()) {
nextKey = null;
} else {
while (index < tuplator.size()) {
tuplator.fillTuple(index++, tuple);
while (index < tupleGenerator.size()) {
tupleGenerator.fillTuple(index++, tuple);
for (int j = 0; j < dimensionCount; j++) {
final LabelManager labelManager = labelManagers[keyIndexes[j]];
// unsafe mutation calculate next key
Expand Down Expand Up @@ -261,7 +262,7 @@ public Key next() {

@Override
public int size() {
return tuplator.size();
return tupleGenerator.size();
}

}
Expand Down

This file was deleted.

This file was deleted.

Loading