- java.lang.Object
-
- org.ojalgo.type.IndexSelector
-
public final class IndexSelector extends java.lang.ObjectAn array of int:s (indices) that are partitioned to be either "included" or "excluded". If you need more than 2 different states thenEnumPartitionis an alternative.- See Also:
EnumPartition
-
-
Field Summary
Fields Modifier and Type Field Description private int[]myExcludedprivate intmyExcludedLengthprivate int[]myIncludedprivate intmyIncludedLengthprivate intmyLastExcludedprivate intmyLastIncludedprivate boolean[]mySelector
-
Constructor Summary
Constructors Modifier Constructor Description privateIndexSelector()IndexSelector(int count)IndexSelector(int count, int[] initiallyIncludedIndeces)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcountExcluded()intcountIncluded()voidexclude(int indexToExclude)voidexclude(int... indecesToExclude)voidexcludeAll()int[]getExcluded()int[]getIncluded()intgetLastExcluded()intgetLastIncluded()voidgrow()Randomly include 1 of the currently excludedvoidinclude(int indexToInclude)voidinclude(int... indecesToInclude)voidincludeAll()booleanisExcluded(int index)booleanisIncluded(int index)booleanisLastExcluded()Is the last excluded index still excluded, or has it been included by a later operation?booleanisLastIncluded()Is the last included index still included, or has it been excluded by a later operation?voidpivot(int indexToExclude, int indexToInclude)voidresetHistory()After bulk operations, like setting up some initial state, the history of last included and excluded is probably not relevant.voidrevertLastExclusion()voidrevertLastInclusion()voidshrink()Randomly exclude 1 of the currently includedvoidshuffle()Randomly exclude 1 of the currently included and include 1 of the excludedintsize()java.lang.StringtoString()
-
-
-
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
-
-
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)
-
resetHistory
public void resetHistory()
After bulk operations, like setting up some initial state, the history of last included and excluded is probably not relevant. It may be a good idea to reset it to prevent it from affecting following logic.
-
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:
toStringin classjava.lang.Object
-
-