E
- the type of elements that describe a sequence interval (the elements of the collection)public class SequenceIntervalList<E> extends java.lang.Object implements java.util.Collection<E>
getOverlappingElements(int, int)
). The actual efficiency depends on the specified interval length
(see SequenceIntervalList(SequenceIntervalPositionAdapter, int, int)
).Modifier and Type | Class and Description |
---|---|
protected class |
SequenceIntervalList.IntervalInformation |
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_INITIAL_SEQUENCE_LENGTH |
static int |
DEFAULT_INTERVAL_LENGTH |
Constructor and Description |
---|
SequenceIntervalList(SequenceIntervalPositionAdapter<? super E> positionAdapter)
Equivalent to calling
SequenceIntervalList(positionAdapter,
. |
SequenceIntervalList(SequenceIntervalPositionAdapter<? super E> positionAdapter,
int sequenceLength,
int intervalLength)
Creates a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(E element) |
boolean |
addAll(java.util.Collection<? extends E> collection) |
void |
clear() |
boolean |
contains(java.lang.Object o) |
boolean |
containsAll(java.util.Collection<?> collection) |
boolean |
containsPosition(int pos) |
int |
getIntervalLength() |
java.util.SortedSet<E> |
getOverlappingElements(int firstPos,
int lastPos) |
SequenceIntervalPositionAdapter<? super E> |
getPositionAdapter() |
boolean |
isEmpty() |
java.util.Iterator<E> |
iterator()
Returns an iterator over the list.
|
boolean |
move(E element,
int newFirstPos,
int newLastPos)
Moves an element of the list to a different position.
|
boolean |
remove(java.lang.Object o) |
boolean |
removeAll(java.util.Collection<?> collection) |
boolean |
retainAll(java.util.Collection<?> collection) |
void |
setPositionAdapter(SequenceIntervalPositionAdapter<? super E> positionAdapter)
Calling this methods leads to resorting of all elements in the list.
|
int |
size() |
java.lang.Object[] |
toArray() |
<T> T[] |
toArray(T[] array) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final int DEFAULT_INITIAL_SEQUENCE_LENGTH
public static final int DEFAULT_INTERVAL_LENGTH
public SequenceIntervalList(SequenceIntervalPositionAdapter<? super E> positionAdapter)
SequenceIntervalList(positionAdapter,
DEFAULT_INITIAL_SEQUENCE_LENGTH
, DEFAULT_INTERVAL_LENGTH
)
.positionAdapter
- public SequenceIntervalList(SequenceIntervalPositionAdapter<? super E> positionAdapter, int sequenceLength, int intervalLength)
sequenceLength
- the expected length of the whole sequence, which is populated by the
interval elements that are going to be stored in the new instance (it will be extended if necessary)intervalLength
- the interval (number of sequence positions) in which a list of elements overlapping
with this interval is stored. (The value specified here has a major influence on the efficiency of
this instance. It should depend on how many entries are expected per interval. If you expect e.g.
1 element every 100 sequence positions in average, you should specify a value like 500 or 1000.
Alternatively you could make the value dependent on the calls of getOverlappingElements(int, int)
.
If you already know that you are going to call this method with intervals of a certain length, you specify
a value here that is in the dimension of that length.)public int getIntervalLength()
public SequenceIntervalPositionAdapter<? super E> getPositionAdapter()
public void setPositionAdapter(SequenceIntervalPositionAdapter<? super E> positionAdapter)
positionAdapter
- the new position adapterpublic boolean remove(java.lang.Object o)
remove
in interface java.util.Collection<E>
public boolean move(E element, int newFirstPos, int newLastPos)
element
- the element to be moved (with unchanged position values)newFirstPos
- the new start positionnewLastPos
- the new end positiontrue
if the element was moved, false
if the element is not contained
in the listpublic java.util.SortedSet<E> getOverlappingElements(int firstPos, int lastPos)
public boolean containsPosition(int pos)
public boolean addAll(java.util.Collection<? extends E> collection)
addAll
in interface java.util.Collection<E>
public boolean contains(java.lang.Object o)
contains
in interface java.util.Collection<E>
public boolean containsAll(java.util.Collection<?> collection)
containsAll
in interface java.util.Collection<E>
public java.util.Iterator<E> iterator()
public boolean removeAll(java.util.Collection<?> collection)
removeAll
in interface java.util.Collection<E>
public boolean retainAll(java.util.Collection<?> collection)
retainAll
in interface java.util.Collection<E>
public java.lang.Object[] toArray()
toArray
in interface java.util.Collection<E>