Package org.snpsift.annotate.mem.arrays
Class StringArrayBase
java.lang.Object
org.snpsift.annotate.mem.arrays.StringArrayBase
- All Implemented Interfaces:
Serializable
,Iterable<String>
- Direct Known Subclasses:
EnumArray
,StringArray
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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a string to the array WARNING: Typically you use either 'add' or 'set', but not bothabstract String
get
(int i) Get the string at array index 'i'iterator()
int
length()
Number of ellements in the arrayabstract int
Add a string to the array Return the index of the next elementabstract int
size()
Number of different strings in the arrayabstract 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
Add a string to the array WARNING: Typically you use either 'add' or 'set', but not both -
get
Get the string at array index 'i' -
iterator
-
length
public int length()Number of ellements in the array -
set
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)
-