org.biojava.bio.symbol
Class PackedDnaSymbolList

java.lang.Object
  extended byorg.biojava.utils.AbstractChangeable
      extended byorg.biojava.bio.symbol.AbstractSymbolList
          extended byorg.biojava.bio.symbol.PackedDnaSymbolList
All Implemented Interfaces:
Changeable, java.io.Serializable, SymbolList

public class PackedDnaSymbolList
extends AbstractSymbolList
implements java.io.Serializable

a class that implements storage of symbols in packed form (2 symbols per byte).

Since:
1.2
Author:
David Huen
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class org.biojava.bio.symbol.AbstractSymbolList
AbstractSymbolList.EditScreener, AbstractSymbolList.EditTranslater
 
Nested classes inherited from class org.biojava.bio.symbol.SymbolList
SymbolList.EmptySymbolList
 
Field Summary
 
Fields inherited from interface org.biojava.bio.symbol.SymbolList
EDIT, EMPTY_LIST
 
Constructor Summary
PackedDnaSymbolList(int length, byte[] byteArray)
          constructor taking a byte array previously created by another PackedDnaSymbolList object.
PackedDnaSymbolList(SymbolList symList)
          constructor taking another symbol list.
 
Method Summary
 Alphabet getAlphabet()
          The alphabet that this SymbolList is over.
 byte[] getArray()
          returns the byte array backing the SymbolList.
 int length()
          The number of symbols in this SymbolList.
 Symbol symbolAt(int index)
          Return the symbol at index, counting from 1.
 
Methods inherited from class org.biojava.bio.symbol.AbstractSymbolList
edit, equals, hashCode, iterator, seqString, subList, subStr, toList
 
Methods inherited from class org.biojava.utils.AbstractChangeable
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
 

Constructor Detail

PackedDnaSymbolList

public PackedDnaSymbolList(SymbolList symList)
                    throws BioException,
                           IllegalAlphabetException
constructor taking another symbol list.


PackedDnaSymbolList

public PackedDnaSymbolList(int length,
                           byte[] byteArray)
                    throws BioException
constructor taking a byte array previously created by another PackedDnaSymbolList object.

Method Detail

length

public int length()
Description copied from interface: SymbolList
The number of symbols in this SymbolList.

Specified by:
length in interface SymbolList
Returns:
the length

getAlphabet

public Alphabet getAlphabet()
Description copied from interface: SymbolList
The alphabet that this SymbolList is over.

Every symbol within this SymbolList is a member of this alphabet. alphabet.contains(symbol) == true for each symbol that is within this sequence.

Specified by:
getAlphabet in interface SymbolList
Returns:
the alphabet

symbolAt

public Symbol symbolAt(int index)
Description copied from interface: SymbolList
Return the symbol at index, counting from 1.

Specified by:
symbolAt in interface SymbolList
Parameters:
index - the offset into this SymbolList
Returns:
the Symbol at that index

getArray

public byte[] getArray()
returns the byte array backing the SymbolList. (can be written out and stored).