| java.lang.Object org.ofbiz.rules.engine.Structure org.ofbiz.rules.engine.ConsultingStructure
ConsultingStructure | public class ConsultingStructure extends Structure (Code) | | A ConsultingStructure is structure that can prove itself against an axiom source supplied with the constructor.
When a rule creates a dynamic version of itself, a normal
structure will create a ConsultingStructure counterpart
that uses the rule's scope, and that consults a given
axiom source (such as a Program).
The primary behavior that a ConsultingStructure adds
is the ability to prove itself.
author: Steven J. Metsker version: 1.0 |
Constructor Summary | |
protected | ConsultingStructure(AxiomSource source, Object functor, Term[] terms) Constructs a consulting structure with the specified functor
and terms, to consult against the supplied axiom source. |
Method Summary | |
protected AxiomEnumeration | axioms() Returns the axioms that a consulting structure can
consult. | public boolean | canFindNextProof() Tests if this structure can find another proof, and, if so,
sets this structure's variables to the values that make the
proof true. | protected boolean | canUnify() Return true if this structure can unify with another rule in the
program.
A consulting structure proves itself true by unifying with
the head of a rule in a program, and then asking the tail
of that rule to prove itself. | protected void | unbind() Release the variable bindings that the last unification
produced. |
ConsultingStructure | protected ConsultingStructure(AxiomSource source, Object functor, Term[] terms)(Code) | | Constructs a consulting structure with the specified functor
and terms, to consult against the supplied axiom source.
This constructor is for use by Structure.
|
axioms | protected AxiomEnumeration axioms()(Code) | | Returns the axioms that a consulting structure can
consult. Note that after canUnify fails, this object will
set its axioms to null, which forces its proving
attempts to start over at the beginning of the source.
|
canFindNextProof | public boolean canFindNextProof()(Code) | | Tests if this structure can find another proof, and, if so,
sets this structure's variables to the values that make the
proof true.
true if this structure can find anotherproof. |
canUnify | protected boolean canUnify()(Code) | | Return true if this structure can unify with another rule in the
program.
A consulting structure proves itself true by unifying with
the head of a rule in a program, and then asking the tail
of that rule to prove itself. Unification is a kind of
matching. Two structures unify if they have equal functors,
and the terms all unify. A variable unifies with a
structure simply by setting its instantiation to be the
structure.
For example, the following structures can unify:
starred(jamesCagney, Title, Year)
starred(jamesCagney, "Yankee Doodle Dandy", 1942)
When these structures unify, the variable Title will bind
itself to "Yankee Doodle Dandy", and Year will bind to 1942.
To be more specific, Title will bind to the atom
whose functor is "Yankee Doodle Dandy". Year will bind to the
atom whose functor is the number 1942.
true , if this structure can unify withan axiom in the axiom source |
unbind | protected void unbind()(Code) | | Release the variable bindings that the last unification
produced.
|
|
|