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