ubc.cs.JLog.Foundation
Class jAPIQueryThread
java.lang.Object
java.lang.Thread
ubc.cs.JLog.Foundation.jPrologServiceThread
ubc.cs.JLog.Foundation.jRetryQueryThread
ubc.cs.JLog.Foundation.jAPIQueryThread
- All Implemented Interfaces:
- java.lang.Runnable
public class jAPIQueryThread
- extends jRetryQueryThread
This class is the thread that attempts to prove a query. It can parse an
input string into the predicates of a user query, and it contains the
Prolog prover itself. The prover runs as part of this thread. It is similar to
jUserQueryThread
, but is designed for use via jPrologAPI
where the
caller is responsible to handling exceptions.
- Author:
- Glendon Holst
Nested classes/interfaces inherited from class java.lang.Thread |
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
qinput
protected java.lang.String qinput
beginq
protected jPrologServiceBroadcaster beginq
retryq
protected jPrologServiceBroadcaster retryq
endq
protected jPrologServiceBroadcaster endq
debugm
protected jPrologServiceBroadcaster debugm
prover
protected jProver prover
query
protected jPredicateTerms query
result
protected boolean result
retry
protected int retry
var_vector
protected jVariableVector var_vector
var_prebindings
protected java.util.Hashtable var_prebindings
result_exception
protected java.lang.RuntimeException result_exception
jAPIQueryThread
public jAPIQueryThread(jPrologServices ps,
java.lang.String qin)
jAPIQueryThread
public jAPIQueryThread(jPrologServices ps,
java.util.Hashtable bindings,
java.lang.String qin)
setListeners
public void setListeners(jPrologServiceBroadcaster b,
jPrologServiceBroadcaster r,
jPrologServiceBroadcaster e,
jPrologServiceBroadcaster s,
jPrologServiceBroadcaster d)
retry
public void retry()
- Specified by:
retry
in class jRetryQueryThread
waitForRetry
protected boolean waitForRetry()
run
public void run()
- Specified by:
run
in interface java.lang.Runnable
- Overrides:
run
in class java.lang.Thread
query
protected void query()
internal_prove
protected void internal_prove()
internal_retry
protected void internal_retry()
getResultHashtable
public java.util.Hashtable getResultHashtable()
- Returns a hashtable of the variable bindings, as a result of a sucessful query / retry.
- Returns:
- Returns a hashtable with all the variables in the query, and their bindings.
Each key in the hashtable is a variable name, and the associated value
is the
jTerm
the variable was bound to.
Returns null if the query failed.
getResultException
public java.lang.RuntimeException getResultException()
- Returns the RuntimeException thrown by an unsucessful query / retry
(e.g., UnknownPredicateException).
- Returns:
- Returns a RuntimeException if the query failed.
Returns null if the query did not throw an exception.