Class EnumPartition<E extends java.lang.Enum<E>>


  • public final class EnumPartition<E extends java.lang.Enum<E>>
    extends java.lang.Object
    Keeps track of n (ordered) Enum values – any Enum and any number of values. This is a generalised version of IndexSelector.
    See Also:
    IndexSelector
    • 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 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)  
      E get​(int index)  
      boolean is​(int index, E value)  
      int size()  
      void update​(int index, E value)  
      • Methods inherited from class java.lang.Object

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

      • myConstants

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

        private final int[] myCounts
      • myValues

        private final byte[] myValues
    • 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 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

        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)