|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectprologj.PrologJ
Top-level of the PrologJ java API This class supports static methods for performing various operations on prolog entities from within Java programs.
| Constructor Summary | |
PrologJ()
|
|
| Method Summary | |
static void |
asserta(PrologBoundTerm term)
Assert a term encapsulated in a bound term object at the front of the database |
static void |
asserta(java.lang.String term)
Assert a term represented by a string at the front of the database |
static void |
assertz(PrologBoundTerm term)
Assert a term encapsulated in a bound term object at the back of the database |
static void |
assertz(java.lang.String term)
Assert a term represented by a string at the back of the database |
static boolean |
call(PrologBoundTerm goal)
Attempt to satisfy a goal encapsulated in a bound term object once, and report only success or failure |
static boolean |
call(PrologBoundTerm goal,
PrologContinuation continuation)
Attempt to satisfy a goal encapsulated in a bound term object, with access to the bindings of the variables and the possibility of redoing it if it succeeds. |
static boolean |
call(java.lang.String term)
Attempt to satisfy a goal represented by a string once, and report only success or failure |
static boolean |
call(java.lang.String term,
PrologContinuation continuation)
Attempt to satisfy a goal represented by a string, with access to the bindings of the variables and the possibility of redoing it if it succeeds. |
static void |
consult(java.io.BufferedReader bufferedReader,
boolean throwImmediately)
Treat a stream represented by a BufferedReader as a sequence of clauses to be asserted into the database |
static void |
ensure_loaded()
This method is called from compiled code to ensure that this class is loaded (and therefore the system is initialized). |
static boolean |
interpret(java.io.BufferedReader bufferedReader,
boolean failImmediately,
boolean throwImmediately)
Treat a stream represented by a BufferedReader as a sequence of goals to be called. |
static void |
listing(java.io.PrintWriter printWriter)
List out the clauses of predicates of any arity for all Prolog predicates (with source code available) currently in the database, quietly skipping over private ones. |
static void |
listing(java.io.PrintWriter printWriter,
boolean ignorePrivate)
List out the clauses of predicates of any arity for all Prolog predicates (with source code available) currently in the database. |
static void |
listing(java.io.PrintWriter printWriter,
java.lang.String name,
boolean ignorePrivate)
List out the clauses of Prolog predicates of any arity for a given atom (with source code available), in a form suitable for reading by consult() |
static void |
listing(java.io.PrintWriter printWriter,
java.lang.String name,
int arity,
boolean ignorePrivate)
List out the clauses for a given Prolog predicate or predicates (with source code available) in a form suitable for reading by consult(). |
static void |
main(java.lang.String[] args)
Main method when run as an application. |
static PrologBoundTerm |
makeBoundTerm(java.lang.String text)
Create a bound term object that encapsulates a term, given its textual representation |
static void |
reconsult(java.io.BufferedReader bufferedReader,
boolean throwImmediately)
Treat a stream represented by a BufferedReader as a sequence of clauses to be asserted into the database, replacing any definitions for the referenced predicates that are already there |
static boolean |
retract(PrologBoundTerm term)
Attempt to retract one instance of a term encapsulated in a bound term object from the database, and report only success or failure. |
static boolean |
retract(PrologBoundTerm term,
PrologContinuation continuation)
Attempt to retract a term encapsulated in a bound term object from the database, with access to the variable bindings for the term retracted, and the possibility of redoing to retract another matching term. |
static boolean |
retract(java.lang.String term)
Attempt to retract one instance of a term represented by a string from the database, and report only success or failure. |
static boolean |
retract(java.lang.String term,
PrologContinuation continuation)
Attempt to retract a term represented by a string from the database, with access to the variable bindings for the term retracted, and the possibility of redoing to retract another matching term. |
static void |
retractall(PrologBoundTerm term)
Retract all instances of a term encapsulated in a bound term object from the database |
static void |
retractall(java.lang.String term)
Retract all instances of a term represented by a string from the database |
static void |
set_input(java.io.BufferedReader bufferedReader)
Cause a BufferedReader to be used as default input for subsequent operations |
static void |
set_output(java.io.PrintWriter printWriter)
Cause a PrintWriter to be used as default output for subsequent operations |
static void |
setBuiltinPredicateCategories(java.lang.String categories)
Set the category(s) of built-in predicates that are available |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public PrologJ()
| Method Detail |
public static void asserta(PrologBoundTerm term)
throws PrologException
term - a bound term object that is a callable term
PrologException - if this term does not have the proper form
to be asserted into the database, or represents a non-modifiable
predicate
public static void asserta(java.lang.String term)
throws PrologException
term - the textual representation of the term to be asserted
PrologException - if this term does not have the proper form
to be asserted into the database, or represents a non-modifiable
predicate
public static void assertz(PrologBoundTerm term)
throws PrologException
term - a bound term object that is a callable term
PrologException - if this term does not have the proper form
to be asserted into the database, or represents a non-modifiable
predicate
public static void assertz(java.lang.String term)
throws PrologException
term - the textual representation of the term to be asserted
PrologException - if this term does not have the proper form
to be asserted into the database, or represents a non-modifiable
predicate
public static boolean call(PrologBoundTerm goal,
PrologContinuation continuation)
throws PrologException
goal - a bound term object that is a callable termcontinuation - an object whose succeed() method is called if
the goal succeeds.
PrologException - if this term does not have the proper form
to be called as a goal, or if execution of the goal or the
continuation results in an error.
public static boolean call(java.lang.String term,
PrologContinuation continuation)
throws PrologException
term - the textual representation of the goal to be calledcontinuation - an object whose succeed() method is called if
the goal succeeds
PrologException - if this term does not have the proper form
to be called as a goal, or if execution of the goal or the
continuation results in an error.
public static boolean call(PrologBoundTerm goal)
throws PrologException
goal - an object that is a callable term
PrologException - if this term does not have the proper form
to be called as a goal, or if execution of the goal results in an
error.
public static boolean call(java.lang.String term)
throws PrologException
term - the textual representation of the goal to be called
PrologException - if this term does not have the proper form
to be called as a goal, or if execution of the goal results in an
error.
public static boolean retract(PrologBoundTerm term,
PrologContinuation continuation)
throws PrologException
term - a bound term object that is a callable termcontinuation - an object whose succeed() method is called if
the goal succeeds.
PrologException - if this term does not have the proper form
for a clause in the database, or belongs to a non-modifiable
predicate, or execution of the continuation resulted in an error.
public static boolean retract(java.lang.String term,
PrologContinuation continuation)
throws PrologException
term - the textual representation of the term to be retractedcontinuation - an object whose succeed() method is called if
the goal succeeds.
PrologException - if this term does not have the proper form
for a clause in the database, or belongs to a non-modifiable
predicate, or execution of the continuation resulted in an error.
public static boolean retract(PrologBoundTerm term)
throws PrologException
term - a bound term object that is a callable term
PrologException - if this term does not have the proper form
for a clause in the database, or belongs to a non-modifiable
predicate
public static boolean retract(java.lang.String term)
throws PrologException
term - the textual representation of the term to be retracted
PrologException - if this term does not have the proper form
for a clause in the database, or belongs to a non-modifiable
predicate
public static void retractall(PrologBoundTerm term)
throws PrologException
term - a bound term object that is a callable term
PrologException - if this term does not have the proper form
for a clause in the database, or belongs to a non-modifiable
predicate
public static void retractall(java.lang.String term)
throws PrologException
term - the textual representation of the term to be retracted
PrologException - if this term does not have the proper form
for a clause in the database, or belongs to a non-modifiable
predicate
public static PrologBoundTerm makeBoundTerm(java.lang.String text)
throws PrologException
text - the textual representation of the term
PrologException - if term is not a syntactically-
correct representation of a Prolog term
public static void consult(java.io.BufferedReader bufferedReader,
boolean throwImmediately)
throws PrologException
bufferedReader - the source to read clauses fromthrowImmediately - true if any exception arising from the
processing of a clause should be thrown immediately. If
this parameter is false, such errors are reported to user_error
and processing continues.
PrologException - if throwImmediately is true and there is any
problem (including a syntax error) processing a clause or directive
in the stream; or if there is a non-catchable error in any case.
public static void reconsult(java.io.BufferedReader bufferedReader,
boolean throwImmediately)
throws PrologException
bufferedReader - the source to read clauses fromthrowImmediately - true if any exception arising from the
processing of a clause should be thrown immediately. If
this parameter is false, such errors are reported to user_error
and processing continues.
PrologException - if throwImmediately is true and there is any
problem (including a syntax error) processing a clause or directive
in the stream; or if there is a non-catchable error in any case.
public static boolean interpret(java.io.BufferedReader bufferedReader,
boolean failImmediately,
boolean throwImmediately)
throws PrologException
bufferedReader - the source to read goals fromfailImmediately - if this parameter is true, then the failure
of any goal read from the stream causes this method to fail
immediately; if false, reading and executing of goals continues
until the end of the stream is reached even if one or more fail.throwImmediately - true if any exception arising from the
processing of a clause should be thrown immediately. If
this parameter is false, such errors are reported to user
error and processing continues.
PrologException - if throwImmediately is true and there is any
problem (including a syntax error) processing a goal or directive
in the stream; or if there is a non-catchable error in any case.
public static void listing(java.io.PrintWriter printWriter,
java.lang.String name,
int arity,
boolean ignorePrivate)
throws PrologException
printWriter - the sink to write the listing toname - the name of the predicate. This parameter can be null,
in which case all user-defined predicates are listed, and
arity is ignored.arity - the arity of the predicate. This parameter can be
-1, which causes all predicates for this atom to be writtenignorePrivate - true if the predicate is to be ignored if it is
private - nothing is written for it in this case.
PrologException - if there is an IOException writing the sink
public static void listing(java.io.PrintWriter printWriter,
java.lang.String name,
boolean ignorePrivate)
throws PrologException
printWriter - the sink to write the listing toname - the name of the predicate. This parameter can be null,
in which case all user-defined predicates are listedignorePrivate - true if private predicates are to be ignored -
nothing is written for them in this case.
PrologException - if there is an IOException writing the sink
public static void listing(java.io.PrintWriter printWriter,
boolean ignorePrivate)
throws PrologException
printWriter - the sink to write the listing toignorePrivate - true if private predicates are to be ignored -
nothing is written for them in this case.
PrologException - if there is an IOException writing the sink
public static void listing(java.io.PrintWriter printWriter)
throws PrologException
printWriter - the sink to write the listing to
PrologException - if there is an IOException writing the sinkpublic static void set_input(java.io.BufferedReader bufferedReader)
bufferedReader - the BufferedReader to use as default input.
This parameter can be null, in which case the system reverts
to using the standard user_input stream.
Because the PrologJ system does line buffering internally, the program
should not access this stream - or any stream it is filtering - directly
while it is in use as standard input for Prolog.public static void set_output(java.io.PrintWriter printWriter)
printWriter - the PrintWriter to use as default output. This
parameter can be null, in which case the system reverts to
using the standard user_output stream.
public static void setBuiltinPredicateCategories(java.lang.String categories)
throws java.lang.IllegalArgumentException
categories - a string consisting of the
one letter codes for
predicate categories to be made available
java.lang.IllegalArgumentException - if categories contains an
invalid codepublic static void main(java.lang.String[] args)
public static void ensure_loaded()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||