|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjbil.sequence.Sequence
jbil.sequence.SymbolArraySequence
public class SymbolArraySequence
Basic high-level implementation of Sequence using an array of symbols. Each position in the array is a reference to the corresponding symbol object in the base alphabet. This implementation is time-efficient but not so much space-efficient.
Constructor Summary | |
---|---|
SymbolArraySequence(Alphabet alphabet)
Creates an empty sequence over a given alphabet. |
|
SymbolArraySequence(Alphabet alphabet,
int initialCapacity)
Creates an empty sequence with a given initial capacity over a given alphabet. |
Method Summary | |
---|---|
void |
append(Sequence sequence)
Appends a sequence to this sequence. |
void |
append(Symbol s)
Appends a symbol to this sequence. |
Sequence |
clone()
|
void |
delete(int beginIndex,
int endIndex)
Deletes a subsequence of this sequence. |
Alphabet |
getAlphabet()
|
void |
insert(int index,
Sequence sequence)
Inserts a sequence at a given position in this sequence. |
void |
insert(int index,
Symbol s)
Inserts a new symbol at a given position in this sequence. |
int |
length()
|
void |
prepend(Sequence sequence)
Prepends a sequence to this sequence. |
void |
prepend(Symbol s)
Prepends a symbol to this sequence. |
void |
setSymbolAt(int index,
Symbol s)
Sets the symbol at a given position in this sequence. |
Sequence |
subSequence(int beginIndex)
Gets a new sequence that is a suffix of this sequence. |
Sequence |
subSequence(int beginIndex,
int endIndex)
Gets a new sequence that is a subsequence of this sequence. |
Symbol |
symbolAt(int index)
Gets the symbol at a given position in the sequence. |
java.lang.String |
toString(int beginIndex,
int endIndex)
Returns the srting representation of a subsequence of this sequence. |
Methods inherited from class jbil.sequence.Sequence |
---|
endsWith, getName, indexAt, occursAt, setName, startsWith, toString |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SymbolArraySequence(Alphabet alphabet)
alphabet
- The base alphabet.public SymbolArraySequence(Alphabet alphabet, int initialCapacity)
alphabet
- The base alphabet.initialCapacity
- The initial capacity.Method Detail |
---|
public void append(Symbol s)
Sequence
append
in class Sequence
s
- The symbol to be appended.public void append(Sequence sequence)
Sequence
append
in class Sequence
sequence
- The sequence to be appended.public Sequence clone()
clone
in class Sequence
public void insert(int index, Symbol s)
Sequence
insert
in class Sequence
index
- The position at which the symbol is inserted.s
- The symbol to be inserted.public void insert(int index, Sequence sequence)
Sequence
insert
in class Sequence
index
- The position at which the sequence is inserted.sequence
- The sequence to be inserted.public int length()
length
in class Sequence
public void prepend(Symbol s)
Sequence
prepend
in class Sequence
s
- The symbol to be prepended.public void prepend(Sequence sequence)
Sequence
prepend
in class Sequence
sequence
- The sequence to be prepended.public void setSymbolAt(int index, Symbol s)
Sequence
setSymbolAt
in class Sequence
index
- The position to be set.s
- The new symbol.public Sequence subSequence(int beginIndex)
Sequence
subSequence
in class Sequence
beginIndex
- The start position of the suffix.
public Sequence subSequence(int beginIndex, int endIndex)
Sequence
subSequence
in class Sequence
beginIndex
- The start position of the subsequence.endIndex
- The end position of the subsequence.
public Symbol symbolAt(int index)
Sequence
symbolAt
in class Sequence
index
- A position in the sequence.
public java.lang.String toString(int beginIndex, int endIndex)
Sequence
toString
in class Sequence
beginIndex
- The start position of the subsequence.endIndex
- The end position of the subsequence.
public Alphabet getAlphabet()
getAlphabet
in class Sequence
public void delete(int beginIndex, int endIndex)
Sequence
delete
in class Sequence
beginIndex
- The start position of the subsequence to be deleted.endIndex
- The end position (not inclusive) of the subsequence to be deleted.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |