Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| GNU Prolog for Java
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## gnu.prolog.vm
Class Interpreter

    java.lang.Object
      gnu.prolog.vm.Interpreter

All Implemented Interfaces:
  HasEnvironment

    public final class Interpreter

extends Object
implements HasEnvironment

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.Goal` user 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)`
`Object` | `getContext(String key)`
`Environment` | `getEnvironment()` get environment
`int` | `getExitCode()`
`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
`void` | `pushBacktrackInfo(BacktrackInfo bi)` push backtrack information
`Object` | `putContext(String key, Object contextValue)`
`int` | `simpleUnify(Term t1, Term t2)` unify two terms, no undo done
`void` | `stop(Interpreter.Goal goal)`
`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

### variables

    protected VariableTerm[] variables

### variablesAmount

    protected int variablesAmount

Constructor Detail

### Interpreter

    protected Interpreter(Environment environment)

  this constructor should not be used by client programs

  Parameters:
    `environment` -

Method Detail

### getEnvironment

    public Environment getEnvironment()

  get environment

  Specified by:
    `getEnvironment` in interface `HasEnvironment`

### getTracer

    public Tracer getTracer()

### putContext

    public Object putContext(String key,
                             Object contextValue)

### getContext

    public Object getContext(String key)

### pushBacktrackInfo

    public void pushBacktrackInfo(BacktrackInfo bi)

  push backtrack information

  Parameters:
    `bi` -

### popBacktrackInfo

    public BacktrackInfo popBacktrackInfo()

  pop backtrack information

  Returns:
    the popped top backtrack information

### popBacktrackInfoUntil

    public void popBacktrackInfoUntil(BacktrackInfo cutPoint)

### peekBacktrackInfo

    public BacktrackInfo peekBacktrackInfo()

  peek top backtrack information

  Returns:
    the top backtrack information

### getUndoPosition

    public int getUndoPosition()

  get current undo position

  Returns:
    the current undo position

### undo

    public void undo(int position)

  undo changes until this position

  Parameters:
    `position` -

### addVariableUndo

    public void addVariableUndo(VariableTerm variable)

  add variable undo

  Parameters:
    `variable` -

### addSpecialUndo

    public void addSpecialUndo(gnu.prolog.vm.UndoData undoDatum)

  add special undo

  Parameters:
    `undoDatum` -

### simpleUnify

    public int simpleUnify(Term t1,
                           Term t2)
                    throws PrologException

  unify two terms, no undo done

  Parameters:
    `t1` -
    `t2` -
  Returns:
    `PrologCode.SUCCESS_LAST` or `PrologCode.FAIL`
  Throws:
    `PrologException`

### unify

    public int unify(Term t1,
                     Term t2)
              throws PrologException

  unify two terms

  Parameters:
    `t1` -
    `t2` -
  Returns:
    `PrologCode.SUCCESS_LAST` or `PrologCode.FAIL`
  Throws:
    `PrologException`

### prepareGoal

    public Interpreter.Goal prepareGoal(Term term)

  prepare goal for execution

  Parameters:
    `term` -
  Returns:
    the prepared Goal

### execute

    public int execute(Interpreter.Goal goal)
                throws PrologException

  Throws:
    `PrologException`

### stop

    public void stop(Interpreter.Goal goal)

### getExitCode

    public int getExitCode()

  Returns:
    The exit code when the prolog interpreter was halted

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| GNU Prolog for Java
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD