All Packages Class Hierarchy This Package Previous Next Index
Class prolog.Database
java.lang.Object
|
+----prolog.Database
- public class Database
- extends Object
- implements Cloneable, Serializable
The Prolog database.
Hash of the functors of the heads + "/" + the arity of the head.
The database is scanned for a user definition of a predicate with the
given functor and arity. If this fails, an attempt is made to load an
external class with the same characteristics.
-
asyncCompiler
- Should the compiler run in a separate thread, or should we wait for
it to compile something?
-
compilerQueue
- The queue of predicates to compile.
-
jit
- Are we just-in-time compiling clauses?
-
Database(boolean)
- Creates an empty database.
-
Database(boolean, int)
- Creates a database with given initial size.
-
clone()
- Clones this database.
-
get(Compound)
- Finds a potential unifer for a given Term.
-
get(String, int)
-
Finds a Predicate record with the given functor and arity.
-
load(String, int)
- Loads an external class file which should subclass
prolog.CompiledPredicate and have a constructor with no
parameters.
-
newPredicate(int)
- Create a new InterpretedPredicate record.
-
put(Clause)
- Inserts a a clause into the database.
-
put(String, int, Predicate)
- Inserts a predicate into the database.
-
toString()
- Lists all clauses in the database.
jit
public boolean jit
- Are we just-in-time compiling clauses?
compilerQueue
public Queue compilerQueue
- The queue of predicates to compile. Contains
PredicateCodeGen objects.
asyncCompiler
public static final boolean asyncCompiler
- Should the compiler run in a separate thread, or should we wait for
it to compile something?
Database
public Database(boolean jit)
- Creates an empty database.
Database
public Database(boolean jit,
int dbsize)
- Creates a database with given initial size.
get
public Predicate get(Compound c)
- Finds a potential unifer for a given Term.
get
public Predicate get(String f,
int a)
- Finds a Predicate record with the given functor and arity. If
there isn't one in the database, attempt to load a pre-compiled one
from prolog.lib.
- Parameters:
- f - functor
- a - arity
load
Predicate load(String f,
int a)
- Loads an external class file which should subclass
prolog.CompiledPredicate and have a constructor with no
parameters.
- See Also:
- CompiledPredicate
put
public void put(String f,
int a,
Predicate p)
- Inserts a predicate into the database.
put
public void put(Clause c)
- Inserts a a clause into the database. This interface should be used
to set up the database (when it is immaterial whether a predicate is
dynamic or not) and not for assert/1, retract/1,
etc.
- Parameters:
- c - the clause to be inserted.
- See Also:
- asserta_1, assertz_1, abolish_1, retract_1
clone
public Object clone()
- Clones this database. This is a deep copy. Note the implementation
uses the serialize/deserialize approach (i.e. it's inefficient) as
cloning the graph directly is tricky and efficiency isn't really a
priority for this op.
Reference: Java Tip 76: An alternative to the deep copy technique.
- Overrides:
- clone in class Object
toString
public String toString()
- Lists all clauses in the database.
- Overrides:
- toString in class Object
newPredicate
InterpretedPredicate newPredicate(int arity)
- Create a new InterpretedPredicate record.
All Packages Class Hierarchy This Package Previous Next Index