Class AssemblySentential<NT extends AssemblyNonTerminal>

  • Type Parameters:
    NT - the type of non-terminals
    T - the type of terminals
    All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<AssemblySentential<NT>>, java.lang.Iterable<AssemblySymbol>, java.util.Collection<AssemblySymbol>, java.util.List<AssemblySymbol>

    public class AssemblySentential<NT extends AssemblyNonTerminal>
    extends org.apache.commons.collections4.list.AbstractListDecorator<AssemblySymbol>
    implements java.lang.Comparable<AssemblySentential<NT>>
    A "string" of symbols To avoid overloading the word "String", we call this a "sentential". Technically, to be a "sentential" in the classic sense, it must be a possible element in the derivation of a sentence in the grammar starting with the start symbol. We ignore that if only for the sake of naming.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      AssemblySentential()
      Construct a blank string This is suitable as a blank start, to add new symbols, or to use directly as the RHS, effectively creating an "epsilon" production.
      AssemblySentential​(AssemblySymbol... syms)
      Construct a string from any number of symbols
      AssemblySentential​(java.util.List<? extends AssemblySymbol> symbols)
      Construct a string from the given list of symbols
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean addWS()
      Add "optional" whitespace, if not already preceded by whitespace
      int compareTo​(AssemblySentential<NT> that)  
      protected java.util.List<AssemblySymbol> decorated()  
      void finish()
      Trim leading and trailing whitespace, and make the string immutable
      int hashCode()  
      AssemblySentential<NT> subList​(int fromIndex, int toIndex)  
      java.lang.String toString()  
      • Methods inherited from class org.apache.commons.collections4.list.AbstractListDecorator

        add, addAll, equals, get, indexOf, lastIndexOf, listIterator, listIterator, remove, set
      • Methods inherited from class org.apache.commons.collections4.collection.AbstractCollectionDecorator

        add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, setCollection, size, toArray, toArray
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.List

        add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, replaceAll, retainAll, size, sort, spliterator, toArray, toArray
    • Constructor Detail

      • AssemblySentential

        public AssemblySentential​(java.util.List<? extends AssemblySymbol> symbols)
        Construct a string from the given list of symbols
        Parameters:
        symbols -
      • AssemblySentential

        public AssemblySentential()
        Construct a blank string This is suitable as a blank start, to add new symbols, or to use directly as the RHS, effectively creating an "epsilon" production.
      • AssemblySentential

        public AssemblySentential​(AssemblySymbol... syms)
        Construct a string from any number of symbols
        Parameters:
        syms -
    • Method Detail

      • decorated

        protected java.util.List<AssemblySymbol> decorated()
        Overrides:
        decorated in class org.apache.commons.collections4.list.AbstractListDecorator<AssemblySymbol>
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class org.apache.commons.collections4.collection.AbstractCollectionDecorator<AssemblySymbol>
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface java.util.Collection<NT extends AssemblyNonTerminal>
        Specified by:
        hashCode in interface java.util.List<NT extends AssemblyNonTerminal>
        Overrides:
        hashCode in class org.apache.commons.collections4.list.AbstractListDecorator<AssemblySymbol>
      • addWS

        public boolean addWS()
        Add "optional" whitespace, if not already preceded by whitespace
        Returns:
        true if whitespace was added
      • finish

        public void finish()
        Trim leading and trailing whitespace, and make the string immutable