public class Sequence<T extends SequenceElement>
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
protected java.util.List<T> |
elements |
protected java.util.Map<java.lang.String,T> |
elementsMap |
protected int |
hash |
protected boolean |
hashCached |
protected T |
label |
protected java.util.List<T> |
labels |
protected int |
sequenceId |
Constructor and Description |
---|
Sequence()
Creates new empty sequence
|
Sequence(java.util.Collection<T> set)
Creates new sequence from collection of elements
|
Modifier and Type | Method and Description |
---|---|
void |
addElement(T element)
Adds single element to sequence
|
void |
addElements(java.util.Collection<T> set)
Adds collection of elements to the sequence
|
void |
addSequenceLabel(T label)
Adds sequence label.
|
java.util.List<java.lang.String> |
asLabels()
Returns this sequence as list of labels
|
boolean |
equals(java.lang.Object o) |
T |
getElementByIndex(int index)
This method returns sequence element by index
|
T |
getElementByLabel(java.lang.String label)
Returns single element out of this sequence by its label
|
java.util.List<T> |
getElements()
Returns an ordered unmodifiable list of elements from this sequence
|
T |
getSequenceLabel()
Returns label for this sequence
|
java.util.List<T> |
getSequenceLabels()
Returns all labels for this sequence
|
int |
hashCode() |
boolean |
isEmpty()
Checks, if sequence is empty
|
void |
setSequenceLabel(T label)
Set sequence label
|
void |
setSequenceLabels(java.util.List<T> labels)
Sets sequence labels
|
int |
size()
This method returns number of elements in this sequence
|
protected java.util.List<T extends SequenceElement> elements
protected java.util.Map<java.lang.String,T extends SequenceElement> elementsMap
protected java.util.List<T extends SequenceElement> labels
protected T extends SequenceElement label
protected int hash
protected boolean hashCached
protected int sequenceId
public Sequence()
public Sequence(@NonNull java.util.Collection<T> set)
set
- public void addElement(@NonNull T element)
element
- public void addElements(java.util.Collection<T> set)
set
- public java.util.List<java.lang.String> asLabels()
public T getElementByLabel(@NonNull java.lang.String label)
label
- public java.util.List<T> getElements()
public T getSequenceLabel()
public java.util.List<T> getSequenceLabels()
public void setSequenceLabels(java.util.List<T> labels)
labels
- public void setSequenceLabel(@NonNull T label)
label
- public void addSequenceLabel(@NonNull T label)
label
- public boolean isEmpty()
public int size()
public T getElementByIndex(int index)
index
- public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object