|
||||||||||
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 |
protected Library |
getLibraryFunctor(java.lang.String name,
int nArgs)
|
java.util.List |
getLibraryListenerList()
Gets a copy of current listener list to library events |
protected Library |
getLibraryPredicate(java.lang.String name,
int nArgs)
|
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 |
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. |
void |
identifyFunctor(Term term)
Identify functors |
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. |
boolean |
match(Term t0,
Term t1)
Unifies two terms using current demonstration context. |
protected void |
notifyChangedTheory(TheoryEvent e)
Notifies a new theory set or updated event |
protected void |
notifyLoadedLibrary(LibraryEvent e)
Notifies a library loaded event |
protected void |
notifyNewQueryResultAvailable(QueryEvent e)
Notifies a library loaded event |
protected void |
notifyOutput(OutputEvent e)
Notifies an ouput information event |
protected void |
notifySpy(SpyEvent e)
Notifies a spy information event |
protected void |
notifyUnloadedLibrary(LibraryEvent e)
Notifies a library unloaded event |
protected void |
notifyWarning(WarningEvent e)
Notifies a warning information event |
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 |
protected void |
spy(java.lang.String s)
Notifies a spy information event |
protected void |
spy(java.lang.String s,
Engine e)
Notifies a spy information event |
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 |
clone, equals, finalize, 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 loadedMethod 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 validTheory
public 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 librarypublic 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 name of the library already loaded
protected Library getLibraryPredicate(java.lang.String name, int nArgs)
protected Library getLibraryFunctor(java.lang.String name, int nArgs)
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
MalformedGoalException
SolveInfo
public SolveInfo solveNext() throws NoMoreSolutionException
NoMoreSolutionException
- if no more solutions are presentSolveInfo
public void solveHalt()
public void solveEnd()
public boolean hasOpenAlternatives()
public boolean isHalted()
public boolean match(Term t0, Term t1)
t0
- first term to be unifiedt1
- second term to be unified
public boolean unify(Term t0, Term t1)
t0
- first term to be unifiedt1
- second term to be unified
public void identifyFunctor(Term term)
term
- term to identifypublic 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()
protected void spy(java.lang.String s)
protected void spy(java.lang.String s, Engine e)
s
- TODOpublic 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()
protected void notifyOutput(OutputEvent e)
e
- the eventprotected void notifySpy(SpyEvent e)
e
- the eventprotected void notifyWarning(WarningEvent e)
e
- the eventprotected void notifyChangedTheory(TheoryEvent e)
e
- the eventprotected void notifyLoadedLibrary(LibraryEvent e)
e
- the eventprotected void notifyUnloadedLibrary(LibraryEvent e)
e
- the eventprotected void notifyNewQueryResultAvailable(QueryEvent e)
e
- the event
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |