|
|||||||||
Home >> All >> alice >> [ tuprolog overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |
alice.tuprolog
Class PrologVM

java.lang.Objectalice.tuprolog.PrologVM
- All Implemented Interfaces:
- java.io.Serializable
- public class PrologVM
- extends java.lang.Object
- implements java.io.Serializable
- extends java.lang.Object
the tuprolog virtual machine.
it has Toschi's microProlog core as inference core
Field Summary | |
static java.lang.String[][][] |
BUILTIN
some of the core builtin predicates arranged as matrix for fast recognition during identifying process |
static int |
CONT
ask for continuing eval cycle |
private RTContext |
currentContext
runtime context of the demo |
private Term |
currentGoal
current goal to be evaluated |
(package private) java.util.Vector |
currentLibraries
dynamically loaded built-in libraries |
private alice.util.LinkedList |
currentVars
vars present in current goal |
private int |
evalFlag
eval result (FALSE,TRUE,TRUE_CP,...) |
(package private) java.util.HashMap |
extFunctors
builtin evaluable functors currently defined by libraries |
(package private) java.util.HashMap |
extPredicates
builtin predicates currently defined by libraries |
static int |
FALSE
false goal |
static int |
HALT
the demo process must halt |
private int |
haltCode
in the case of HALT flag |
static int |
INIT
eval just started |
private boolean |
mustStop
the process demo must stop? |
(package private) OperatorManager |
opManager
manager of operators |
(package private) java.util.Vector |
outputListeners
listeners registrated for virtual machine output events |
(package private) boolean |
spy
spying state? |
(package private) java.util.Vector |
spyListeners
listeners registrated for virtual machine internal events |
(package private) java.util.Vector |
stateListeners
listeners registrated for virtual machine state change events |
private TheoryManager |
theoryManager
manager of current theory |
static int |
TRUE
true goal |
static int |
TRUE_CP
true goal with open alternatives |
Constructor Summary | |
PrologVM()
default creation (default libraries are loaded). |
|
PrologVM(java.lang.String[] libs)
creation specifying what libraries to load immediately. |
Method Summary | |
void |
addOutputListener(OutputListener l)
|
void |
addSpyListener(SpyListener l)
|
void |
addStateListener(StateListener l)
|
void |
addTheory(Struct list)
adds new theory providing a clauses list |
void |
addTheory(Theory th)
adds new theory |
private int |
backTracking()
|
private int |
backTracking(RTContext e)
|
protected int |
builtin(RTContext e)
|
void |
clearTheory()
clears dynamic theory |
private int |
eval()
|
int |
eval(RTContext e)
|
static Term |
evalAsNumber(Term term)
Term evaluation as numeric expression |
RTContext |
getContext()
|
java.util.ArrayList |
getDynamicClauses()
gets current dynamic theory as clauses list |
Library |
getLibrary(java.lang.String name)
gets a loaded library |
OperatorManager |
getOperatorManager()
|
Theory |
getTheory()
gets current (dynamic) theory |
static Term |
identify(Term term,
java.util.HashMap predLibs,
java.util.HashMap funLibs)
identifies the term passed as argument. |
void |
info(java.lang.String m)
|
void |
init(RTContext e,
Term g,
int l,
int t,
int m)
|
private boolean |
isLibraryFunctor(java.lang.String name,
int nArgs)
checks if a evaluable functor is a registered built-in |
private boolean |
isLibraryPredicate(java.lang.String name,
int nArgs)
checks if a predicate is a registered built-in |
boolean |
isSpy()
|
Library |
loadLibrary(java.lang.String name)
loads a library providing the name of its class |
void |
notifyOutput(OutputEvent e)
|
protected void |
notifySpy(SpyEvent e)
|
protected void |
notifyState(StateEvent e)
|
void |
removeOutputListener(OutputListener l)
|
void |
removeSpyListener(SpyListener l)
|
void |
removeStateListener(StateListener l)
|
void |
setSpy(boolean state)
|
void |
setTheory(Struct list)
sets new theory providing a clauses list |
void |
setTheory(Theory th)
sets new theory |
SolveInfo |
solve(java.lang.String st)
finds first solution of a goal |
SolveInfo |
solve(Term g)
finds first solution of a goal |
void |
solveEnd()
ends solving process |
void |
solveHalt()
halts solving process |
SolveInfo |
solveNext()
finds next solution |
void |
spy(int i,
java.lang.String s,
Term g)
|
void |
spy(java.lang.String s)
|
void |
stdOutput(java.lang.String m)
|
private int |
stepB(RTContext e)
backtracking |
private int |
stepE(RTContext e)
|
Term |
toTerm(java.lang.String st)
|
void |
unloadLibrary(java.lang.String name)
unloads previously loaded library |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
INIT
public static final int INIT
- eval just started
- See Also:
- Constant Field Values
FALSE
public static final int FALSE
- false goal
- See Also:
- Constant Field Values
CONT
public static final int CONT
- ask for continuing eval cycle
- See Also:
- Constant Field Values
TRUE
public static final int TRUE
- true goal
- See Also:
- Constant Field Values
TRUE_CP
public static final int TRUE_CP
- true goal with open alternatives
- See Also:
- Constant Field Values
HALT
public static final int HALT
- the demo process must halt
- See Also:
- Constant Field Values
currentContext
private RTContext currentContext
- runtime context of the demo
mustStop
private boolean mustStop
- the process demo must stop?
theoryManager
private TheoryManager theoryManager
- manager of current theory
currentGoal
private Term currentGoal
- current goal to be evaluated
currentVars
private alice.util.LinkedList currentVars
- vars present in current goal
evalFlag
private int evalFlag
- eval result (FALSE,TRUE,TRUE_CP,...)
haltCode
private int haltCode
- in the case of HALT flag
opManager
OperatorManager opManager
- manager of operators
currentLibraries
java.util.Vector currentLibraries
- dynamically loaded built-in libraries
extPredicates
java.util.HashMap extPredicates
- builtin predicates currently defined by libraries
extFunctors
java.util.HashMap extFunctors
- builtin evaluable functors currently defined by libraries
outputListeners
java.util.Vector outputListeners
- listeners registrated for virtual machine output events
spyListeners
java.util.Vector spyListeners
- listeners registrated for virtual machine internal events
stateListeners
java.util.Vector stateListeners
- listeners registrated for virtual machine state change events
spy
boolean spy
- spying state?
BUILTIN
public static final java.lang.String[][][] BUILTIN
- some of the core builtin predicates
arranged as matrix for fast recognition
during identifying process
Constructor Detail |
PrologVM
public PrologVM()
- default creation
(default libraries are loaded).
PrologVM
public PrologVM(java.lang.String[] libs) throws InvalidLibraryException
- creation specifying what libraries to load immediately.
Method Detail |
setTheory
public void setTheory(Theory th) throws InvalidTheoryException
- sets new theory
addTheory
public void addTheory(Theory th) throws InvalidTheoryException
- adds new theory
getTheory
public Theory getTheory()
- gets current (dynamic) theory
getDynamicClauses
public java.util.ArrayList getDynamicClauses()
- gets current dynamic theory as clauses list
clearTheory
public void clearTheory()
- clears dynamic theory
setTheory
public void setTheory(Struct list) throws InvalidTheoryException
- sets new theory providing a clauses list
addTheory
public void addTheory(Struct list) throws InvalidTheoryException
- adds new theory providing a clauses list
loadLibrary
public Library loadLibrary(java.lang.String name) throws InvalidLibraryException
- loads a library providing the name of its class
it ignores the request if the library is already loaded
unloadLibrary
public void unloadLibrary(java.lang.String name) throws InvalidLibraryException
- unloads previously loaded library
getLibrary
public Library getLibrary(java.lang.String name)
- gets a loaded library
isLibraryPredicate
private boolean isLibraryPredicate(java.lang.String name, int nArgs)
- checks if a predicate is a registered built-in
isLibraryFunctor
private boolean isLibraryFunctor(java.lang.String name, int nArgs)
- checks if a evaluable functor is a registered built-in
solve
public SolveInfo solve(Term g)
- finds first solution of a goal
solve
public SolveInfo solve(java.lang.String st) throws MalformedGoalException
- finds first solution of a goal
solveNext
public SolveInfo solveNext() throws NoMoreSolutionException
- finds next solution
solveHalt
public void solveHalt()
- halts solving process
solveEnd
public void solveEnd()
- ends solving process
toTerm
public Term toTerm(java.lang.String st)
setSpy
public void setSpy(boolean state)
isSpy
public boolean isSpy()
spy
public void spy(int i, java.lang.String s, Term g)
spy
public void spy(java.lang.String s)
info
public void info(java.lang.String m)
stdOutput
public void stdOutput(java.lang.String m)
addOutputListener
public void addOutputListener(OutputListener l)
addSpyListener
public void addSpyListener(SpyListener l)
addStateListener
public void addStateListener(StateListener l)
removeOutputListener
public void removeOutputListener(OutputListener l)
removeSpyListener
public void removeSpyListener(SpyListener l)
removeStateListener
public void removeStateListener(StateListener l)
notifyOutput
public void notifyOutput(OutputEvent e)
notifySpy
protected void notifySpy(SpyEvent e)
notifyState
protected void notifyState(StateEvent e)
eval
private int eval()
backTracking
private int backTracking()
init
public void init(RTContext e, Term g, int l, int t, int m)
stepE
private int stepE(RTContext e)
stepB
private int stepB(RTContext e)
- backtracking
eval
public int eval(RTContext e)
backTracking
private int backTracking(RTContext e)
builtin
protected int builtin(RTContext e)
evalAsNumber
public static Term evalAsNumber(Term term)
- Term evaluation as numeric expression
identify
public static Term identify(Term term, java.util.HashMap predLibs, java.util.HashMap funLibs)
- identifies the term passed as argument.
code is -1 for generic term, otherwise is a core builtin predicate
getContext
public RTContext getContext()
getOperatorManager
public OperatorManager getOperatorManager()
|
|||||||||
Home >> All >> alice >> [ tuprolog overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |