com::xsb::interprolog::NativeEngine Class Reference

Inheritance diagram for com::xsb::interprolog::NativeEngine:

com::declarativa::interprolog::PrologEngine

Public Member Functions

 NativeEngine (String startPrologCommand)
 NativeEngine (String XSB_DIR, boolean debug)
void setDebug (boolean d)
void shutdown ()
Object[] deterministicGoal (String G, String OVar, Object[] objectsP, String RVars)
boolean isIdle ()

Protected Member Functions

native int put_bytes (byte[] b, int size, int args, String jStr)
native void xsb_interrupt ()
void startTopGoal ()
void doInterrupt ()
boolean realCommand (String s)
byte[] callback (byte[] in)

Detailed Description

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

Definition at line 16 of file NativeEngine.java.


Constructor & Destructor Documentation

com::xsb::interprolog::NativeEngine::NativeEngine String  XSB_DIR,
boolean  debug
[inline]
 

The XSB dll must be in a directory in the Windows PATH so the Java loader finds it

Definition at line 41 of file NativeEngine.java.

References com::declarativa::interprolog::PrologEngine::command(), com::declarativa::interprolog::PrologEngine::consultFromPackage(), com::declarativa::interprolog::PrologEngine::numberOfInstances, com::declarativa::interprolog::PrologEngine::progressMessage(), put_bytes(), com::declarativa::interprolog::PrologEngine::registerJavaObject(), startTopGoal(), com::declarativa::interprolog::PrologEngine::teachBasicObjects(), com::declarativa::interprolog::PrologEngine::teachIPobjects(), and com::declarativa::interprolog::PrologEngine::tempDirectory.


Member Function Documentation

byte [] com::xsb::interprolog::NativeEngine::callback byte[]  in  )  [inline, protected]
 

Accepts a serialized object in the argument and returns another; handleCallback does the actual work

Definition at line 137 of file NativeEngine.java.

References com::declarativa::interprolog::PrologEngine::handleCallback(), and com::declarativa::interprolog::PrologEngine::progressMessage().

Object [] com::xsb::interprolog::NativeEngine::deterministicGoal String  G,
String  OVar,
Object[]  objectsP,
String  RVars
[inline]
 

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.

See also:
deterministicGoal(String)

deterministicGoal(String,String)

deterministicGoal(String,String,Object[])

Returns:
a new array containing an object for each term in the rVars list, or null if goal fails
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

Reimplemented from com::declarativa::interprolog::PrologEngine.

Definition at line 130 of file NativeEngine.java.

References com::declarativa::interprolog::PrologEngine::topGoalHasStarted.

boolean com::xsb::interprolog::NativeEngine::isIdle  )  [inline]
 

The engine is doing nothing

Reimplemented from com::declarativa::interprolog::PrologEngine.

Definition at line 165 of file NativeEngine.java.

native int com::xsb::interprolog::NativeEngine::put_bytes byte[]  b,
int  size,
int  args,
String  jStr
[protected]
 

Returns the xsb_query result code

Referenced by NativeEngine().

boolean com::xsb::interprolog::NativeEngine::realCommand String  s  )  [inline, protected, virtual]
 

Implementation of a simple parameterless Prolog goal; does not support recursive nor multithreaded operation, use command instead

See also:
command(String)

Implements com::declarativa::interprolog::PrologEngine.

Definition at line 120 of file NativeEngine.java.

void com::xsb::interprolog::NativeEngine::shutdown  )  [inline, virtual]
 

Release Prolog engine resources, making it unusable

Implements com::declarativa::interprolog::PrologEngine.

Definition at line 112 of file NativeEngine.java.

void com::xsb::interprolog::NativeEngine::startTopGoal  )  [inline, protected]
 

Calls the first Prolog goal in a background thread. That goal will return only if an interrupt or error occurs; this method should handle these conditions properly

Definition at line 79 of file NativeEngine.java.

References com::declarativa::interprolog::PrologEngine::abortTasks(), com::declarativa::interprolog::PrologEngine::firstJavaMessageName, com::declarativa::interprolog::PrologEngine::interrupting, com::declarativa::interprolog::PrologEngine::interruptTasks(), and com::declarativa::interprolog::PrologEngine::progressMessage().

Referenced by NativeEngine().

native void com::xsb::interprolog::NativeEngine::xsb_interrupt  )  [protected]
 

Simulates a ctrl-C

Referenced by doInterrupt().


The documentation for this class was generated from the following file:
Generated on Wed Jul 26 13:30:54 2006 for XSB by  doxygen 1.4.5