Package com.yahoo.prelude.semantics.rule
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
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 matchvoid
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
toInnerString()
All instances of this produces a parseable string outputString
toString()
All instances of this produces a parseable string output
-
-
-
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 queryoffset
- 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
-
toInnerString
protected abstract String toInnerString()
All instances of this produces a parseable string output
-
-