Package jebl.evolution.sequences

# Class State

java.lang.Object
jebl.evolution.sequences.State

All Implemented Interfaces:
  `Comparable`

Direct Known Subclasses:
  `AminoAcidState`, `CodonState`, `NucleotideState`

public abstract class State extends Object implements Comparable

Version:
  $Id: State.java 1002 2009-05-27 03:33:19Z matt_kearse $
Author:
  Andrew Rambaut, Alexei Drummond

## Method Summary

Modifier and Type
Method
Description
`int`
`compareTo(Object o)`
`double`
`fractionEqual(State other)`
Determine how much in common these potentially ambigous states have as a fraction between 0 and 1 2 non-ambiguous states will return 0.
`Set<State>`
`getCanonicalStates()`
`String`
`getCode()`
Returns the 1 letter code for this state.
`String`
`getFullName()`
A descriptive name for this state.
`int`
`getIndex()`
`String`
`getName()`
Deprecated.
you probably want to use `getFullName()` or `getCode()`.
`abstract SequenceType`
`getType()`
`boolean`
`isAmbiguous()`
`abstract boolean`
`isGap()`
`boolean`
`possiblyEqual(State other)`
`String`
`toString()`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Method Details

### getCode

public String getCode()
Returns the 1 letter code for this state.

Returns:
  the 1 letter code for this state.

### getIndex

public int getIndex()

### getFullName

public String getFullName()
A descriptive name for this state. e.g. "Phenylalanine" or "Adenine".

Returns:
  A descriptive name for this state. e.g. "Phenylalanine" or "Adenine".

### getName

@Deprecated public String getName()
Deprecated.
you probably want to use `getFullName()` or `getCode()`.
The 1 letter code (for legacy purposes). Same as `getCode()`

Returns:
  The 1 letter code (for legacy purposes). Same as `getCode()`
See Also:
  - `getFullName()`

### isAmbiguous

public boolean isAmbiguous()

### getCanonicalStates

public Set<State> getCanonicalStates()

### possiblyEqual

public boolean possiblyEqual(State other)

Parameters:
  `other` - another state to check for the equality with.
Returns:
  true if the other state is or possibly is equal to this state, taking ambiguities into account, i.e. if the ambiguity sets of this and the other state intersect.

### compareTo

public int compareTo(Object o)

Specified by:
  `compareTo` in interface `Comparable`

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### isGap

public abstract boolean isGap()

### getType

public abstract SequenceType getType()

### fractionEqual

public double fractionEqual(State other)
Determine how much in common these potentially ambigous states have as a fraction between 0 and 1 2 non-ambiguous states will return 0. 2 identical non-ambiguous states will return 1. e.g. for Nucleotides R,A = 0.5 R,G = 0.5 R,M = 0.25

Parameters:
  `other` - another state to compare with
Returns:
  the fraction of canonical states that the 2 potentially ambiguous states have in common between 0 and 1.