Package org.biojava.bio.dist
Class IndexedCount
- java.lang.Object
 - 
- org.biojava.utils.AbstractChangeable
 - 
- org.biojava.bio.dist.IndexedCount
 
 
 
- 
- All Implemented Interfaces:
 Serializable,Count,Changeable
public final class IndexedCount extends AbstractChangeable implements Count, Serializable
An encapsulation of a count over the Symbols within a FiniteAlphabet using an AlphabetIndex object.- Since:
 - 1.1
 - Author:
 - Matthew Pocock, Mark Schreiber (serialization), Thomas Down (more serialization...)
 - See Also:
 - Serialized Form
 
 
- 
- 
Constructor Summary
Constructors Constructor Description IndexedCount(AlphabetIndex indexer)Get a new InexedCount for an alphabet indexer.IndexedCount(FiniteAlphabet fa)Get a new IdexedCount for an alphabet using the default indexer. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AlphabetgetAlphabet()The alphabet from which this Count is over.doublegetCount(AtomicSymbol s)Return the counts for a given Symbol.voidincreaseCount(AtomicSymbol s, double c)Set the probability or odds that Symbol s is emitted by this state.voidsetCount(AtomicSymbol s, double c)Set the count for the Symbol s.voidsetCounts(Count c)Set the counts in this Counts to be equal to the counts in c.voidzeroCounts()Reset all the counts to zero.- 
Methods inherited from class org.biojava.utils.AbstractChangeable
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener 
- 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
- 
Methods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
IndexedCount
public IndexedCount(FiniteAlphabet fa)
Get a new IdexedCount for an alphabet using the default indexer.- Parameters:
 fa- the FiniteAlphabet to count
 
- 
IndexedCount
public IndexedCount(AlphabetIndex indexer)
Get a new InexedCount for an alphabet indexer.- Parameters:
 indexer- the AlphabetIndex used to map between symbols and indecies
 
 - 
 
- 
Method Detail
- 
getAlphabet
public Alphabet getAlphabet()
Description copied from interface:CountThe alphabet from which this Count is over.- Specified by:
 getAlphabetin interfaceCount- Returns:
 - the Alphabet associated with this Count
 
 
- 
getCount
public double getCount(AtomicSymbol s) throws IllegalSymbolException
Description copied from interface:CountReturn the counts for a given Symbol.- Specified by:
 getCountin interfaceCount- Parameters:
 s- the Symbol- Returns:
 - the number of counts for this symbol
 - Throws:
 IllegalSymbolException- if s is not from this Count's alphabet
 
- 
setCount
public void setCount(AtomicSymbol s, double c) throws IllegalSymbolException, ChangeVetoException
Description copied from interface:CountSet the count for the Symbol s.- Specified by:
 setCountin interfaceCount- Parameters:
 s- the Symbol emittedc- the new count for the Symbol- Throws:
 IllegalSymbolException- if s is not from this state's alphabet, or if it is an ambiguity symbol and the implementation can't handle this caseChangeVetoException- if this distribution does not allow counts to be tampered with, or if one of the listeners vetoed this change
 
- 
increaseCount
public void increaseCount(AtomicSymbol s, double c) throws IllegalSymbolException, ChangeVetoException
Description copied from interface:CountSet the probability or odds that Symbol s is emitted by this state.- Specified by:
 increaseCountin interfaceCount- Parameters:
 s- the Symbol emittedc- the delta to add to the count for the Symbol- Throws:
 IllegalSymbolException- if s is not from this state's alphabet, or if it is an ambiguity symbol and the implementation can't handle this caseChangeVetoException- if this Count does not allow counts to be tampered with, or if one of the listeners vetoed this change
 
- 
setCounts
public void setCounts(Count c) throws IllegalAlphabetException, ChangeVetoException
Description copied from interface:CountSet the counts in this Counts to be equal to the counts in c.- Specified by:
 setCountsin interfaceCount- Parameters:
 c- the Count object to copy the counts from- Throws:
 IllegalAlphabetException- if c has a different Alphabet to this CountChangeVetoException- if this Count does not allow the counts to be tampered with, or if one of the listeners vetoed this change
 
- 
zeroCounts
public void zeroCounts() throws ChangeVetoException
Description copied from interface:CountReset all the counts to zero.- Specified by:
 zeroCountsin interfaceCount- Throws:
 ChangeVetoException- if this Count does not allow the counts to be tampered with, or if one of the listeners vetoed this change
 
 - 
 
 -