Package jebl.evolution.sequences
Class CodonSequence
- java.lang.Object
-
- jebl.evolution.sequences.CodonSequence
-
- All Implemented Interfaces:
java.lang.Comparable,Sequence,Attributable
public class CodonSequence extends java.lang.Object implements Sequence
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
Constructors Constructor Description CodonSequence(Taxon taxon, State[] states)Creates a sequence with a name corresponding to the taxon name
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(java.lang.Object o)Sequences are compared by their taxabooleanequals(java.lang.Object o)java.lang.ObjectgetAttribute(java.lang.String name)java.util.Map<java.lang.String,java.lang.Object>getAttributeMap()Gets the entire attribute map.java.util.Set<java.lang.String>getAttributeNames()java.lang.StringgetCleanString()intgetLength()Returns the length of the sequencebyte[]getSequenceCharacters()Get the sequence characters representing the sequence.SequenceTypegetSequenceType()StategetState(int site)byte[]getStateIndices()State[]getStates()java.lang.StringgetString()TaxongetTaxon()inthashCode()voidremoveAttribute(java.lang.String name)voidsetAttribute(java.lang.String name, java.lang.Object value)Sets an named attribute for this object.java.lang.StringtoString()
-
-
-
Method Detail
-
getSequenceType
public SequenceType getSequenceType()
- Specified by:
getSequenceTypein interfaceSequence- Returns:
- the type of symbols that this sequence is made up of.
-
getString
public java.lang.String getString()
-
getCleanString
public java.lang.String getCleanString()
-
getStates
public State[] getStates()
-
getStateIndices
public byte[] getStateIndices()
- Specified by:
getStateIndicesin 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
public State getState(int site)
-
getLength
public int getLength()
Returns the length of the sequence
-
getTaxon
public Taxon getTaxon()
-
compareTo
public int compareTo(java.lang.Object o)
Sequences are compared by their taxa- Specified by:
compareToin interfacejava.lang.Comparable- Parameters:
o- another sequence- Returns:
- an integer
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
setAttribute
public void setAttribute(java.lang.String name, java.lang.Object value)Description copied from interface:AttributableSets an named attribute for this object.- Specified by:
setAttributein interfaceAttributable- Parameters:
name- the name of the attribute.value- the new value of the attribute.
-
getAttribute
public java.lang.Object getAttribute(java.lang.String name)
- Specified by:
getAttributein 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
public void removeAttribute(java.lang.String name)
- Specified by:
removeAttributein interfaceAttributable- Parameters:
name- name of attribute to remove
-
getAttributeNames
public java.util.Set<java.lang.String> getAttributeNames()
- Specified by:
getAttributeNamesin interfaceAttributable- Returns:
- an array of the attributeNames that this object has.
-
getAttributeMap
public java.util.Map<java.lang.String,java.lang.Object> getAttributeMap()
Description copied from interface:AttributableGets the entire attribute map.- Specified by:
getAttributeMapin interfaceAttributable- Returns:
- an unmodifiable map
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-