|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectalice.tuprolog.Prolog
The Prolog class represents a tuProlog engine.
| Constructor Summary | |
Prolog()
Builds a prolog engine with default libraries loaded. |
|
Prolog(java.lang.String[] libs)
Builds a tuProlog engine with loaded the specified libraries |
|
| Method Summary | |
void |
addLibraryListener(LibraryListener l)
Adds a listener to library events |
void |
addOutputListener(OutputListener l)
Adds a listener to ouput events |
void |
addQueryListener(QueryListener l)
Adds a listener to theory events |
void |
addSpyListener(SpyListener l)
Adds a listener to spy events |
void |
addTheory(Theory th)
Adds (appends) a theory |
void |
addTheoryListener(TheoryListener l)
Adds a listener to theory events |
void |
addWarningListener(WarningListener l)
Adds a listener to warning events |
void |
clearTheory()
Clears current theory |
java.lang.String[] |
getCurrentLibraries()
Gets the list of current libraries loaded |
java.util.List |
getCurrentOperatorList()
Gets the list of the operators currently defined |
Theory |
getLastConsultedTheory()
Gets last consulted theory, with the original textual format |
Library |
getLibrary(java.lang.String name)
Gets the reference to a loaded library |
java.util.List |
getLibraryListenerList()
Gets a copy of current listener list to library events |
java.util.List |
getOutputListenerList()
Gets a copy of current listener list to output events |
java.util.List |
getQueryListenerList()
Gets a copy of current listener list to query events |
Term |
getRenamedCopy(Term t0)
Gets a copy of a term with variables renamed, using current demostration context. |
java.util.List |
getSpyListenerList()
Gets a copy of current listener list to spy events |
Theory |
getTheory()
Gets current theory |
java.util.List |
getTheoryListenerList()
Gets a copy of current listener list to theory events |
static java.lang.String |
getVersion()
Gets the current version of the tuProlog system |
java.util.List |
getWarningListenerList()
Gets a copy of current listener list to warning events |
boolean |
hasOpenAlternatives()
Asks for the presence of open alternatives to be explored in current demostration process. |
boolean |
isHalted()
Checks if the demonstration process was stopped by an halt command. |
boolean |
isSpy()
Checks the spy state of the engine |
boolean |
isWarning()
Checks if warning information are notified |
void |
loadLibrary(Library lib)
Loads a specific instance of a library If a library with the same name is already present, a warning event is notified |
Library |
loadLibrary(java.lang.String className)
Loads a library. |
void |
removeAllOutputListeners()
Removes all output event listeners |
void |
removeAllSpyListeners()
Removes all spy event listeners |
void |
removeAllWarningListeners()
Removes all warning event listeners |
void |
removeLibraryListener(LibraryListener l)
Removes a listener to library events |
void |
removeOutputListener(OutputListener l)
Removes a listener to ouput events |
void |
removeQueryListener(QueryListener l)
Removes a listener to query events |
void |
removeSpyListener(SpyListener l)
Removes a listener to spy events |
void |
removeTheoryListener(TheoryListener l)
Removes a listener to theory events |
void |
removeWarningListener(WarningListener l)
Removes a listener to warning events |
void |
setSpy(boolean state)
Switches on/off the notification of spy information events |
void |
setTheory(Theory th)
Sets a new theory |
void |
setWarning(boolean state)
Switches on/off the notification of warning information events |
SolveInfo |
solve(java.lang.String st)
Solves a query |
SolveInfo |
solve(Term g)
Solves a query |
void |
solveEnd()
Accepts current solution |
void |
solveHalt()
Halts current solve computation |
SolveInfo |
solveNext()
Gets next solution |
void |
stdOutput(java.lang.String m)
Produces an output information event |
java.lang.String |
toString(Term term)
Gets the string representation of a term, using operators currently defined by engine |
Term |
toTerm(java.lang.String st)
Gets a term from a string, using the operators currently defined by the engine |
boolean |
unify(Term t0,
Term t1)
Unifies two terms using current demonstration context. |
void |
unloadLibrary(java.lang.String name)
Unloads a previously loaded library |
void |
warn(java.lang.String m)
Notifies a warn information event |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Prolog()
public Prolog(java.lang.String[] libs)
throws InvalidLibraryException
libs - the (class) name of the libraries to be loaded| Method Detail |
public static java.lang.String getVersion()
public void setTheory(Theory th)
throws InvalidTheoryException
th - is the new theory
InvalidTheoryException - if the new theory is not validTheory
public void addTheory(Theory th)
throws InvalidTheoryException
th - is the theory to be added
InvalidTheoryException - if the new theory is not validTheorypublic Theory getTheory()
public Theory getLastConsultedTheory()
public void clearTheory()
public Library loadLibrary(java.lang.String className)
throws InvalidLibraryException
className - name of the Java class containing the library to be loaded
InvalidLibraryException - if name is not a valid library
public void loadLibrary(Library lib)
throws InvalidLibraryException
lib - the (Java class) name of the library to be loaded
InvalidLibraryException - if name is not a valid librarypublic java.lang.String[] getCurrentLibraries()
public void unloadLibrary(java.lang.String name)
throws InvalidLibraryException
name - of the library to be unloaded
InvalidLibraryException - if name is not a valid loaded librarypublic Library getLibrary(java.lang.String name)
name - the (Java class) name of the library already loaded
public java.util.List getCurrentOperatorList()
public SolveInfo solve(Term g)
g - the term representing the goal to be demonstrated
SolveInfo
public SolveInfo solve(java.lang.String st)
throws MalformedGoalException
st - the string representing the goal to be demonstrated
MalformedGoalExceptionSolveInfopublic boolean hasOpenAlternatives()
public boolean isHalted()
public SolveInfo solveNext()
throws NoMoreSolutionException
NoMoreSolutionException - if no more solutions are presentSolveInfopublic void solveHalt()
public void solveEnd()
public boolean unify(Term t0,
Term t1)
t0 - first term to be unifiedt1 - second term to be unified
public Term getRenamedCopy(Term t0)
t0 - the term to be copied and renamed
public Term toTerm(java.lang.String st)
throws InvalidTermException
st - the string representing a term
InvalidTermException - if the string does not represent a valid termpublic java.lang.String toString(Term term)
term - the term to be represented as a string
public void setSpy(boolean state)
state - - true for enabling the notification of spy eventpublic boolean isSpy()
public void setWarning(boolean state)
state - - true for enabling warning information notificationpublic boolean isWarning()
public void warn(java.lang.String m)
m - the warning messagepublic void stdOutput(java.lang.String m)
m - the output stringpublic void addOutputListener(OutputListener l)
l - the listenerpublic void addTheoryListener(TheoryListener l)
l - the listenerpublic void addLibraryListener(LibraryListener l)
l - the listenerpublic void addQueryListener(QueryListener l)
l - the listenerpublic void addSpyListener(SpyListener l)
l - the listenerpublic void addWarningListener(WarningListener l)
l - the listenerpublic void removeOutputListener(OutputListener l)
l - the listenerpublic void removeAllOutputListeners()
public void removeTheoryListener(TheoryListener l)
l - the listenerpublic void removeLibraryListener(LibraryListener l)
l - the listenerpublic void removeQueryListener(QueryListener l)
l - the listenerpublic void removeSpyListener(SpyListener l)
l - the listenerpublic void removeAllSpyListeners()
public void removeWarningListener(WarningListener l)
l - the listenerpublic void removeAllWarningListeners()
public java.util.List getOutputListenerList()
public java.util.List getWarningListenerList()
public java.util.List getSpyListenerList()
public java.util.List getTheoryListenerList()
public java.util.List getLibraryListenerList()
public java.util.List getQueryListenerList()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||