Class EnumArray

java.lang.Object
org.snpsift.annotate.mem.arrays.StringArrayBase
org.snpsift.annotate.mem.arrays.EnumArray
All Implemented Interfaces:
Serializable, Iterable<String>

public class EnumArray extends StringArrayBase
Implement a memory efficient array of enums It only stores bytes (i.e. UTF-8 encoding) and uses a single byte to mark the end of a string ('\0')
See Also:
  • Field Details

  • Constructor Details

    • EnumArray

      public EnumArray(String[] data)
      Constructor for using an array of strings
      Parameters:
      data -
    • EnumArray

      public EnumArray(int numElements)
      Constructor
      Parameters:
      numElements - : Number of elements in the array
  • Method Details

    • addEnum

      public int addEnum(String str)
      Add an enum, return the ordinal
    • get

      public String get(int i)
      Get the string at array index 'i'
      Specified by:
      get in class StringArrayBase
    • getOrd

      public int getOrd(int i)
      Get the ordinal at array index 'i'
    • numEnums

      public int numEnums()
      Number of enums in the array
    • set

      public int set(int i, String str)
      Add a string to the array WARNING: Typically you use either 'add' or 'set', but not both
      Specified by:
      set in class StringArrayBase
    • size

      public int size()
      Size of the data array (capacity of number of bytes)
      Specified by:
      size in class StringArrayBase
    • sizeBytes

      public long sizeBytes()
      Memory size of this object (approximate size in bytes)
      Specified by:
      sizeBytes in class StringArrayBase
    • toString

      public String toString()
      Overrides:
      toString in class Object