Package pal.datatype
Class SimpleDataType
- java.lang.Object
-
- pal.datatype.SimpleDataType
-
- All Implemented Interfaces:
java.io.Serializable,DataType
- Direct Known Subclasses:
AminoAcids,Codons,GapBalanced,IUPACNucleotides,Nucleotides,NumericDataType,StateRemover,TwoStates
public abstract class SimpleDataType extends java.lang.Object implements DataType
interface for sequence data types- Version:
- $Id: SimpleDataType.java,v 1.14 2003/11/30 05:29:22 matt Exp $
- Author:
- Alexei Drummond
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface pal.datatype.DataType
DataType.Utils
-
-
Field Summary
-
Fields inherited from interface pal.datatype.DataType
AMINO_ACID_DESCRIPTION, AMINOACIDS, CODON_DESCRIPTION, CODONS, GAP_BALANCED, GAP_BALANCED_DESCRIPTION, IUPAC_NUCELOTIDES_DESCRIPTION, IUPACNUCLEOTIDES, NUCLEOTIDE_DESCRIPTION, NUCLEOTIDES, NUMERIC, PRIMARY_SUGGESTED_GAP_CHARACTER, SUGGESTED_GAP_CHARACTERS, SUGGESTED_GAP_STATE, SUGGESTED_UNKNOWN_STATE, TWO_STATE_DESCRIPTION, TWOSTATES, UNKNOWN, UNKNOWN_CHARACTER, UNKNOWN_TLA
-
-
Constructor Summary
Constructors Constructor Description SimpleDataType()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description AmbiguousDataTypegetAmbiguousVersion()chargetChar(int state)Handles gap state and then passes on to getStateImplprotected abstract chargetCharImpl(int state)chargetPreferredChar(char c)Automatically handles Gaps for sub classesprotected chargetPreferredCharImpl(char c)Can be overidden by subclasses.intgetRecommendedGapState()intgetRecommendedUnknownState()intgetState(char c)Handles gap char and then passes on to getStateImplprotected abstract intgetStateImpl(char c)For sub classes to implement main functionality of getState.booleanhasGap()booleanisAmbiguous()booleanisGapChar(char c)booleanisGapState(int state)booleanisUnknownChar(char c)booleanisUnknownState(int state)Checks if state is a gap state (then returns true), otherwise passes on to isUnknownStateImplprotected abstract booleanisUnknownStateImpl(int state)For subclasses to handle, without regard for gapsjava.lang.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface pal.datatype.DataType
getDescription, getNumStates, getTypeID
-
-
-
-
Method Detail
-
getState
public final int getState(char c)
Handles gap char and then passes on to getStateImpl
-
getChar
public final char getChar(int state)
Handles gap state and then passes on to getStateImpl
-
getStateImpl
protected abstract int getStateImpl(char c)
For sub classes to implement main functionality of getState. Gaps do not need to be considered
-
getCharImpl
protected abstract char getCharImpl(int state)
-
getPreferredChar
public final char getPreferredChar(char c)
Automatically handles Gaps for sub classes- Specified by:
getPreferredCharin interfaceDataType
-
getPreferredCharImpl
protected char getPreferredCharImpl(char c)
Can be overidden by subclasses. Default implementation get's character's state and that get's the character for that state
-
isUnknownChar
public final boolean isUnknownChar(char c)
- Specified by:
isUnknownCharin interfaceDataType- Returns:
- true if this state is unknown (or a gap)
-
isUnknownState
public final boolean isUnknownState(int state)
Checks if state is a gap state (then returns true), otherwise passes on to isUnknownStateImpl- Specified by:
isUnknownStatein interfaceDataType- Returns:
- true if this state is an unknown state (the same as check if a state is >= the number of states... but neater)
-
isUnknownStateImpl
protected abstract boolean isUnknownStateImpl(int state)
For subclasses to handle, without regard for gaps
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getRecommendedUnknownState
public int getRecommendedUnknownState()
- Specified by:
getRecommendedUnknownStatein interfaceDataType- Returns:
- -1 (not getNumStates())
-
isAmbiguous
public boolean isAmbiguous()
- Specified by:
isAmbiguousin interfaceDataType- Returns:
- false
-
getAmbiguousVersion
public AmbiguousDataType getAmbiguousVersion()
- Specified by:
getAmbiguousVersionin interfaceDataType- Returns:
- null
-
isGapChar
public final boolean isGapChar(char c)
-
isGapState
public final boolean isGapState(int state)
- Specified by:
isGapStatein interfaceDataType- Returns:
- true if state is gap state (-2), false other wise
-
getRecommendedGapState
public final int getRecommendedGapState()
- Specified by:
getRecommendedGapStatein interfaceDataType- Returns:
- GAP_STATE (-2)
-
-