| 
 | GNU Prolog for Java | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgnu.prolog.vm.Interpreter
public final class Interpreter
This class represent interpreter, it should be used only from one thread If
 you need to use interpreter from two threads,
 create new interpreter from
 Environment
| Nested Class Summary | |
|---|---|
| static class | Interpreter.Goaluser level calls | 
| Field Summary | |
|---|---|
| protected  VariableTerm[] | variables | 
| protected  int | variablesAmount | 
| Constructor Summary | |
|---|---|
| protected  | Interpreter(Environment environment)this constructor should not be used by client programs | 
| Method Summary | |
|---|---|
|  void | addSpecialUndo(gnu.prolog.vm.UndoData undoDatum)add special undo | 
|  void | addVariableUndo(VariableTerm variable)add variable undo | 
|  int | execute(Interpreter.Goal goal)Execute the Interpreter.Goaland return the status code indicating how
 successful this was. | 
|  Object | getContext(String key)Deprecated. | 
|  Environment | getEnvironment()get environment | 
|  int | getExitCode()Only call this method if you have had PrologCode.HALTreturned by
 the most recent call toexecute(Goal). | 
|  Tracer | getTracer() | 
|  int | getUndoPosition()get current undo position | 
|  BacktrackInfo | peekBacktrackInfo()peek top backtrack information | 
|  BacktrackInfo | popBacktrackInfo()pop backtrack information | 
|  void | popBacktrackInfoUntil(BacktrackInfo cutPoint) | 
|  Interpreter.Goal | prepareGoal(Term term)prepare goal for execution If this is called before the Goal which was previously prepared but has not yet been stopped is stopped then we save that state so we can jump back to it when this goal has been stopped. | 
|  void | pushBacktrackInfo(BacktrackInfo bi)push backtrack information | 
|  Object | putContext(String key,
           Object contextValue)Deprecated. | 
|  int | runOnce(Term goalTerm)Run the provided goalTerm once returning the value returned by execute(Goal)and then stop the goal. | 
|  int | simpleUnify(Term t1,
            Term t2)unify two terms, no undo done | 
|  void | stop(Interpreter.Goal goal)Once the goal has been finished with and if the goal has not been stopped (as it will have been if SUCCESS_LAST or FAIL has been returned) then stop(Goal)should be run. | 
|  void | undo(int position)undo changes until this position | 
|  int | unify(Term t1,
      Term t2)unify two terms | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
protected VariableTerm[] variables
protected int variablesAmount
| Constructor Detail | 
|---|
protected Interpreter(Environment environment)
environment - | Method Detail | 
|---|
public Environment getEnvironment()
getEnvironment in interface HasEnvironmentpublic Tracer getTracer()
@Deprecated
public Object putContext(String key,
                                    Object contextValue)
@Deprecated public Object getContext(String key)
public void pushBacktrackInfo(BacktrackInfo bi)
bi - public BacktrackInfo popBacktrackInfo()
public void popBacktrackInfoUntil(BacktrackInfo cutPoint)
public BacktrackInfo peekBacktrackInfo()
public int getUndoPosition()
public void undo(int position)
position - public void addVariableUndo(VariableTerm variable)
variable - public void addSpecialUndo(gnu.prolog.vm.UndoData undoDatum)
undoDatum - 
public int simpleUnify(Term t1,
                       Term t2)
                throws PrologException
t1 - t2 - 
PrologCode.SUCCESS_LAST or PrologCode.FAIL
PrologException
public int unify(Term t1,
                 Term t2)
          throws PrologException
t1 - t2 - 
PrologCode.SUCCESS_LAST or PrologCode.FAIL
PrologExceptionpublic Interpreter.Goal prepareGoal(Term term)
term - 
public int execute(Interpreter.Goal goal)
            throws PrologException
Interpreter.Goal and return the status code indicating how
 successful this was.
goal - the goal created using prepareGoal(Term) which is to be
          run.
SUCCESS, PrologCode.SUCCESS_LAST
         , PrologCode.FAIL (or PrologCode.HALT)
PrologExceptionpublic void stop(Interpreter.Goal goal)
stop(Goal) should be run.
goal - the goal to stop.
public int runOnce(Term goalTerm)
            throws PrologException
execute(Goal) and then stop the goal. This is thus an atomic
 operation on the Interpreter.
 
 Runs prepareGoal(Term) then execute(Goal) then if
 necessary stop(Goal). Returns the return code from
 execute(Goal).
goalTerm - the term to be executed
PrologCode.SUCCESS, PrologCode.SUCCESS_LAST or
         PrologCode.FAIL
PrologExceptionpublic int getExitCode()
PrologCode.HALT returned by
 the most recent call to execute(Goal). Otherwise and
 IllegalStateException will be thrown.
| 
 | GNU Prolog for Java | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||