Class IndexSelector


  • public final class IndexSelector
    extends java.lang.Object
    An array of int:s (indices) that are partitioned to be either "included" or "excluded". If you need more than 2 different states then EnumPartition is an alternative.
    See Also:
    EnumPartition
    • Field Detail

      • myExcluded

        private transient int[] myExcluded
      • myExcludedLength

        private int myExcludedLength
      • myIncluded

        private transient int[] myIncluded
      • myIncludedLength

        private int myIncludedLength
      • myLastExcluded

        private int myLastExcluded
      • myLastIncluded

        private int myLastIncluded
      • mySelector

        private final boolean[] mySelector
    • Constructor Detail

      • IndexSelector

        public IndexSelector​(int count)
      • IndexSelector

        public IndexSelector​(int count,
                             int[] initiallyIncludedIndeces)
      • IndexSelector

        private IndexSelector()
    • Method Detail

      • countExcluded

        public int countExcluded()
      • countIncluded

        public int countIncluded()
      • exclude

        public void exclude​(int indexToExclude)
      • exclude

        public void exclude​(int... indecesToExclude)
      • excludeAll

        public void excludeAll()
      • getExcluded

        public int[] getExcluded()
      • getIncluded

        public int[] getIncluded()
      • getLastExcluded

        public int getLastExcluded()
      • getLastIncluded

        public int getLastIncluded()
      • grow

        public void grow()
        Randomly include 1 of the currently excluded
      • include

        public void include​(int indexToInclude)
      • include

        public void include​(int... indecesToInclude)
      • includeAll

        public void includeAll()
      • isExcluded

        public boolean isExcluded​(int index)
      • isIncluded

        public boolean isIncluded​(int index)
      • isLastExcluded

        public boolean isLastExcluded()
        Is the last excluded index still excluded, or has it been included by a later operation?
      • isLastIncluded

        public boolean isLastIncluded()
        Is the last included index still included, or has it been excluded by a later operation?
      • pivot

        public void pivot​(int indexToExclude,
                          int indexToInclude)
      • revertLastExclusion

        public void revertLastExclusion()
      • revertLastInclusion

        public void revertLastInclusion()
      • shrink

        public void shrink()
        Randomly exclude 1 of the currently included
      • shuffle

        public void shuffle()
        Randomly exclude 1 of the currently included and include 1 of the excluded
      • size

        public int size()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object