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

java.lang.Objectalice.tuprolog.TheoryManager
- All Implemented Interfaces:
- java.io.Serializable
- class TheoryManager
- extends java.lang.Object
- implements java.io.Serializable
- extends java.lang.Object
dbase clauses manager.
the clauses are stored in a Hashtable grouped by functor ( each group is a list that keeps the right clause sequence)
Field Summary | |
protected java.util.HashMap |
clauseDBase
clause dbase |
protected int |
clauseNumber
number of clauses |
int |
consultError_line
error line after consulting error |
int |
consultError_pos
error pos after consulting error |
protected PrologVM |
engine
engine owner of the manager |
private Struct |
startGoal
eventually start goal of a theory |
private alice.util.LinkedList |
transientClauseList
asserted or retracted clause list |
private boolean |
updateTransientClauseList
register dbase changed in transientClauseList? |
Constructor Summary | |
TheoryManager(PrologVM vm)
|
Method Summary | |
void |
addElements(alice.util.LinkedList elements,
boolean dynamicClauses,
java.lang.String libName)
appends a clauses list to the dbase (in the same order of elements) |
void |
assertA(Struct clause,
boolean dyn,
java.lang.String libName)
inserting of a clause at the head of the dbase |
void |
assertZ(Struct clause,
boolean dyn,
java.lang.String libName)
inserting of a clause at the end of the dbase |
void |
clear(boolean onlyDynamic)
empties the dbase. |
boolean |
consult(java.lang.String theoryText,
boolean m,
boolean dynamicTheory,
java.lang.String libName)
consults a theory. |
boolean |
consult(Struct list,
boolean m,
boolean dynamicTheory,
java.lang.String libName)
|
alice.util.LinkedList |
elements()
returns a list of dbase valid clause copies, grouped by functor |
void |
elements(alice.util.LinkedList elements,
boolean dynamicClauses,
java.lang.String libName)
resets dbase, clearing and and filling it with elements |
alice.util.LinkedList |
find(Struct head,
int t,
int m)
finds all the clauses unifying with head and returns a list of renamed (without logic names) clause copies |
java.util.ArrayList |
getDynamicClauseList()
returns a list of dbase valid dynamic clause |
private alice.util.LinkedQueue |
getQueue(java.lang.Object k)
gets elements list related to key k |
Struct |
getStartGoal()
gets the goal eventually defined by last parsed theory. |
void |
optimize()
compacts dbase deleting items invalidated by retract op. |
private boolean |
parseClause(Struct co,
alice.util.LinkedQueue clauses,
boolean dynamicTheory,
java.lang.String libName)
|
void |
rebindBuiltins()
finds all the clauses unifying with head and returns a list of renamed (without logic names) clause copies |
void |
removeLibraryTheory(java.lang.String libName)
remove all the clauses of lib theory |
ClauseInfo |
retract(Struct clause,
int t,
int m)
removing from dbase the first clause with head unifying with clause (m if a free substitution index and t is the first free timestamp) |
boolean |
save(java.io.OutputStream os,
boolean onlyDynamic)
saves the dbase on a output stream. |
void |
transBegin()
starts a transaction on the dbase |
boolean |
transEnd(boolean f)
ends a transaction. |
void |
transOp(ClauseInfo d,
boolean f,
boolean p)
makes a transaction operation on the dbase. |
void |
transRestore(alice.util.LinkedList ol)
rollbacks dbase to a state spcified by the retracted/asserted clauses list |
alice.util.LinkedList |
transStatus()
returns current liste of asserted/retracted clauses |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
transientClauseList
private alice.util.LinkedList transientClauseList
- asserted or retracted clause list
updateTransientClauseList
private boolean updateTransientClauseList
- register dbase changed in transientClauseList?
clauseDBase
protected java.util.HashMap clauseDBase
- clause dbase
clauseNumber
protected int clauseNumber
- number of clauses
engine
protected PrologVM engine
- engine owner of the manager
consultError_line
public int consultError_line
- error line after consulting error
consultError_pos
public int consultError_pos
- error pos after consulting error
startGoal
private Struct startGoal
- eventually start goal of a theory
Constructor Detail |
TheoryManager
public TheoryManager(PrologVM vm)
Method Detail |
getQueue
private alice.util.LinkedQueue getQueue(java.lang.Object k)
- gets elements list related to key k
assertA
public void assertA(Struct clause, boolean dyn, java.lang.String libName)
- inserting of a clause at the head of the dbase
assertZ
public void assertZ(Struct clause, boolean dyn, java.lang.String libName)
- inserting of a clause at the end of the dbase
retract
public ClauseInfo retract(Struct clause, int t, int m)
- removing from dbase the first clause with head unifying with clause
(m if a free substitution index and t is the first free timestamp)
find
public alice.util.LinkedList find(Struct head, int t, int m)
- finds all the clauses unifying with head and returns a list of
renamed (without logic names) clause copies
rebindBuiltins
public void rebindBuiltins()
- finds all the clauses unifying with head and returns a list of
renamed (without logic names) clause copies
elements
public alice.util.LinkedList elements()
- returns a list of dbase valid clause copies, grouped by functor
getDynamicClauseList
public java.util.ArrayList getDynamicClauseList()
- returns a list of dbase valid dynamic clause
elements
public void elements(alice.util.LinkedList elements, boolean dynamicClauses, java.lang.String libName)
- resets dbase, clearing and and filling it with elements
addElements
public void addElements(alice.util.LinkedList elements, boolean dynamicClauses, java.lang.String libName)
- appends a clauses list to the dbase (in the same order
of elements)
clear
public void clear(boolean onlyDynamic)
- empties the dbase.
if onlyDynamic, thenremove only clauses tagged 'dynamic'
removeLibraryTheory
public void removeLibraryTheory(java.lang.String libName)
- remove all the clauses of lib theory
transBegin
public void transBegin()
- starts a transaction on the dbase
transOp
public void transOp(ClauseInfo d, boolean f, boolean p)
- makes a transaction operation on the dbase.
d is the clause specified by the operation; if f is true then insert, else delete clause from dbase; if p is true then head insertion, else queue insertion
transStatus
public alice.util.LinkedList transStatus()
- returns current liste of asserted/retracted clauses
transRestore
public void transRestore(alice.util.LinkedList ol)
- rollbacks dbase to a state spcified by the retracted/asserted clauses list
transEnd
public boolean transEnd(boolean f)
- ends a transaction.
if f is false, then rolls back the dbase to the state before transaction begin; if f is true, then commit changes
optimize
public void optimize()
- compacts dbase deleting items invalidated by retract op.
consult
public boolean consult(java.lang.String theoryText, boolean m, boolean dynamicTheory, java.lang.String libName)
- consults a theory.
if m is true, then set theory, if m is false then add theory; if dynamicTheory is true, then the clauses are marked as dynamic
consult
public boolean consult(Struct list, boolean m, boolean dynamicTheory, java.lang.String libName)
parseClause
private boolean parseClause(Struct co, alice.util.LinkedQueue clauses, boolean dynamicTheory, java.lang.String libName)
getStartGoal
public Struct getStartGoal()
- gets the goal eventually defined by last parsed theory.
save
public boolean save(java.io.OutputStream os, boolean onlyDynamic)
- saves the dbase on a output stream.
|
|||||||||
Home >> All >> alice >> [ tuprolog overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |