public class SimpleEmissionState extends AbstractChangeable implements EmissionState, Serializable
Annotatable.AnnotationForwarder
Modifier and Type | Field and Description |
---|---|
protected ChangeForwarder |
annotationForwarder |
protected ChangeForwarder |
distForwarder |
ADVANCE, DISTRIBUTION
ANNOTATION
Constructor and Description |
---|
SimpleEmissionState(String name,
Annotation ann,
int[] advance,
Distribution dis) |
Modifier and Type | Method and Description |
---|---|
int[] |
getAdvance()
Determine the number of symbols this state advances along
one or more symbol lists.
|
Annotation |
getAnnotation()
Should return the associated annotation object.
|
Set |
getBases() |
protected ChangeSupport |
getChangeSupport(ChangeType ct)
Called to retrieve the ChangeSupport for this object.
|
Distribution |
getDistribution()
Get the Distribution associated with this state.
|
Alphabet |
getMatches()
The alphabet containing the symbols matched by this ambiguity symbol.
|
String |
getName()
The long name for the symbol.
|
List |
getSymbols()
The list of symbols that this symbol is composed from.
|
char |
getToken() |
void |
registerWithTrainer(ModelTrainer trainer)
Perform any registration that is necessary with mt.
|
void |
setAdvance(int[] advance)
Set the advance array.
|
void |
setAnnotation(Annotation ann) |
void |
setDistribution(Distribution dis)
Set the Distribution associated with this state.
|
void |
setName(String name) |
addChangeListener, addChangeListener, generateChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
protected transient ChangeForwarder annotationForwarder
protected transient ChangeForwarder distForwarder
public SimpleEmissionState(String name, Annotation ann, int[] advance, Distribution dis)
public final Annotation getAnnotation()
Annotatable
getAnnotation
in interface Annotatable
public final void setAnnotation(Annotation ann) throws ChangeVetoException
ChangeVetoException
public final Distribution getDistribution()
EmissionState
Get the Distribution associated with this state.
If the state is to be added to an HMM, then the state's emission spectrum must be compatible with the HMM - that is, their emission alphabets must match.
getDistribution
in interface EmissionState
public final void setDistribution(Distribution dis) throws ChangeVetoException
EmissionState
setDistribution
in interface EmissionState
dis
- the new Distribution to useChangeVetoException
- if the implementation doesn't support setting
the distribution, or if the change is vetoedpublic int[] getAdvance()
EmissionState
getAdvance
in interface EmissionState
public void setAdvance(int[] advance) throws ChangeVetoException
EmissionState
setAdvance
in interface EmissionState
advance
- an array of ints, specifying how many symbols are consumed
from each sequenceChangeVetoException
- if the implementation doesn't support setting
advance, or if the change is vetoedpublic char getToken()
public final String getName()
Symbol
public Alphabet getMatches()
Symbol
This alphabet contains all of, and only, the symbols matched by this symbol. For example, the symbol representing the DNA ambiguity code for W would contain the symbol for A and T from the DNA alphabet.
getMatches
in interface Symbol
public List getSymbols()
BasisSymbol
The list of symbols that this symbol is composed from.
In the usual case, this list will contain just this single symbol. In the case where a symbol represents an ordered combination of other symbols, the list will contain each of these BasisSymbols.
getSymbols
in interface BasisSymbol
public void registerWithTrainer(ModelTrainer trainer)
Trainable
This may include registering handlers for transition or emission counts, or registering other Trainable objects with the ModelTrainer.
registerWithTrainer
in interface Trainable
trainer
- the ModelTrainer that encapsulates the training environmentprotected ChangeSupport getChangeSupport(ChangeType ct)
AbstractChangeable
Your implementation of this method should have the following structure:
It is usual for the forwarding listeners (someForwarder in this example) to
be transient and lazily instantiated. Be sure to register & unregister the
forwarder in the code that does the ChangeEvent handling in setter methods.
ChangeSupport cs = super.getChangeSupport(ct);
if(someForwarder == null && ct.isMatching(SomeInterface.SomeChangeType)) {
someForwarder = new ChangeForwarder(...
this.stateVariable.addChangeListener(someForwarder, VariableInterface.AChange);
}
return cs;
getChangeSupport
in class AbstractChangeable
Copyright © 2014 BioJava. All rights reserved.