/** * Initialize the choice point state. * * @param interpreter the parent interpreter whose state is to be preserved here, its arg stack * defines the parameters for the target goal */ @Override public void init(LPInterpreter interpreter) { super.init(interpreter); context = interpreter.getContext(); generator = interpreter.getEngine().generatorFor(goal); generator.addConsumer(this); resultIndex = 0; }
/** Restore the state of an interpreter from this frame */ public void restoreState(LPInterpreter interp) { interp.unwindTrail(0); for (int i = 0; i < trailLength; i++) { interp.bind(trailVars[i], trailValues[i]); } if (pVars != null) { System.arraycopy(pVars, 0, envFrame.pVars, 0, pVars.length); } }
/** * Constructor. Initialize the triple match to preserve the current context of the given * LPInterpreter and search for the match defined by the current argument registers * * @param intepreter the interpreter instance whose env, trail and arg values are to be preserved */ public TopLevelTripleMatchFrame(LPInterpreter interpreter, TriplePattern goal) { init(interpreter); this.matchIterator = interpreter.getEngine().getInfGraph().findDataMatches(goal); this.goal = goal; }