Class CompositeCondition

java.lang.Object
com.yahoo.prelude.semantics.rule.Condition
com.yahoo.prelude.semantics.rule.CompositeCondition
Direct Known Subclasses:
AndCondition, ChoiceCondition, ComparisonCondition, CompositeItemCondition, SequenceCondition

public abstract class CompositeCondition extends Condition
A condition which contains a list of conditions
Author:
bratseth
  • Constructor Details

    • CompositeCondition

      public CompositeCondition()
  • Method Details

    • preMatchHook

      public void preMatchHook(RuleEvaluation e)
      Description copied from class: Condition
      Called when match is called, before anything else. Always call super.preMatchHook when overriding.
      Overrides:
      preMatchHook in class Condition
    • postMatchHook

      public void postMatchHook(RuleEvaluation e)
      Description copied from class: Condition
      Called just before match returns, on any return condition including exceptions. Always call super.postMatchHook when overriding
      Overrides:
      postMatchHook in class Condition
    • hasOpenChoicepoint

      protected boolean hasOpenChoicepoint(RuleEvaluation evaluation)
      Description copied from class: Condition
      Returns whether there is an open choice in this or any of its subconditions. Returns false by default, must be overriden by conditions which may generate choices open accross multiple calls to matches, or contain such conditions.
      Overrides:
      hasOpenChoicepoint in class Condition
    • addCondition

      public void addCondition(Condition condition)
    • setCondition

      public void setCondition(int index, Condition condition)
      Sets the condition at the given index
    • conditionSize

      public int conditionSize()
      Returns the number of subconditions
    • getCondition

      public Condition getCondition(int i)
      Returns the condition at the given index
      Parameters:
      i - the 0-base index
      Returns:
      the condition at this index
      Throws:
      IndexOutOfBoundsException - if there is no condition at this index
    • removeCondition

      public Condition removeCondition(int i)
      Returns the condition at the given index
      Parameters:
      i - the 0-base index
      Returns:
      the removed condition
      Throws:
      IndexOutOfBoundsException - if there is no condition at this index
    • conditionIterator

      public Iterator<Condition> conditionIterator()
      Returns an iterator of the immediate children of this condition
    • conditions

      public List<Condition> conditions()
    • makeReferences

      public void makeReferences(RuleBase rules)
      Description copied from class: Condition
      Override if references needs to be set in this condition of its children
      Overrides:
      makeReferences in class Condition
    • useParentheses

      protected boolean useParentheses()
      Whether this should be output with parentheses, default is parent!=null
    • toInnerString

      protected String toInnerString(String conditionSeparator)
    • conditionsToString

      protected final String conditionsToString(String conditionSeparator)
    • allSubConditionsMatches

      protected final boolean allSubConditionsMatches(RuleEvaluation e)
      Returns whether all the conditions of this matches the current evaluation state