Class SimpleAlphabet

    • Field Detail

      • annotationForwarder

        protected transient ChangeForwarder annotationForwarder
    • Constructor Detail

      • SimpleAlphabet

        public SimpleAlphabet()
      • SimpleAlphabet

        public SimpleAlphabet​(java.util.Set symbols)
      • SimpleAlphabet

        public SimpleAlphabet​(java.lang.String name)
      • SimpleAlphabet

        public SimpleAlphabet​(java.util.Set symbols,
                              java.lang.String name)
    • Method Detail

      • iterator

        public java.util.Iterator iterator()
        Description copied from interface: FiniteAlphabet
        Retrieve an Iterator over the AtomicSymbols in this FiniteAlphabet.

        Each AtomicSymbol as for which this.contains(as) is true will be returned exactly once by this iterator in no specified order.

        Specified by:
        iterator in interface FiniteAlphabet
        Returns:
        an Iterator over the contained AtomicSymbol objects
      • getName

        public java.lang.String getName()
        Description copied from interface: Alphabet
        Get the name of the alphabet.
        Specified by:
        getName in interface Alphabet
        Returns:
        the name as a string.
      • setName

        public void setName​(java.lang.String name)
        Assign a name to the alphabet
        Parameters:
        name - the name you wish to give this alphabet
      • getAnnotation

        public Annotation getAnnotation()
        Description copied from interface: Annotatable
        Should return the associated annotation object.
        Specified by:
        getAnnotation in interface Annotatable
        Returns:
        an Annotation object, never null
      • size

        public int size()
        Description copied from interface: FiniteAlphabet
        The number of symbols in the alphabet.
        Specified by:
        size in interface FiniteAlphabet
        Returns:
        the size of the alphabet
      • removeSymbol

        public void removeSymbol​(Symbol s)
                          throws IllegalSymbolException
        Description copied from interface: FiniteAlphabet
        Remove a symbol from this alphabet.

        If the symbol matches multiple AtomicSymbols, then each matching symbol it will be removed.

        Specified by:
        removeSymbol in interface FiniteAlphabet
        Parameters:
        s - the Symbol to removeintGot
        Throws:
        IllegalSymbolException - if the symbol is null, or if for any reason it can't be removed
      • getAlphabets

        public java.util.List getAlphabets()
        Description copied from interface: Alphabet
        Return an ordered List of the alphabets which make up a compound alphabet. For simple alphabets, this will return a singleton list of itself. The returned list should be immutable.
        Specified by:
        getAlphabets in interface Alphabet
        Returns:
        a List of alphabets
      • getChangeSupport

        protected ChangeSupport getChangeSupport​(ChangeType ct)
        Description copied from class: AbstractChangeable
        Called to retrieve the ChangeSupport for this object.

        Your implementation of this method should have the following structure:

         ChangeSupport cs = super.getChangeSupport(ct);
        
         if(someForwarder == null && ct.isMatching(SomeInterface.SomeChangeType)) {
           someForwarder = new ChangeForwarder(...
        
           this.stateVariable.addChangeListener(someForwarder, VariableInterface.AChange);
         }
        
         return cs;
         
        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.
        Overrides:
        getChangeSupport in class AbstractChangeable