org.biojava.bio.symbol
Class SimpleSymbolList

java.lang.Object
  |
  +--org.biojava.bio.symbol.AbstractSymbolList
        |
        +--org.biojava.bio.symbol.SimpleSymbolList

public class SimpleSymbolList
extends AbstractSymbolList
implements java.io.Serializable

Basic implementation of SymbolList. This is currently backed by a normal Java array. This is a new implementation which no longer uses the Java ArrayLists. I hope that eventually it can be made immutable, but for now the legacy addSymbol method is implemented.

Author:
Thomas Down
See Also:
Serialized Form

Constructor Summary
SimpleSymbolList(Alphabet alpha)
          Construct an empty SimpleSymbolList.
SimpleSymbolList(Alphabet alpha, java.util.List rList)
          Construct a SymbolList containing the symbols in the specified list.
SimpleSymbolList(SymbolList sl)
          Construct a copy of an existing SymbolList.
 
Method Summary
 void addSymbol(Symbol sym)
          Deprecated. Can we make SimpleSymbolList immutable [Thomas Down]
 Alphabet getAlphabet()
          Get the alphabet of this SymbolList.
 int length()
          Get the length of this SymbolList.
 Symbol symbolAt(int pos)
          Find a symbol at a specified offset in the SymbolList.
 
Methods inherited from class org.biojava.bio.symbol.AbstractSymbolList
iterator, seqString, subList, subStr, toList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleSymbolList

public SimpleSymbolList(Alphabet alpha)
Construct an empty SimpleSymbolList.
Parameters:
alpha - The alphabet of legal symbols in this list.

SimpleSymbolList

public SimpleSymbolList(Alphabet alpha,
                        java.util.List rList)
                 throws IllegalSymbolException
Construct a SymbolList containing the symbols in the specified list.
Parameters:
alpha - The alphabet of legal symbols for this list.
rList - A Java List of symbols.
Throws:
IllegalSymbolException - if a Symbol is not in the specified alphabet.
java.lang.ClassCastException - if rList contains objects which do not implement Symbol.

SimpleSymbolList

public SimpleSymbolList(SymbolList sl)
Construct a copy of an existing SymbolList.
Parameters:
The - list to copy.
Method Detail

getAlphabet

public Alphabet getAlphabet()
Get the alphabet of this SymbolList.
Overrides:
getAlphabet in class AbstractSymbolList
Tags copied from interface: SymbolList
Returns:
the alphabet

length

public int length()
Get the length of this SymbolList.
Overrides:
length in class AbstractSymbolList
Tags copied from interface: SymbolList
Returns:
the length

symbolAt

public Symbol symbolAt(int pos)
Find a symbol at a specified offset in the SymbolList. NB. Speedups possible once this class is immutable.
Overrides:
symbolAt in class AbstractSymbolList
Parameters:
pos - Position in biological coordinates (1..length)

addSymbol

public void addSymbol(Symbol sym)
               throws IllegalSymbolException
Deprecated. Can we make SimpleSymbolList immutable [Thomas Down]

Add a new Symbol to the end of this list.
Parameters:
sym - Symbol to add
Throws:
IllegalSymbolException - if the Symbol is not in this list's alphabet.