diff --git a/src/main/java/org/paukov/combinatorics/combination/multi/MultiCombinationIterator.java b/src/main/java/org/paukov/combinatorics/combination/multi/MultiCombinationIterator.java index ab0c094..c44fd02 100644 --- a/src/main/java/org/paukov/combinatorics/combination/multi/MultiCombinationIterator.java +++ b/src/main/java/org/paukov/combinatorics/combination/multi/MultiCombinationIterator.java @@ -19,33 +19,33 @@ * Type of the elements in the combinations * @version 2.0 */ -public class MultiCombinationIterator implements +class MultiCombinationIterator implements Iterator> { /** * Generator */ - protected final MultiCombinationGenerator _generator; + final MultiCombinationGenerator _generator; /** * Current combination */ - protected ICombinatoricsVector _currentCombination = null; + ICombinatoricsVector _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 @@ -63,7 +63,7 @@ public class MultiCombinationIterator implements * @param generator * Multi-combinations generator */ - public MultiCombinationIterator(MultiCombinationGenerator generator) { + MultiCombinationIterator(MultiCombinationGenerator generator) { _generator = generator; _lengthN = generator.getOriginalVector().getSize(); _currentCombination = Factory.createVector(); diff --git a/src/main/java/org/paukov/combinatorics/combination/simple/SimpleCombinationIterator.java b/src/main/java/org/paukov/combinatorics/combination/simple/SimpleCombinationIterator.java index b8c2dc8..83061c0 100644 --- a/src/main/java/org/paukov/combinatorics/combination/simple/SimpleCombinationIterator.java +++ b/src/main/java/org/paukov/combinatorics/combination/simple/SimpleCombinationIterator.java @@ -19,33 +19,33 @@ * @param * Type of the elements in the combinations */ -public class SimpleCombinationIterator implements +class SimpleCombinationIterator implements Iterator> { /** * Generator */ - protected final SimpleCombinationGenerator _generator; + final SimpleCombinationGenerator _generator; /** * Current simple combination */ - protected ICombinatoricsVector _currentSimpleCombination = null; + ICombinatoricsVector _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 @@ -63,7 +63,7 @@ public class SimpleCombinationIterator implements * @param generator * Generator of the simple combinations */ - public SimpleCombinationIterator(SimpleCombinationGenerator generator) { + SimpleCombinationIterator(SimpleCombinationGenerator generator) { _generator = generator; _lengthN = generator.getOriginalVector().getSize(); _lengthK = generator.getCombinationLength(); diff --git a/src/main/java/org/paukov/combinatorics/composition/CompositionIterator.java b/src/main/java/org/paukov/combinatorics/composition/CompositionIterator.java index 09f9381..a8b4810 100644 --- a/src/main/java/org/paukov/combinatorics/composition/CompositionIterator.java +++ b/src/main/java/org/paukov/combinatorics/composition/CompositionIterator.java @@ -19,45 +19,42 @@ * @see ICombinatoricsVector * @see CompositionGenerator */ -public class CompositionIterator implements +class CompositionIterator implements Iterator> { - /** - * Generator - */ - protected final CompositionGenerator _generator; + final CompositionGenerator _generator; /** * Current composition */ - protected ICombinatoricsVector _currentComposition = null; + ICombinatoricsVector _currentComposition = null; /** * Current index of the weak composition */ - protected long _currentIndex = 0; + long _currentIndex = 0; /** * Subset generator */ - protected final Generator _subsetGenerator; + final Generator _subsetGenerator; /** * Subset iterator */ - protected final Iterator> _subsetIterator; + final Iterator> _subsetIterator; /** * Current subset */ - protected ICombinatoricsVector _currentSubset = null; + ICombinatoricsVector _currentSubset = null; /** * Constructor of the iterator * * @param generator The Composition generator */ - public CompositionIterator(CompositionGenerator generator) { + CompositionIterator(CompositionGenerator generator) { super(); _generator = generator; @@ -92,7 +89,7 @@ public boolean hasNext() { /** * Returns current composition */ - protected ICombinatoricsVector getCurrentItem() { + private ICombinatoricsVector getCurrentItem() { _currentComposition = Factory. createVector(); diff --git a/src/main/java/org/paukov/combinatorics/composition/IntegerCompositionIterator.java b/src/main/java/org/paukov/combinatorics/composition/IntegerCompositionIterator.java index e7ebf90..012fb20 100644 --- a/src/main/java/org/paukov/combinatorics/composition/IntegerCompositionIterator.java +++ b/src/main/java/org/paukov/combinatorics/composition/IntegerCompositionIterator.java @@ -18,44 +18,44 @@ * @see IntegerCompositionGenerator * @version 2.0 */ -public class IntegerCompositionIterator implements Iterator { +class IntegerCompositionIterator implements Iterator { /** * 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 _subsetIterator; + final Iterator _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; @@ -96,7 +96,7 @@ public boolean hasNext() { /** * Returns current composition */ - protected IntegerVector getCurrentItem() { + private IntegerVector getCurrentItem() { int[] vector = _currentSubset.getVector(); _currentComposition = IntegerFactory diff --git a/src/main/java/org/paukov/combinatorics/partition/PartitionIterator.java b/src/main/java/org/paukov/combinatorics/partition/PartitionIterator.java index 06215b6..c3b2591 100644 --- a/src/main/java/org/paukov/combinatorics/partition/PartitionIterator.java +++ b/src/main/java/org/paukov/combinatorics/partition/PartitionIterator.java @@ -19,23 +19,23 @@ * @see PartitionGenerator * @version 2.0 */ -public class PartitionIterator implements +class PartitionIterator implements Iterator> { /** * Generator */ - protected final PartitionGenerator _generator; + final PartitionGenerator _generator; /** * Current partition */ - protected ICombinatoricsVector _currentPartition = null; + ICombinatoricsVector _currentPartition = null; /** * Index of the current partition */ - protected long _currentIndex = 0; + long _currentIndex = 0; /** * Helper vectors @@ -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]; @@ -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; } diff --git a/src/main/java/org/paukov/combinatorics/permutations/DuplicatedPermutationIterator.java b/src/main/java/org/paukov/combinatorics/permutations/DuplicatedPermutationIterator.java index 602920f..f4cc04e 100644 --- a/src/main/java/org/paukov/combinatorics/permutations/DuplicatedPermutationIterator.java +++ b/src/main/java/org/paukov/combinatorics/permutations/DuplicatedPermutationIterator.java @@ -22,35 +22,35 @@ * @param * Type of elements in the permutations */ -public class DuplicatedPermutationIterator implements +class DuplicatedPermutationIterator implements Iterator> { /** * Generator */ - protected final Generator _generator; + final Generator _generator; /** * Current permutation */ - protected ICombinatoricsVector _currentPermutation; + ICombinatoricsVector _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 _initialOrderedPermutation; + ICombinatoricsVector _initialOrderedPermutation; /** * Constructor @@ -58,7 +58,7 @@ public class DuplicatedPermutationIterator implements * @param generator * Permutation generator */ - public DuplicatedPermutationIterator(Generator generator) { + DuplicatedPermutationIterator(Generator generator) { _generator = generator; _length = generator.getOriginalVector().getSize(); _data = new int[_length]; diff --git a/src/main/java/org/paukov/combinatorics/permutations/PermutationIterator.java b/src/main/java/org/paukov/combinatorics/permutations/PermutationIterator.java index 66c0769..72bdee8 100644 --- a/src/main/java/org/paukov/combinatorics/permutations/PermutationIterator.java +++ b/src/main/java/org/paukov/combinatorics/permutations/PermutationIterator.java @@ -20,27 +20,27 @@ * @param * Type of elements in the permutations */ -public class PermutationIterator implements Iterator> { +class PermutationIterator implements Iterator> { /** * Generator */ - protected final Generator _generator; + final Generator _generator; /** * Current permutation */ - protected ICombinatoricsVector _currentPermutation; + ICombinatoricsVector _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 @@ -60,7 +60,7 @@ public class PermutationIterator implements Iterator> * @param generator * Permutation generator */ - public PermutationIterator(Generator generator) { + PermutationIterator(Generator generator) { _generator = generator; _length = generator.getOriginalVector().getSize(); _currentPermutation = Factory.createVector(generator diff --git a/src/main/java/org/paukov/combinatorics/permutations/PermutationWithRepetitionIterator.java b/src/main/java/org/paukov/combinatorics/permutations/PermutationWithRepetitionIterator.java index 03b57d3..139a3ef 100644 --- a/src/main/java/org/paukov/combinatorics/permutations/PermutationWithRepetitionIterator.java +++ b/src/main/java/org/paukov/combinatorics/permutations/PermutationWithRepetitionIterator.java @@ -22,33 +22,33 @@ * @param * Type of the elements in the permutations */ -public class PermutationWithRepetitionIterator implements +class PermutationWithRepetitionIterator implements Iterator> { /** * Generator */ - protected final PermutationWithRepetitionGenerator _generator; + final PermutationWithRepetitionGenerator _generator; /** * Current permutation */ - protected ICombinatoricsVector _currentPermutation = null; + ICombinatoricsVector _currentPermutation = null; /** * Index of the current permutation */ - protected long _currentIndex = 0; + long _currentIndex = 0; /** * Number of elements in the core vector */ - protected final int _n; + final int _n; /** * Number of elements in the generated permutations */ - protected final int _k; + final int _k; /** * Internal data @@ -61,7 +61,7 @@ public class PermutationWithRepetitionIterator implements * @param generator * Generator */ - public PermutationWithRepetitionIterator( + PermutationWithRepetitionIterator( PermutationWithRepetitionGenerator generator) { _generator = generator; _n = generator.getOriginalVector().getSize(); diff --git a/src/main/java/org/paukov/combinatorics/subsets/IntegerSubListIterator.java b/src/main/java/org/paukov/combinatorics/subsets/IntegerSubListIterator.java index bfbe276..dd21247 100644 --- a/src/main/java/org/paukov/combinatorics/subsets/IntegerSubListIterator.java +++ b/src/main/java/org/paukov/combinatorics/subsets/IntegerSubListIterator.java @@ -20,37 +20,37 @@ * @see IntegerSubSetGenerator * */ -public class IntegerSubListIterator implements Iterator { +class IntegerSubListIterator implements Iterator { /** * Subset generator */ - protected final IntegerGenerator _generator; + final IntegerGenerator _generator; /** * Current sublist */ - protected IntegerVector _currentSubList = null; + IntegerVector _currentSubList = null; /** * Index of the current sub-list */ - protected long _currentIndex = 0; + long _currentIndex = 0; /** * Sub set iterator */ - protected final IntegerSubSetIterator _subSetsIterator; + final IntegerSubSetIterator _subSetsIterator; /** * Set of the result vectors (with duplicates) */ - protected final Set _result = new LinkedHashSet(); + final Set _result = new LinkedHashSet(); /** * Iterator over the result vectors */ - protected Iterator _resultIterator = null; + Iterator _resultIterator = null; /** * Constructor @@ -58,7 +58,7 @@ public class IntegerSubListIterator implements Iterator { * @param generator * The subset generator */ - public IntegerSubListIterator(IntegerGenerator generator) { + IntegerSubListIterator(IntegerGenerator generator) { _generator = generator; _subSetsIterator = new IntegerSubSetIterator(generator); init(); diff --git a/src/main/java/org/paukov/combinatorics/subsets/IntegerSubSetIterator.java b/src/main/java/org/paukov/combinatorics/subsets/IntegerSubSetIterator.java index 4bde20c..3216ebe 100644 --- a/src/main/java/org/paukov/combinatorics/subsets/IntegerSubSetIterator.java +++ b/src/main/java/org/paukov/combinatorics/subsets/IntegerSubSetIterator.java @@ -19,27 +19,27 @@ * @see IntegerSubSetGenerator * */ -public class IntegerSubSetIterator implements Iterator { +class IntegerSubSetIterator implements Iterator { /** * Subset generator */ - protected final IntegerGenerator _generator; + final IntegerGenerator _generator; /** * Current subset */ - protected IntegerVector _currentSubSet = null; + IntegerVector _currentSubSet = null; /** * Index of the current subset */ - protected long _currentIndex = 0; + long _currentIndex = 0; /** * Size of the subset */ - protected final int _length; + final int _length; /** * internal bit vector, representing the subset @@ -52,7 +52,7 @@ public class IntegerSubSetIterator implements Iterator { * @param generator * The subset generator */ - public IntegerSubSetIterator(IntegerGenerator generator) { + IntegerSubSetIterator(IntegerGenerator generator) { _generator = generator; _length = generator.getOriginalVector().getSize(); _currentSubSet = IntegerFactory.createIntegerVector(0); diff --git a/src/main/java/org/paukov/combinatorics/subsets/SubListIterator.java b/src/main/java/org/paukov/combinatorics/subsets/SubListIterator.java index e5d84b2..d22c7db 100644 --- a/src/main/java/org/paukov/combinatorics/subsets/SubListIterator.java +++ b/src/main/java/org/paukov/combinatorics/subsets/SubListIterator.java @@ -22,37 +22,37 @@ * @param * Type of the elements in the lists */ -public class SubListIterator implements Iterator> { +class SubListIterator implements Iterator> { /** * Subset generator */ - protected final Generator _generator; + final Generator _generator; /** * Current sublist */ - protected ICombinatoricsVector _currentSubList = null; + ICombinatoricsVector _currentSubList = null; /** * Index of the current sub-list */ - protected long _currentIndex = 0; + long _currentIndex = 0; /** * Sub set iterator */ - protected final SubSetIterator _subSetsIterator; + final SubSetIterator _subSetsIterator; /** * Set of the result vectors (with duplicates) */ - protected final Set> _result = new LinkedHashSet>(); + final Set> _result = new LinkedHashSet>(); /** * Iterator over the result vectors */ - protected Iterator> _resultIterator = null; + Iterator> _resultIterator = null; /** * Constructor @@ -60,7 +60,7 @@ public class SubListIterator implements Iterator> { * @param generator * The subset generator */ - public SubListIterator(Generator generator) { + SubListIterator(Generator generator) { _generator = generator; _subSetsIterator = new SubSetIterator(generator); init(); diff --git a/src/main/java/org/paukov/combinatorics/subsets/SubSetIterator.java b/src/main/java/org/paukov/combinatorics/subsets/SubSetIterator.java index 732adcf..ee736c3 100644 --- a/src/main/java/org/paukov/combinatorics/subsets/SubSetIterator.java +++ b/src/main/java/org/paukov/combinatorics/subsets/SubSetIterator.java @@ -21,27 +21,27 @@ * @param * Type of the elements of the subsets */ -public class SubSetIterator implements Iterator> { +class SubSetIterator implements Iterator> { /** * Subset generator */ - protected final Generator _generator; + final Generator _generator; /** * Current subset */ - protected ICombinatoricsVector _currentSubSet = null; + ICombinatoricsVector _currentSubSet = null; /** * Index of the current subset */ - protected long _currentIndex = 0; + long _currentIndex = 0; /** * Size of the subset */ - protected final int _length; + final int _length; /** * internal bit vector, representing the subset @@ -54,7 +54,7 @@ public class SubSetIterator implements Iterator> { * @param generator * The subset generator */ - public SubSetIterator(Generator generator) { + SubSetIterator(Generator generator) { _generator = generator; _length = generator.getOriginalVector().getSize(); _currentSubSet = Factory.createVector(); diff --git a/src/main/java/org/paukov/combinatorics/util/ComplexCombinationIterator.java b/src/main/java/org/paukov/combinatorics/util/ComplexCombinationIterator.java index 557a216..71694b4 100644 --- a/src/main/java/org/paukov/combinatorics/util/ComplexCombinationIterator.java +++ b/src/main/java/org/paukov/combinatorics/util/ComplexCombinationIterator.java @@ -21,34 +21,34 @@ * @version 2.0 * @see ComplexCombinationGenerator */ -public class ComplexCombinationIterator +class ComplexCombinationIterator implements Iterator>> { /** * Generator */ - protected final ComplexCombinationGenerator _generator; + final ComplexCombinationGenerator _generator; /** * Current combination */ - protected ICombinatoricsVector> _currentComplexCombination = null; + ICombinatoricsVector> _currentComplexCombination = null; /** * Current index of the combination */ - protected long _currentIndex = 0; + long _currentIndex = 0; /** * The set of the generated combinations */ - protected Set>> _resultSet = new LinkedHashSet>>(); + Set>> _resultSet = new LinkedHashSet>>(); /** * The iterator over the result combinations */ - protected Iterator>> _resultIterator = null; + Iterator>> _resultIterator = null; /** * Constructor