Class ChoicePointFrame


public class ChoicePointFrame extends GenericChoiceFrame
Represents a single frame in the LP interpreter's choice point stack, represents the OR part of the search tree.

This is used in the inner loop of the interpreter and so is a pure data structure not an abstract data type and assumes privileged access to the interpreter state.

  • Constructor Details

    • ChoicePointFrame

      public ChoicePointFrame(LPInterpreter interpreter, List<RuleClauseCode> predicateClauses, boolean isSingleton)
      Constructor. Initialize a choice point to preserve the current context of the given intepreter and then call the given set of predicates.
      Parameters:
      interpreter - the LPInterpreter whose state is to be preserved
      predicateClauses - the list of predicates for this choice point
      isSingleton - true if this choice should abort after one successful result
  • Method Details

    • init

      public void init(LPInterpreter interpreter, List<RuleClauseCode> predicateClauses)
      Initialize a choice point to preserve the current context of the given intepreter and then call the given set of predicates.
      Parameters:
      interpreter - the LPInterpreter whose state is to be preserved
      predicateClauses - the list of predicates for this choice point
    • hasNext

      public boolean hasNext()
      Is there another clause in the sequence?
    • nextClause

      public RuleClauseCode nextClause()
      Return the next clause in the sequence.
    • noteSuccess

      public void noteSuccess()
      Note successful return from this choice point. This closes the choice point if it is a singleton.