Class StringArrayBase

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

public abstract class StringArrayBase extends Object implements Iterable<String>, Serializable
Implement a memory efficient array of strings 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 Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(String str)
    Add a string to the array WARNING: Typically you use either 'add' or 'set', but not both
    abstract String
    get(int i)
    Get the string at array index 'i'
     
    int
    Number of ellements in the array
    abstract int
    set(int i, String str)
    Add a string to the array Return the index of the next element
    abstract int
    Number of different strings in the array
    abstract long
    Memory size of this object (approximate size in bytes)

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator
  • Field Details

    • currentIndex

      protected int currentIndex
  • Constructor Details

    • StringArrayBase

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

    • add

      public void add(String str)
      Add a string to the array WARNING: Typically you use either 'add' or 'set', but not both
    • get

      public abstract String get(int i)
      Get the string at array index 'i'
    • iterator

      public Iterator<String> iterator()
      Specified by:
      iterator in interface Iterable<String>
    • length

      public int length()
      Number of ellements in the array
    • set

      public abstract int set(int i, String str)
      Add a string to the array Return the index of the next element
    • size

      public abstract int size()
      Number of different strings in the array
    • sizeBytes

      public abstract long sizeBytes()
      Memory size of this object (approximate size in bytes)