|
|
com.declarativa.interprolog
|
Field Summary | |
static int |
MAX_INT_VALUE
Maximum integer value in any supported Prolog. |
static int |
MIN_INT_VALUE
Minimum integer value. |
static String |
version
InterProlog version |
Method Summary | |
boolean |
command(String s)
Execute a Prolog "command". |
boolean |
consultAbsolute(File f)
Consults a Prolog file |
void |
consultFromPackage(String filename,
Object requester)
Extracts a Prolog file from the jar file or directory where the requester's class came from, and asks Prolog process to consult it. |
void |
consultRelative(String filename,
Object requester)
Consults a Prolog file from the directory where the requester's class would come from if it did not come from a jar file. |
boolean |
deterministicGoal(String G)
A parameterless goal with no result other than success/failure. |
Object[] |
deterministicGoal(String G,
String RVars)
Useful when you're constructing objects from Prolog, but don't need to pass any from Java. |
boolean |
deterministicGoal(String G,
String OVar,
Object[] objectsP)
Useful when you want to pass objects to Prolog but don't need objects returned. |
Object[] |
deterministicGoal(String G,
String OVar,
Object[] objectsP,
String RVars)
Synchronously calls a Prolog goal. |
TermModel |
deterministicGoal(TermModel G)
Useful for inter-Prolog goal calling through Java. |
PrologImplementationPeer |
getImplementationPeer()
|
String |
getPrologBaseDirectory()
Returns the installation directory for the Prolog system, without the trailing separator char |
String |
getPrologVersion()
Returns the Prolog system version for this engine |
Object |
getRealJavaObject(int ID)
Same as getRealJavaObject(InvisibleObject), but accepts an integer ID as argument instead |
Object |
getRealJavaObject(InvisibleObject o)
Get the object referred by the integer in a InvisibleObject wrapper. |
Object |
getRealJavaObject(Object o)
Just returns the object, untouched (but "dereferenced" if called from Prolog). |
void |
interrupt()
Interrupt Prolog and make it return to its top level. |
boolean |
isAvailable()
Returns a boolean value indicating whether the engine is available (that is, ready to accept requests). |
boolean |
isDebug()
Debug messages are being written, both Java and Prolog side, cf. ipIsDebugging/0 |
boolean |
isIdle()
This method returns true if this engine is idle (doing nothing: no pending Prolog goals nor Java callbacks), false otherwise. |
void |
load_dynRelative(String filename,
Object requester)
|
Object |
makeInvisible(Object x)
Register an object with this Engine, so it later can be referred from Prolog without serializing it, and returns an InvisibleObject encapsulating the reference. |
int |
registerJavaObject(Object x)
Register an object with this Engine, so it later can be referred from Prolog without serializing it. |
void |
setDebug(boolean d)
Show (or hide) debug messages, both Java and Prolog side, cf. ipIsDebugging/0. |
void |
setThreadedCallbacks(boolean yes)
If true, the Java execution of javaMessage predicates will happen in new threads (default); if false, execution will be under the thread of the deterministicGoal currently executing in Prolog |
void |
shutdown()
Release Prolog engine resources, making it unusable |
boolean |
teachMoreObjects(Object[] examples)
Same as #teachMoreObjects(ObjectExamplePair[]), but example pairs are constructed with (2) repeated examples for each object. |
boolean |
teachMoreObjects(ObjectExamplePair[] examples)
Send an array of object example pairs to Prolog and generate ipObjectSpec facts. |
boolean |
teachOneObject(Object example)
Same as #teachMoreObjects(ObjectExamplePair[]), but the single example pair is constructed repeating the object. |
boolean |
unregisterJavaObject(int ID)
Removes reference to the object from the registry. |
boolean |
unregisterJavaObject(Object obj)
Removes reference to the object from the registry. |
boolean |
unregisterJavaObjects(Class cls)
Removes references to objects of class cls from the registry. |
void |
waitUntilAvailable()
This method blocks until isAvailable() returns true. |
void |
waitUntilIdle()
This method blocks until isIdle() returns true. |
Field Detail |
public static final String version
public static final int MAX_INT_VALUE
ObjectOutputStream
, because
public static final int MIN_INT_VALUE
Method Detail |
public String getPrologVersion()
public void shutdown()
public void consultFromPackage(String filename, Object requester)
filename
- The Prolog file name, including extension; if it has no extension, the Prolog file extensions are appended in turn until a file is foundrequester
- Defines where the Prolog file residesconsultRelative(String, Object)
,
load_dynRelative(String, Object)
public void interrupt()
public boolean command(String s)
public boolean isDebug()
public void setDebug(boolean d)
public Object[] deterministicGoal(String G, String OVar, Object[] objectsP, String RVars)
G
- Prolog goal termOVar
- Prolog variable that will be bound to objectsP arrayobjectsP
- Array of Java objects to pass to Prolog goalRVars
- 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
deterministicGoal(String)
,
deterministicGoal(String,String)
,
deterministicGoal(String,String,Object[])
public boolean deterministicGoal(String G)
public Object[] deterministicGoal(String G, String RVars)
public boolean deterministicGoal(String G, String OVar, Object[] objectsP)
public TermModel deterministicGoal(TermModel G)
buildTermModel(G,GM), javaMessage(E,SM,deterministicGoal(GM)), recoverTermModel(SM,Solution)
public int registerJavaObject(Object x)
x
- Object to be registered
InvisibleObject
public Object makeInvisible(Object x)
x
- Object to be registered
InvisibleObject
public Object getRealJavaObject(InvisibleObject o)
o
- An InvisibleObject
InvisibleObject
public Object getRealJavaObject(int ID)
public Object getRealJavaObject(Object o)
public boolean unregisterJavaObject(int ID)
public boolean unregisterJavaObject(Object obj)
public boolean unregisterJavaObjects(Class cls)
cls
from the registry. This method should be
used with extreme caution since any further prolog calls to the unregistered objects by means
of reference to them in the registry might result in unpredictable behaviour.
public boolean isAvailable()
public void waitUntilAvailable()
isAvailable()
returns true.
public boolean isIdle()
public void waitUntilIdle()
isIdle()
returns true.
public boolean teachOneObject(Object example)
public boolean teachMoreObjects(Object[] examples)
public boolean teachMoreObjects(ObjectExamplePair[] examples)
examples
- The examplesObjectExamplePair
public boolean consultAbsolute(File f)
public void consultRelative(String filename, Object requester)
filename
- The Prolog file name, including suffix; if a path it should use '/' as the separator, independently of the OSrequester
- Defines where the Prolog file residespublic void load_dynRelative(String filename, Object requester)
public PrologImplementationPeer getImplementationPeer()
public String getPrologBaseDirectory()
public void setThreadedCallbacks(boolean yes)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Declarativa - Serviços de Informática, Lda. |