public final class ChromIds
extends java.lang.Object
Class ChromIds
is a singleton class that represents a
list of chromosome identifiers.
ChromIds
is thread-safe.Modifier and Type | Method | Description |
---|---|---|
int |
getIndex(java.lang.String id) |
Returns the index of the specified chromosome identifier.
|
int |
getIndexIfIndexed(java.lang.String id) |
Returns the index of the specified chromosome identifier, or returns
-1 if the specified chromosome identifier is not indexed. |
int[] |
getIndices(java.lang.String[] ids) |
Returns an array of chromosome identifier indices corresponding to the
specified array of chromosome identifiers.
|
java.lang.String |
id(int index) |
Returns the chromosome identifier with the specified index.
|
java.lang.String[] |
ids() |
Returns the list of chromosome identifiers as an array.
|
static ChromIds |
instance() |
Returns the singleton
ChromIds instance. |
int |
size() |
Returns the number of indexed chromosomes identifiers.
|
java.lang.String |
toString() |
Returns
java.util.Arrays.toString(this.ids()) . |
public static ChromIds instance()
ChromIds
instance.ChromIds
instancepublic int getIndex(java.lang.String id)
id
- a chromosome identifierjava.lang.IllegalArgumentException
- if id.isEmpty()
java.lang.NullPointerException
- if id == null
public int[] getIndices(java.lang.String[] ids)
ids
- an array of sample identifiersjava.lang.IllegalArgumentException
- if there is a j
satisfying
(0 <= j && j < ids.length) && ids[j].isEmpty()
java.lang.NullPointerException
- if ids == null
java.lang.NullPointerException
- if there is a j
satisfying
(0 <= j && j < ids.length) && (ids[j] == null)
public int getIndexIfIndexed(java.lang.String id)
-1
if the specified chromosome identifier is not indexed.id
- a chromosome identifier.-1
if the specified chromosome identifier is not indexed.java.lang.IllegalArgumentException
- if id.isEmpty()
java.lang.NullPointerException
- if id == null
public int size()
public java.lang.String id(int index)
index
- a chromosome identifier index.java.lang.IndexOutOfBoundsException
- if
index < 0 || index >= this.size()
public java.lang.String[] ids()
this.size()
, and
it will satisfy this.ids()[k].equals(this.id(k)) == true
for 0 <= k < this.size()
.public java.lang.String toString()
java.util.Arrays.toString(this.ids())
.toString
in class java.lang.Object
this