Class Production

java.lang.Object
com.yahoo.prelude.semantics.rule.Production
Direct Known Subclasses:
NamespaceProduction, TermProduction

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

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

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

    Modifier and Type
    Method
    Description
    int
     
    int
    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 String
    All instances of this produces a parseable string output
    final String
    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 Details

    • replacing

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

    • Production

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

    • 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 String toString()
      All instances of this produces a parseable string output
      Overrides:
      toString in class Object
    • toInnerString

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