Class IndexedCount

  • All Implemented Interfaces:
    java.io.Serializable, Count, Changeable

    public final class IndexedCount
    extends AbstractChangeable
    implements Count, java.io.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 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: Count
        The alphabet from which this Count is over.
        Specified by:
        getAlphabet in interface Count
        Returns:
        the Alphabet associated with this Count
      • setCount

        public void setCount​(AtomicSymbol s,
                             double c)
                      throws IllegalSymbolException,
                             ChangeVetoException
        Description copied from interface: Count
        Set the count for the Symbol s.
        Specified by:
        setCount in interface Count
        Parameters:
        s - the Symbol emitted
        c - 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 case
        ChangeVetoException - 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: Count
        Set the probability or odds that Symbol s is emitted by this state.
        Specified by:
        increaseCount in interface Count
        Parameters:
        s - the Symbol emitted
        c - 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 case
        ChangeVetoException - if this Count does not allow counts to be tampered with, or if one of the listeners vetoed this change
      • zeroCounts

        public void zeroCounts()
                        throws ChangeVetoException
        Description copied from interface: Count
        Reset all the counts to zero.
        Specified by:
        zeroCounts in interface Count
        Throws:
        ChangeVetoException - if this Count does not allow the counts to be tampered with, or if one of the listeners vetoed this change