Package org.ojalgo.type
Class EnumPartition<E extends java.lang.Enum<E>>
- java.lang.Object
-
- org.ojalgo.type.EnumPartition<E>
-
public final class EnumPartition<E extends java.lang.Enum<E>> extends java.lang.Object
Keeps track of n (ordered)Enum
values – anyEnum
and any number of values. This is a generalised version ofIndexSelector
.- See Also:
IndexSelector
-
-
Field Summary
Fields Modifier and Type Field Description private E[]
myConstants
private int[]
myCounts
private byte[]
myValues
-
Constructor Summary
Constructors Constructor Description EnumPartition(int size, E initialValue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
count(E value)
Count the number of times a specific value appears.int
count(E value, boolean negate)
Generalised version ofcount(Enum)
that allows to instead count the number of times something else is set.int[]
extract(E value)
Get the indices where this value is set.int[]
extract(E value, boolean negate)
Generalised version ofextract(Enum)
that allows to instead get the negated (complement) set of indices.void
extract(E value, boolean negate, int[] receiver)
Generalised version ofextract(Enum, boolean)
that allows to supply the array the resulting indices should be written to.void
fill(E value)
E
get(int index)
boolean
is(int index, E value)
int
size()
void
update(int index, E value)
-
-
-
Constructor Detail
-
EnumPartition
public EnumPartition(int size, E initialValue)
-
-
Method Detail
-
count
public int count(E value)
Count the number of times a specific value appears.
-
count
public int count(E value, boolean negate)
Generalised version ofcount(Enum)
that allows to instead count the number of times something else is set.
-
extract
public int[] extract(E value)
Get the indices where this value is set.
-
extract
public int[] extract(E value, boolean negate)
Generalised version ofextract(Enum)
that allows to instead get the negated (complement) set of indices.
-
extract
public void extract(E value, boolean negate, int[] receiver)
Generalised version ofextract(Enum, boolean)
that allows to supply the array the resulting indices should be written to.
-
fill
public void fill(E value)
-
get
public E get(int index)
-
is
public boolean is(int index, E value)
-
size
public int size()
-
update
public void update(int index, E value)
-
-