com.xsb.interprolog
Class NativeEngine

java.lang.Object
  |
  +--com.declarativa.interprolog.PrologEngine
        |
        +--com.xsb.interprolog.NativeEngine

public class NativeEngine
extends PrologEngine

A PrologEngine implemented using the Java Native Interface. This class depends on interprolog_callback.c and other files, that are included in the emu directory of XSB Prolog 2.5 and later


Field Summary
 
Fields inherited from class com.declarativa.interprolog.PrologEngine
firstJavaMessageName, interrupting, MAX_INT_VALUE, MIN_INT_VALUE, nl, startPrologCommand, version
 
Constructor Summary
NativeEngine(String startPrologCommand)
           
NativeEngine(String XSB_DIR, boolean debug)
          The XSB dll must be in a directory in the Windows PATH so the Java loader finds it
 
Method Summary
 Object[] deterministicGoal(String G, String OVar, Object[] objectsP, String RVars)
          Synchronously calls a Prolog goal.
 boolean isIdle()
          The engine is doing nothing
 void setDebug(boolean d)
           
 void shutdown()
          Release Prolog engine resources, making it unusable
 
Methods inherited from class com.declarativa.interprolog.PrologEngine
abortTasks, assignableType, command, consultFromPackage, consultRelative, deterministicGoal, deterministicGoal, deterministicGoal, doCallback, findConstructor, findMethod, firstJavaMessage, getJarDirectory, getJarDirectory, getRealJavaObject, getRealJavaObject, getRealJavaObject, handleCallback, interrupt, interruptTasks, isAvailable, isDebug, load_dynRelative, makeInvisible, printBindings, progressMessage, registerJavaObject, shortClassName, teachMoreObjects, teachMoreObjects, teachOneObject, waitUntilAvailable, waitUntilIdle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NativeEngine

public NativeEngine(String startPrologCommand)

NativeEngine

public NativeEngine(String XSB_DIR,
                    boolean debug)
The XSB dll must be in a directory in the Windows PATH so the Java loader finds it

Method Detail

setDebug

public void setDebug(boolean d)
Overrides:
setDebug in class PrologEngine

shutdown

public void shutdown()
Description copied from class: PrologEngine
Release Prolog engine resources, making it unusable

Specified by:
shutdown in class PrologEngine

deterministicGoal

public Object[] deterministicGoal(String G,
                                  String OVar,
                                  Object[] objectsP,
                                  String RVars)
Description copied from class: PrologEngine
Synchronously calls a Prolog goal. Only the first solution is considered. G should contain a syntactically correct Prolog term, without the trailing dot (.). Throws an IPAbortedException if a Prolog abort happens, and an IPInterruptedException if the interrupt() method was invoked.

Overrides:
deterministicGoal in class PrologEngine
Parameters:
G - Prolog goal term
OVar - Prolog variable that will be bound to objectsP array
objectsP - Array of Java objects to pass to Prolog goal
RVars - Prolog list with object specifications, typically containing variables occurring in g. If null a single binding will be returned, containing a TermModel object representing the goal term solution
Returns:
a new array containing an object for each term in the rVars list, or null if goal fails
See Also:
PrologEngine.deterministicGoal(String), PrologEngine.deterministicGoal(String,String), PrologEngine.deterministicGoal(String,String,Object[])

isIdle

public boolean isIdle()
Description copied from class: PrologEngine
The engine is doing nothing

Overrides:
isIdle in class PrologEngine