Class EnumPartition<E extends Enum<E>>

java.lang.Object
org.ojalgo.type.EnumPartition<E>

public final class EnumPartition<E extends Enum<E>> extends Object
Keeps track of n (ordered) Enum values – any Enum and any number of values. This is a generalised version of IndexSelector.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final E[]
     
    private final int[]
     
    private final byte[]
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    EnumPartition(int size, E initialValue)
     
  • Method Summary

    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 of count(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 of extract(Enum) that allows to instead get the negated (complement) set of indices.
    void
    extract(E value, boolean negate, int[] receiver)
    Generalised version of extract(Enum, boolean) that allows to supply the array the resulting indices should be written to.
    void
    fill(E value)
    Deprecated.
    v56 Use reset(E) instead
    get(int index)
     
    boolean
    is(int index, E value)
     
    void
    reset(E value)
     
    int
     
    void
    update(int index, E value)
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • myConstants

      private final E extends Enum<E>[] myConstants
    • myCounts

      private final int[] myCounts
    • myValues

      private final byte[] myValues
  • Constructor Details

    • EnumPartition

      public EnumPartition(int size, E initialValue)
  • Method Details

    • 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 of count(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 of extract(Enum) that allows to instead get the negated (complement) set of indices.
    • extract

      public void extract(E value, boolean negate, int[] receiver)
      Generalised version of extract(Enum, boolean) that allows to supply the array the resulting indices should be written to.
    • fill

      @Deprecated public void fill(E value)
      Deprecated.
      v56 Use reset(E) instead
    • get

      public E get(int index)
    • is

      public boolean is(int index, E value)
    • reset

      public void reset(E value)
    • size

      public int size()
    • update

      public void update(int index, E value)