Package jebl.evolution.sequences
Class CodonSequence
java.lang.Object
jebl.evolution.sequences.CodonSequence
- All Implemented Interfaces:
Comparable
,Sequence
,Attributable
A codon implementation of the Sequence interface.
- Version:
- $Id: BasicSequence.java 1042 2009-12-08 00:14:20Z amyzeta $
- Author:
- Andrew Rambaut, Alexei Drummond
-
Nested Class Summary
Nested classes/interfaces inherited from interface jebl.util.Attributable
Attributable.Utils
-
Constructor Summary
ConstructorsConstructorDescriptionCodonSequence
(Taxon taxon, State[] states) Creates a sequence with a name corresponding to the taxon name -
Method Summary
Modifier and TypeMethodDescriptionint
Sequences are compared by their taxaboolean
getAttribute
(String name) Gets the entire attribute map.int
Returns the length of the sequencebyte[]
Get the sequence characters representing the sequence.getState
(int site) byte[]
State[]
getTaxon()
int
hashCode()
void
removeAttribute
(String name) void
setAttribute
(String name, Object value) Sets an named attribute for this object.toString()
-
Constructor Details
-
CodonSequence
Creates a sequence with a name corresponding to the taxon name- Parameters:
taxon
-states
-
-
-
Method Details
-
getSequenceType
- Specified by:
getSequenceType
in interfaceSequence
- Returns:
- the type of symbols that this sequence is made up of.
-
getString
-
getCleanString
-
getStates
-
getStateIndices
public byte[] getStateIndices()- Specified by:
getStateIndices
in interfaceSequence
- Returns:
- an array of state indices.
-
getSequenceCharacters
public byte[] getSequenceCharacters()Get the sequence characters representing the sequence. This return is a byte[] rather than a char[] to avoid using twice as much memory as necessary. The individual elements of the returned array can be cast to chars.- Returns:
- the sequence characters as an array of characters.
-
getState
-
getLength
public int getLength()Returns the length of the sequence -
getTaxon
-
compareTo
Sequences are compared by their taxa- Specified by:
compareTo
in interfaceComparable
- Parameters:
o
- another sequence- Returns:
- an integer
-
toString
-
setAttribute
Description copied from interface:Attributable
Sets an named attribute for this object.- Specified by:
setAttribute
in interfaceAttributable
- Parameters:
name
- the name of the attribute.value
- the new value of the attribute.
-
getAttribute
- Specified by:
getAttribute
in interfaceAttributable
- Parameters:
name
- the name of the attribute of interest, or null if the attribute doesn't exist.- Returns:
- an object representing the named attributed for this object.
-
removeAttribute
- Specified by:
removeAttribute
in interfaceAttributable
- Parameters:
name
- name of attribute to remove
-
getAttributeNames
- Specified by:
getAttributeNames
in interfaceAttributable
- Returns:
- an array of the attributeNames that this object has.
-
getAttributeMap
Description copied from interface:Attributable
Gets the entire attribute map.- Specified by:
getAttributeMap
in interfaceAttributable
- Returns:
- an unmodifiable map
-
equals
-
hashCode
public int hashCode()
-