Inheritance diagram for com::declarativa::interprolog::PrologEngine:
Public Member Functions | |
PrologEngine (String startPrologCommand, boolean debug) | |
abstract void | shutdown () |
File | getJarDirectory () |
void | consultFromPackage (String filename, Object requester) |
void | consultRelative (String filename, Object requester) |
void | load_dynRelative (String filename, Object requester) |
void | interrupt () |
boolean | command (String s) |
void | progressMessage (String s) |
boolean | isDebug () |
void | setDebug (boolean d) |
boolean | teachOneObject (Object example) |
boolean | teachMoreObjects (Object[] examples) |
boolean | teachMoreObjects (ObjectExamplePair[] examples) |
Object[] | deterministicGoal (String G, String OVar, Object[] objectsP, String RVars) |
boolean | deterministicGoal (String G) |
Object[] | deterministicGoal (String G, String RVars) |
boolean | deterministicGoal (String G, String OVar, Object[] objectsP) |
synchronized boolean | isIdle () |
synchronized void | abortTasks () |
synchronized void | interruptTasks () |
boolean | isAvailable () |
void | waitUntilAvailable () |
void | waitUntilIdle () |
Object | handleCallback (Object x) |
final void | firstJavaMessage () |
ResultFromJava | doCallback (Object x) |
int | registerJavaObject (Object x) |
Object | makeInvisible (Object x) |
Object | getRealJavaObject (InvisibleObject o) |
Object | getRealJavaObject (int ID) |
Object | getRealJavaObject (Object o) |
Static Public Member Functions | |
static File | getJarDirectory (Class aClass) |
static void | printBindings (Object[] b) |
static Method | findMethod (Class targetClass, String name, Class[] formalArguments) throws NoSuchMethodException |
static Constructor | findConstructor (Class targetClass, Class[] formalArguments) throws NoSuchMethodException |
static boolean | assignableType (Class left, Class right) |
static String | shortClassName (Class c) |
Data Fields | |
String | startPrologCommand |
boolean | interrupting = false |
final String | firstJavaMessageName = "firstJavaMessage" |
Static Public Attributes | |
static final String | version = "2.0b1" |
static final String | nl = System.getProperty("line.separator") |
static final int | MAX_INT_VALUE = 134217727 |
static final int | MIN_INT_VALUE = -134217728 |
Protected Member Functions | |
boolean | isShutingDown () |
void | operationRelative (String operation, String filename, Object requester) |
abstract boolean | realCommand (String s) |
final void | teachIPobjects (ObjectOutputStream obs) throws IOException |
void | teachBasicObjects (ObjectOutputStream obs) throws IOException |
GoalFromJava | makeDGoalObject (String G, String OVar, Object[] objectsP, String RVars, int timestamp) |
int | incGoalTimestamp () |
synchronized void | scheduleGoal (GoalToExecute g) |
synchronized GoalToExecute | moreRecentToExecute () |
synchronized GoalToExecute | forgetGoal (int timestamp) |
synchronized void | addMessage (MessageExecuting m) |
synchronized void | forgetMessage (MessageExecuting m) |
synchronized MessageExecuting | lastMessageRequest () |
Object | doSomething () |
Protected Attributes | |
long | startTime |
File | tempDirectory |
ObjectRegistry | knownObjects |
boolean | shutingDown = false |
boolean | debug = false |
boolean | topGoalHasStarted = false |
int | goalTimestamp |
Static Protected Attributes | |
static int | numberOfInstances = 0 |
Package Functions | |
void | makeTempDirectory () |
File | copyToTemp (String filename, Object requester) |
Package Attributes | |
Vector | goalsToExecute |
Vector | messagesExecuting |
final Method | getRealJavaObjectMethod |
Definition at line 19 of file PrologEngine.java.
|
Create a Prolog executor, possibly spawning it in a different process or loading it into memory, depending on the implementation by our subclass.
Definition at line 63 of file PrologEngine.java. References findMethod(), getRealJavaObjectMethod, goalsToExecute, knownObjects, makeTempDirectory(), messagesExecuting, numberOfInstances, setDebug(), shutdown(), and startTime. |
|
Do not invoke this Definition at line 503 of file PrologEngine.java. Referenced by com::xsb::interprolog::NativeEngine::startTopGoal(). |
|
Just adds to messagesExecuting Definition at line 482 of file PrologEngine.java. |
|
It is OK to assign an expression typed right to a variable typed left. Delegates on isAssignableFrom Definition at line 759 of file PrologEngine.java. |
|
Execute a Prolog "command" Definition at line 224 of file PrologEngine.java. Referenced by com::declarativa::interprolog::gui::ListenerWindow::ListenerWindow(), com::declarativa::interprolog::examples::HelloWorld::main(), and com::xsb::interprolog::NativeEngine::NativeEngine(). |
|
Extracts a Prolog file from the jar file or directory where the requester's class came from, and asks the background Prolog process to consult it. You should use this method only after your program is stable. The Prolog file is extracted to a temporary file, and automatically deleted on exiting the application.
Definition at line 173 of file PrologEngine.java. Referenced by com::declarativa::interprolog::gui::ListenerWindow::ListenerWindow(), and com::xsb::interprolog::NativeEngine::NativeEngine(). |
|
Consults a Prolog file from the directory where the requester's class would come from if it did not come from a jar file. Adds that directory to the library_directory relation, so modules can be found there
Definition at line 187 of file PrologEngine.java. |
|
Useful when you want to pass objects to Prolog but don't need objects returned. Same as deterministicGoal(G, OVar,objectsP,"[]") Definition at line 444 of file PrologEngine.java. |
|
Useful when you're constructing objects from Prolog, but don't need to pass any from Java. Same as deterministicGoal(G,null,null,RVars) Definition at line 439 of file PrologEngine.java. |
|
A parameterless goal with no result other than success/failure. Same as deterministicGoal(G, null,null,"[]") Definition at line 434 of file PrologEngine.java. |
|
|
Execute a Prolog->Java call Definition at line 604 of file PrologEngine.java. References com::declarativa::interprolog::util::MessageFromProlog::arguments, and com::declarativa::interprolog::util::MessageFromProlog::target. Referenced by com::declarativa::interprolog::util::MessageExecuting::run(). |
|
return result to last javaMessage or pick more recent GoalToExecute Reimplemented in com::declarativa::interprolog::SubprocessEngine. Definition at line 571 of file PrologEngine.java. References com::declarativa::interprolog::util::MessageExecuting::getResult(), and com::declarativa::interprolog::util::MessageExecuting::hasEnded(). |
|
Similar to findMethod(), but for constructors rather than regular methods Definition at line 729 of file PrologEngine.java. |
|
An utility building on the functionality of getMethod(), to provide the javaMessage predicate with method argument polimorphism. If the type signatures do not match exactly, searches all method signatures to see if their arguments are type-compatible. Definition at line 692 of file PrologEngine.java. Referenced by PrologEngine(). |
|
Dummy method, whose name is used to start the callback thread Definition at line 599 of file PrologEngine.java. |
|
Currently does a dumb linear search, enough for our scenarios. 2 possibilities: use Hashtable; make ResultFromProlog bring back a reference to GoalFromJava Definition at line 470 of file PrologEngine.java. |
|
Returns the directory containing the jar with the given class Definition at line 109 of file PrologEngine.java. |
|
Returns the directory containing the jar with the engine class Definition at line 104 of file PrologEngine.java. |
|
Just returns the object, untouched (but "dereferenced" if called from Prolog). This serves the need to get objects in javaMessage because of the way CallbackHandler.doCallback works. For example: ipPrologEngine(_E), stringArraytoList(_O,[miguel,calejo]), javaMessage(_E,_R,getRealJavaObject(_O)),stringArraytoList(_R,List). ... will bind List to [miguel,calejo] and not to an InvisibleObject specification as ordinarly would happen Definition at line 810 of file PrologEngine.java. |
|
Same as getRealJavaObject(InvisibleObject), but accepts an integer ID as argument instead Definition at line 800 of file PrologEngine.java. |
|
Get the object referred by the integer in a InvisibleObject wrapper.
Definition at line 796 of file PrologEngine.java. |
|
Handling of javaMessages and deterministicGoals. This is where most things happen.
Definition at line 546 of file PrologEngine.java. References com::declarativa::interprolog::util::GoalToExecute::setResult(), and com::declarativa::interprolog::util::ResultFromProlog::timestamp. Referenced by com::xsb::interprolog::NativeEngine::callback(). |
|
Interrupt Prolog and make it return to its top level. This is the equivalent to performing a ctrl+c or similar command when using Prolog under a standard console shell. Definition at line 214 of file PrologEngine.java. |
|
Do not invoke this Definition at line 513 of file PrologEngine.java. Referenced by com::xsb::interprolog::NativeEngine::startTopGoal(). |
|
Present implementation is always available, so this always returns true Reimplemented in com::declarativa::interprolog::SubprocessEngine. Definition at line 523 of file PrologEngine.java. |
|
Debug messages are being written Definition at line 240 of file PrologEngine.java. Referenced by com::declarativa::interprolog::gui::ListenerWindow::ListenerWindow(). |
|
The engine is doing nothing Reimplemented in com::xsb::interprolog::NativeEngine. Definition at line 498 of file PrologEngine.java. |
|
This implementation returns false Reimplemented in com::declarativa::interprolog::SubprocessEngine. Definition at line 83 of file PrologEngine.java. |
|
Register an object with this Engine, so it later can be referred from Prolog without serializing it, and returns an InvisibleObject encapsulating the reference.
Definition at line 787 of file PrologEngine.java. Referenced by com::declarativa::interprolog::examples::HelloWindow::HelloWindow(). |
|
Convenience for debugging Definition at line 245 of file PrologEngine.java. |
|
Debugging aid Definition at line 234 of file PrologEngine.java. Referenced by com::xsb::interprolog::NativeEngine::callback(), com::xsb::interprolog::NativeEngine::NativeEngine(), and com::xsb::interprolog::NativeEngine::startTopGoal(). |
|
Implementation of a simple parameterless Prolog goal; does not support recursive nor multithreaded operation, use command instead
Implemented in com::declarativa::interprolog::SubprocessEngine, and com::xsb::interprolog::NativeEngine. |
|
Register an object with this Engine, so it later can be referred from Prolog without serializing it.
Definition at line 777 of file PrologEngine.java. Referenced by com::declarativa::interprolog::gui::PrologEventBroker::actionPerformed(), com::declarativa::interprolog::examples::HelloWindow2::HelloWindow2(), and com::xsb::interprolog::NativeEngine::NativeEngine(). |
|
Adds goal to pool awaiting execution by Prolog Definition at line 456 of file PrologEngine.java. |
|
Release Prolog engine resources, making it unusable Implemented in com::declarativa::interprolog::SubprocessEngine, and com::xsb::interprolog::NativeEngine. Referenced by PrologEngine(). |
|
Provide Prolog with material to construct special objects that actually represent basic type values, so that Prolog can call (through javaMessage) methods with basic type (non-object) arguments. Also provides material for some other convenience objects Definition at line 302 of file PrologEngine.java. Referenced by com::xsb::interprolog::NativeEngine::NativeEngine(). |
|
Send an array of object example pairs to Prolog and generate ipObjectSpec facts. Returns true if this succeeds, false otherwise.
Definition at line 370 of file PrologEngine.java. |
|
Same as teachMoreObjects(ObjectExamplePair[]), but example pairs are constructed with (2) repeated examples for each object
Definition at line 357 of file PrologEngine.java. Referenced by com::declarativa::interprolog::gui::ListenerWindow::ListenerWindow(). |
|
Same as teachMoreObjects(ObjectExamplePair[]), but the single example pair is constructed repeating the object
Definition at line 351 of file PrologEngine.java. Referenced by com::declarativa::interprolog::examples::BackEnd::main(). |
|
Sleeps the current Java thread until this engine is available. If this never happens, we're in trouble. Definition at line 536 of file PrologEngine.java. |
|
Name of first message sent to Java Definition at line 49 of file PrologEngine.java. Referenced by com::xsb::interprolog::NativeEngine::startTopGoal(). |
|
"Constant" used for some special javaMessage handling Definition at line 47 of file PrologEngine.java. Referenced by PrologEngine(). |
|
Prolog Goals whose execution has not yet finished or whose results have not yet been returned to their Java clients Definition at line 42 of file PrologEngine.java. Referenced by PrologEngine(). |
|
goal counter Definition at line 39 of file PrologEngine.java. |
|
Prolog is handling an interrupt Definition at line 35 of file PrologEngine.java. Referenced by com::xsb::interprolog::NativeEngine::startTopGoal(). |
|
Table of object references that can be referred from Prolog without being serialized Definition at line 32 of file PrologEngine.java. Referenced by PrologEngine(). |
|
Maximum integer value. 28 bits is all we got on XSB Prolog Definition at line 55 of file PrologEngine.java. |
|
javaMessage requests that have started execution and whose results have not yet been returned to Prolog. Definition at line 44 of file PrologEngine.java. Referenced by PrologEngine(). |
|
Minimum integer value. Definition at line 57 of file PrologEngine.java. |
|
Convenience for newline Definition at line 27 of file PrologEngine.java. |
|
File path to Prolog machine Definition at line 24 of file PrologEngine.java. |
|
Temporary directory where Prolog files are unjared to. It is automatically declared as a Prolog library_directory Definition at line 29 of file PrologEngine.java. Referenced by com::xsb::interprolog::NativeEngine::NativeEngine(). |
|
InterProlog version Definition at line 22 of file PrologEngine.java. |