|
Building Parsers with Java | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--sjm.engine.Rule
|
+--sjm.engine.DynamicRule
A DynamicRule represents a provable statement that a structure is true if a following series of other structures are true.
For example,
bachelor(X) :- male(X), unmarried(X);
is a logical rule.
The head of this rule is the structure bachelor(X)
. A structure bachelor(B) can prove
itself by unifying with the head, and then proving the
remaining structures or "tail".
The tail in this example contains male(X)
and unmarried(X).
| Field Summary | |
protected AxiomSource |
as
|
protected boolean |
headInvolved
|
protected Scope |
scope
|
protected DynamicRule |
tail
|
| Fields inherited from class sjm.engine.Rule |
structures |
| Constructor Summary | |
protected |
DynamicRule(AxiomSource as,
Scope scope,
Rule rule)
Construct a provable rule for the given axiom source, scope, and rule. |
protected |
DynamicRule(AxiomSource as,
Scope scope,
Structure[] structures)
|
| Method Summary | |
boolean |
canEstablish()
"Can establish" means that either a rule can prove itself, or that the rule is empty. |
boolean |
canFindNextProof()
Tests if this rule can find another proof, and, if so, sets this rule's variables to the values that make the proof true. |
Scope |
getScope()
Return the home of this dynamic rule's variables. |
boolean |
isEmpty()
Return true if this rule contains no
structures. |
Variable |
lookup(java.lang.String name)
Return a variable of the given name. |
protected static Structure[] |
provableStructures(AxiomSource as,
Scope scope,
Structure[] structures)
Create provable versions of an input array of structures. |
DynamicRule |
resolvent()
Returns the series of structures which, if proven, prove the truth of the head. |
DynamicRule |
tail()
Returns the series of structures after the head. |
Unification |
variables()
Returns this executable rule's variables. |
| Methods inherited from class sjm.engine.Rule |
dynamicAxiom,
equals,
head,
toString |
| Methods inherited from class java.lang.Object |
clone,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Field Detail |
protected AxiomSource as
protected Scope scope
protected boolean headInvolved
protected DynamicRule tail
| Constructor Detail |
protected DynamicRule(AxiomSource as,
Scope scope,
Structure[] structures)
protected DynamicRule(AxiomSource as,
Scope scope,
Rule rule)
AxiomSource - the source to consult for proving
the structures in this dynamic ruleScope - a home for the variables in this dynamic
ruleRule - the non-dynamic source of this rule.| Method Detail |
public boolean canEstablish()
true if this rule is empty, or
if it is nonempty and can find another proofpublic boolean canFindNextProof()
true if this rule can find another
proof.public Scope getScope()
public boolean isEmpty()
true if this rule contains no
structures.true if this rule contains no
structures.public Variable lookup(java.lang.String name)
String - the name to look up
protected static Structure[] provableStructures(AxiomSource as,
Scope scope,
Structure[] structures)
public DynamicRule resolvent()
public DynamicRule tail()
public Unification variables()
|
by Steve Metsker | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||