Skip to content
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 @@ -19,33 +19,33 @@
* Type of the elements in the combinations
* @version 2.0
*/
public class MultiCombinationIterator<T> implements
class MultiCombinationIterator<T> implements
Iterator<ICombinatoricsVector<T>> {

/**
* Generator
*/
protected final MultiCombinationGenerator<T> _generator;
final MultiCombinationGenerator<T> _generator;

/**
* Current combination
*/
protected ICombinatoricsVector<T> _currentCombination = null;
ICombinatoricsVector<T> _currentCombination = null;

/**
* Index of the current combination
*/
protected long _currentIndex = 0;
long _currentIndex = 0;

/**
* Size of the original vector/set
*/
protected final int _lengthN;
final int _lengthN;

/**
* Size of the combinations (number of elements) to generate
*/
protected final int _lengthK;
final int _lengthK;

/**
* A helper array
Expand All @@ -63,7 +63,7 @@ public class MultiCombinationIterator<T> implements
* @param generator
* Multi-combinations generator
*/
public MultiCombinationIterator(MultiCombinationGenerator<T> generator) {
MultiCombinationIterator(MultiCombinationGenerator<T> generator) {
_generator = generator;
_lengthN = generator.getOriginalVector().getSize();
_currentCombination = Factory.createVector();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,33 @@
* @param <T>
* Type of the elements in the combinations
*/
public class SimpleCombinationIterator<T> implements
class SimpleCombinationIterator<T> implements
Iterator<ICombinatoricsVector<T>> {

/**
* Generator
*/
protected final SimpleCombinationGenerator<T> _generator;
final SimpleCombinationGenerator<T> _generator;

/**
* Current simple combination
*/
protected ICombinatoricsVector<T> _currentSimpleCombination = null;
ICombinatoricsVector<T> _currentSimpleCombination = null;

/**
* Index of the current combination
*/
protected long _currentIndex = 0;
long _currentIndex = 0;

/**
* Size of the original vector/set
*/
protected final int _lengthN;
final int _lengthN;

/**
* Size of the generated combination.
*/
protected final int _lengthK;
final int _lengthK;

/**
* Helper array
Expand All @@ -63,7 +63,7 @@ public class SimpleCombinationIterator<T> implements
* @param generator
* Generator of the simple combinations
*/
public SimpleCombinationIterator(SimpleCombinationGenerator<T> generator) {
SimpleCombinationIterator(SimpleCombinationGenerator<T> generator) {
_generator = generator;
_lengthN = generator.getOriginalVector().getSize();
_lengthK = generator.getCombinationLength();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,45 +19,42 @@
* @see ICombinatoricsVector
* @see CompositionGenerator
*/
public class CompositionIterator implements
class CompositionIterator implements
Iterator<ICombinatoricsVector<Integer>> {

/**
* Generator
*/
protected final CompositionGenerator _generator;
final CompositionGenerator _generator;

/**
* Current composition
*/
protected ICombinatoricsVector<Integer> _currentComposition = null;
ICombinatoricsVector<Integer> _currentComposition = null;

/**
* Current index of the weak composition
*/
protected long _currentIndex = 0;
long _currentIndex = 0;

/**
* Subset generator
*/
protected final Generator<Integer> _subsetGenerator;
final Generator<Integer> _subsetGenerator;

/**
* Subset iterator
*/
protected final Iterator<ICombinatoricsVector<Integer>> _subsetIterator;
final Iterator<ICombinatoricsVector<Integer>> _subsetIterator;

/**
* Current subset
*/
protected ICombinatoricsVector<Integer> _currentSubset = null;
ICombinatoricsVector<Integer> _currentSubset = null;

/**
* Constructor of the iterator
*
* @param generator The Composition generator
*/
public CompositionIterator(CompositionGenerator generator) {
CompositionIterator(CompositionGenerator generator) {
super();
_generator = generator;

Expand Down Expand Up @@ -92,7 +89,7 @@ public boolean hasNext() {
/**
* Returns current composition
*/
protected ICombinatoricsVector<Integer> getCurrentItem() {
private ICombinatoricsVector<Integer> getCurrentItem() {

_currentComposition = Factory.<Integer> createVector();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,44 +18,44 @@
* @see IntegerCompositionGenerator
* @version 2.0
*/
public class IntegerCompositionIterator implements Iterator<IntegerVector> {
class IntegerCompositionIterator implements Iterator<IntegerVector> {

/**
* Generator
*/
protected final IntegerCompositionGenerator _generator;
final IntegerCompositionGenerator _generator;

/**
* Current composition
*/
protected IntegerVector _currentComposition = null;
IntegerVector _currentComposition = null;

/**
* Current index of the weak composition
*/
protected long _currentIndex = 0;
long _currentIndex = 0;

/**
* Subset generator
*/
protected final IntegerGenerator _subsetGenerator;
final IntegerGenerator _subsetGenerator;

/**
* Subset iterator
*/
protected final Iterator<IntegerVector> _subsetIterator;
final Iterator<IntegerVector> _subsetIterator;

/**
* Current subset
*/
protected IntegerVector _currentSubset = null;
IntegerVector _currentSubset = null;

/**
* Constructor of the iterator
*
* @param generator The composition generator
*/
public IntegerCompositionIterator(IntegerCompositionGenerator generator) {
IntegerCompositionIterator(IntegerCompositionGenerator generator) {
super();
_generator = generator;

Expand Down Expand Up @@ -96,7 +96,7 @@ public boolean hasNext() {
/**
* Returns current composition
*/
protected IntegerVector getCurrentItem() {
private IntegerVector getCurrentItem() {

int[] vector = _currentSubset.getVector();
_currentComposition = IntegerFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@
* @see PartitionGenerator
* @version 2.0
*/
public class PartitionIterator implements
class PartitionIterator implements
Iterator<ICombinatoricsVector<Integer>> {

/**
* Generator
*/
protected final PartitionGenerator _generator;
final PartitionGenerator _generator;

/**
* Current partition
*/
protected ICombinatoricsVector<Integer> _currentPartition = null;
ICombinatoricsVector<Integer> _currentPartition = null;

/**
* Index of the current partition
*/
protected long _currentIndex = 0;
long _currentIndex = 0;

/**
* Helper vectors
Expand All @@ -54,7 +54,7 @@ public class PartitionIterator implements
* @param generator
* Generator
*/
public PartitionIterator(PartitionGenerator generator) {
PartitionIterator(PartitionGenerator generator) {
_generator = generator;
_mVector = new int[generator._initialValue + 2];
_zVector = new int[generator._initialValue + 2];
Expand Down Expand Up @@ -140,11 +140,11 @@ private void createCurrentPartition(int k) {
_currentPartition = Factory.createVector(list);
}

private final int getInternalVectorValue(int index, int[] vector) {
private int getInternalVectorValue(int index, int[] vector) {
return vector[index + 1];
}

private final void setInternalVectorValue(int index, int[] vector, int value) {
private void setInternalVectorValue(int index, int[] vector, int value) {
vector[index + 1] = value;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,43 +22,43 @@
* @param <T>
* Type of elements in the permutations
*/
public class DuplicatedPermutationIterator<T> implements
class DuplicatedPermutationIterator<T> implements
Iterator<ICombinatoricsVector<T>> {

/**
* Generator
*/
protected final Generator<T> _generator;
final Generator<T> _generator;

/**
* Current permutation
*/
protected ICombinatoricsVector<T> _currentPermutation;
ICombinatoricsVector<T> _currentPermutation;

/**
* Current index of current permutation
*/
protected long _currentIndex = 0;
long _currentIndex = 0;

/**
* Number of elements in the permutations
*/
protected final int _length;
final int _length;

/**
* Internal data
*/
private int _data[] = null;
private boolean _firstIteration = true;
protected ICombinatoricsVector<T> _initialOrderedPermutation;
ICombinatoricsVector<T> _initialOrderedPermutation;

/**
* Constructor
*
* @param generator
* Permutation generator
*/
public DuplicatedPermutationIterator(Generator<T> generator) {
DuplicatedPermutationIterator(Generator<T> generator) {
_generator = generator;
_length = generator.getOriginalVector().getSize();
_data = new int[_length];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,27 @@
* @param <T>
* Type of elements in the permutations
*/
public class PermutationIterator<T> implements Iterator<ICombinatoricsVector<T>> {
class PermutationIterator<T> implements Iterator<ICombinatoricsVector<T>> {

/**
* Generator
*/
protected final Generator<T> _generator;
final Generator<T> _generator;

/**
* Current permutation
*/
protected ICombinatoricsVector<T> _currentPermutation;
ICombinatoricsVector<T> _currentPermutation;

/**
* Current index of current permutation
*/
protected long _currentIndex = 0;
long _currentIndex = 0;

/**
* Number of elements in the permutations
*/
protected final int _length;
final int _length;

/**
* Internal data
Expand All @@ -60,7 +60,7 @@ public class PermutationIterator<T> implements Iterator<ICombinatoricsVector<T>>
* @param generator
* Permutation generator
*/
public PermutationIterator(Generator<T> generator) {
PermutationIterator(Generator<T> generator) {
_generator = generator;
_length = generator.getOriginalVector().getSize();
_currentPermutation = Factory.createVector(generator
Expand Down
Loading