Package org.biojava.bio.dist
Interface Count
-
- All Superinterfaces:
Changeable
- All Known Implementing Classes:
IndexedCount
public interface Count extends Changeable
An encapsulation of a count over the Symbols within an alphabet.
A Count is effectively a vector of counts from an Alphabet.
- Since:
- 1.1
- Author:
- Matthew Pocock
-
-
Field Summary
Fields Modifier and Type Field Description static ChangeType
COUNTS
Whenever a component count changes the values that would be returned by getCount, they should fire a ChangeEvent with this object as the type.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Alphabet
getAlphabet()
The alphabet from which this Count is over.double
getCount(AtomicSymbol s)
Return the counts for a given Symbol.void
increaseCount(AtomicSymbol s, double c)
Set the probability or odds that Symbol s is emitted by this state.void
setCount(AtomicSymbol s, double c)
Set the count for the Symbol s.void
setCounts(Count c)
Set the counts in this Counts to be equal to the counts in c.void
zeroCounts()
Reset all the counts to zero.-
Methods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
-
-
-
-
Field Detail
-
COUNTS
static final ChangeType COUNTS
Whenever a component count changes the values that would be returned by getCount, they should fire a ChangeEvent with this object as the type.
If the whole count changes, then the change and previous fields of the ChangeEvent should be left null. If only a single weight is modified, then change should be of the form Object[] { symbol, new Double(newVal) } and previous should be of the form Object[] { symbol, new Double(oldVal) }
-
-
Method Detail
-
getAlphabet
Alphabet getAlphabet()
The alphabet from which this Count is over.- Returns:
- the Alphabet associated with this Count
-
getCount
double getCount(AtomicSymbol s) throws IllegalSymbolException
Return the counts for a given Symbol.- Parameters:
s
- the Symbol- Returns:
- the number of counts for this symbol
- Throws:
IllegalSymbolException
- if s is not from this Count's alphabet
-
setCount
void setCount(AtomicSymbol s, double c) throws IllegalSymbolException, ChangeVetoException
Set the count for the Symbol s.- 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
void increaseCount(AtomicSymbol s, double c) throws IllegalSymbolException, ChangeVetoException
Set the probability or odds that Symbol s is emitted by this state.- 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
void setCounts(Count c) throws IllegalAlphabetException, ChangeVetoException
Set the counts in this Counts to be equal to the counts in c.- 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
void zeroCounts() throws ChangeVetoException
Reset all the counts to zero.- Throws:
ChangeVetoException
- if this Count does not allow the counts to be tampered with, or if one of the listeners vetoed this change
-
-