public class Prolog extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static Prolog |
defaultMachine |
static int |
FX |
static int |
FY |
static int |
OP_HIGH |
static int |
OP_LOW |
static String |
VERSION |
static int |
XF |
static int |
XFX |
static int |
XFY |
static int |
YF |
static int |
YFX |
Constructor and Description |
---|
Prolog()
Builds a prolog engine with default libraries: BasicLibrary, ISOLibrary,
IOLibrary
|
Prolog(String extraLib)
Builds a prolog engine with default libraries: BasicLibrary, ISOLibrary,
IOLibrary + the extraLib
|
Prolog(String[] libNames)
Builds a prolog engine using _only_ the specified libraries as parameters
|
Modifier and Type | Method and Description |
---|---|
void |
abolish(String predicateIndicator) |
void |
addTheory(String theory) |
void |
assertA(Clause toBeAsserted) |
void |
assertZ(Clause toBeAsserted)
The Rule and Fact Database System The Library System
|
void |
clearTheory()
removes all dynamic predicates
|
void |
defineFlag(String name,
Struct valueList,
Term defValue,
boolean modifiable) |
Iterator |
dynamicPredicateIndicators() |
static boolean |
evalPrimitive(jTrolog.engine.PrimitiveInfo prim,
Object[] primitive_args) |
List |
find(String predIndicator) |
List |
getAndResetWarnings() |
Iterator |
getCurrentLibraries() |
Iterator |
getCurrentOperators()
Gets the list of the operators currently defined
|
Flag |
getFlag(String name) |
Term |
getFlagValue(String name) |
String |
getLastConsultedTheory() |
Library |
getLibrary(String name) |
int |
getOperatorPriority(String name,
int type) |
PrintStream |
getPrintStream() |
Term |
getPrologFlagList() |
String |
getTheory() |
boolean |
hasOpenAlternatives()
Asks for the presence of open alternatives to be explored in current
demostration process.
|
boolean |
hasPrimitive(String predicateIndiciator) |
boolean |
hasPrimitiveExp(String predicateIndiciator) |
Library |
loadLibrary(Library lib)
Loads a specific instance of a library If a library of the same class is
already present, a warning event is notified.
|
Library |
loadLibrary(String className)
Loads a library.
|
static void |
main(String[] args)
Starts a command line interface with jTrolog Prolog engine.
|
static boolean |
match(Term t0,
Term t1)
Matches the structure of the two original terms.
|
void |
onSolveBegin(Term g) |
void |
onSolveEnd() |
void |
opNew(String name,
int type,
int i) |
void |
opNew(String name,
String type,
int i) |
void |
resetWarningList() |
Struct |
retract(Struct sarg0) |
void |
setDynamicPredicateIndicator(String predicateIndicator) |
void |
setPrintStream(PrintStream ps) |
void |
setTheory(String newTheory)
Deprecated.
use clearTheory() + addTheory(newTheory) instead
|
Solution |
solve(String st)
Solves a query
|
Solution |
solve(Struct g)
Solves a query
|
Solution |
solveNext()
Gets next solution
|
void |
unloadLibrary(String name) |
void |
warn(String m) |
public static final String VERSION
public static final int OP_LOW
public static final int OP_HIGH
public static final Prolog defaultMachine
public static final int FX
public static final int FY
public static final int XFX
public static final int XFY
public static final int YFX
public static final int XF
public static final int YF
public Prolog()
public Prolog(String extraLib)
extraLib
- additional library to be loadedpublic Prolog(String[] libNames)
libNames
- the (class) names of the libraries to be loadedpublic static void main(String[] args) throws IOException
IOException
public void assertZ(Clause toBeAsserted) throws PrologException
PrologException
public void assertA(Clause toBeAsserted) throws PrologException
PrologException
public Struct retract(Struct sarg0) throws PrologException
PrologException
public void abolish(String predicateIndicator) throws PrologException
PrologException
public void setDynamicPredicateIndicator(String predicateIndicator) throws PrologException
PrologException
public List find(String predIndicator) throws PrologException
PrologException
public Iterator dynamicPredicateIndicators()
public void setTheory(String newTheory) throws PrologException
newTheory
- to be setPrologException
- if newTheory is not validpublic void clearTheory()
public void addTheory(String theory) throws PrologException
theory
- to be added to the existing set of theories in the database.PrologException
- if the new theory is not validpublic String getTheory()
public String getLastConsultedTheory()
public Library loadLibrary(String className) throws InvalidLibraryException
className
- of the Java class containing the Library to be loadedInvalidLibraryException
- if name is not a valid librarypublic Library loadLibrary(Library lib) throws InvalidLibraryException
lib
- the (Java class) name of the library to be loadedInvalidLibraryException
- if name is not a valid librarypublic void unloadLibrary(String name) throws InvalidLibraryException
name
- of the library to be unloadedInvalidLibraryException
- if no loaded Library has the given namepublic Iterator getCurrentLibraries()
public void setPrintStream(PrintStream ps)
ps
- the engine printstream.public PrintStream getPrintStream()
public Iterator getCurrentOperators()
public int getOperatorPriority(String name, int type)
public void opNew(String name, int type, int i)
public Solution solve(String st) throws Throwable
st
- the string representing the goal to be demonstratedThrowable
SolutionManager
public Solution solve(Struct g) throws Throwable
g
- the term representing the goal to be demonstratedThrowable
SolutionManager
public Solution solveNext() throws Throwable
NoMorePrologSolutions
- if no more solutions are presentThrowable
SolutionManager
public void onSolveBegin(Term g)
public void onSolveEnd()
public boolean hasOpenAlternatives() throws Throwable
Throwable
public static boolean match(Term t0, Term t1)
t0
- first term to be matchedt1
- second term to be matchedpublic boolean hasPrimitive(String predicateIndiciator)
public boolean hasPrimitiveExp(String predicateIndiciator)
public void resetWarningList()
public List getAndResetWarnings()
public void warn(String m)
m
- adds the warning message to the warnings listpublic Term getPrologFlagList()
Copyright © 2020–2024 Prolobjectlink Project. All rights reserved.