Class Production

  • Direct Known Subclasses:
    NamespaceProduction, TermProduction

    public abstract class Production
    extends java.lang.Object
    A new term produced by a production rule
    Author:
    bratseth
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean replacing
      True to add, false to replace, default true
    • Constructor Summary

      Constructors 
      Constructor Description
      Production()
      Creates a produced template term with no label and the default type
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      int getPosition()  
      int getWeight()
      Returns the weight of this production as a percentage (default is 100)
      abstract void produce​(RuleEvaluation e, int offset)
      Produces this at the current match
      void setPosition​(int position)  
      void setReplacing​(boolean replacing)
      True to replace, false to add, if this production can do both.
      void setWeight​(int weight)
      Sets the weight of this production as a percentage (default is 100)
      protected abstract java.lang.String toInnerString()
      All instances of this produces a parseable string output
      java.lang.String toString()
      All instances of this produces a parseable string output
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • replacing

        protected boolean replacing
        True to add, false to replace, default true
    • Constructor Detail

      • Production

        public Production()
        Creates a produced template term with no label and the default type
    • Method Detail

      • setReplacing

        public void setReplacing​(boolean replacing)
        True to replace, false to add, if this production can do both. Default true.
      • getPosition

        public int getPosition()
      • setPosition

        public void setPosition​(int position)
      • setWeight

        public void setWeight​(int weight)
        Sets the weight of this production as a percentage (default is 100)
      • getWeight

        public int getWeight()
        Returns the weight of this production as a percentage (default is 100)
      • produce

        public abstract void produce​(RuleEvaluation e,
                                     int offset)
        Produces this at the current match
        Parameters:
        e - the evaluation context containing the current match and the query
        offset - the offset position at which to produce this. Offsets are used to produce multiple items at one position, inserted in the right order.
      • toString

        public final java.lang.String toString()
        All instances of this produces a parseable string output
        Overrides:
        toString in class java.lang.Object
      • toInnerString

        protected abstract java.lang.String toInnerString()
        All instances of this produces a parseable string output