| java.lang.Object org.ofbiz.rules.engine.Rule org.ofbiz.rules.engine.DynamicRule
All known Subclasses: org.ofbiz.rules.engine.Query,
DynamicRule | public class DynamicRule extends Rule implements DynamicAxiom(Code) | | Title: Dynamic Rule
Description: None
Copyright (c) 1999 Steven J. Metsker.
Copyright (c) 2001 The Open For Business Project - www.ofbiz.org
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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) .
author: Steven J. Metsker version: 1.0 |
Constructor Summary | |
protected | DynamicRule(AxiomSource as, Scope scope, Structure[] structures) Construct a provable rule for the given axiom source,
scope, and structures -- these structures must all be
capable of proving themselves. | protected | DynamicRule(AxiomSource as, Scope scope, Rule rule) Construct a provable rule for the given axiom source,
scope, and rule. |
Method Summary | |
public boolean | canEstablish() "Can establish" means that either a rule can prove itself, or
that the rule is empty.
When a structure unifies with the head of a rule, the
structure asks the rule's tail if it can "establish" itself.
This amounts to proving the tail, unless this rule is
empty. | public 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. | public Scope | getScope() Return the home of this dynamic rule's variables. | public boolean | isEmpty() Return true if this rule contains no
structures. | public Variable | lookup(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. | public DynamicRule | resolvent() Returns the series of structures which, if proven, prove
the truth of the head. | public DynamicRule | tail() Returns the series of structures after the head. | public Unification | variables() Returns this executable rule's variables. |
headInvolved | protected boolean headInvolved(Code) | | |
DynamicRule | protected DynamicRule(AxiomSource as, Scope scope, Structure[] structures)(Code) | | Construct a provable rule for the given axiom source,
scope, and structures -- these structures must all be
capable of proving themselves. That is, they must be
consulting structures or gateways.
|
DynamicRule | protected DynamicRule(AxiomSource as, Scope scope, Rule rule)(Code) | | Construct a provable rule for the given axiom source,
scope, and rule.
Parameters: AxiomSource - the source to consult for provingthe structures in this dynamic rule Parameters: Scope - a home for the variables in this dynamicrule Parameters: Rule - the non-dynamic source of this rule. |
canEstablish | public boolean canEstablish()(Code) | | "Can establish" means that either a rule can prove itself, or
that the rule is empty.
When a structure unifies with the head of a rule, the
structure asks the rule's tail if it can "establish" itself.
This amounts to proving the tail, unless this rule is
empty. If this rule is empty, it can "establish" itself,
but it cannot "find next proof".
true if this rule is empty, orif it is nonempty and can find another proof |
canFindNextProof | public boolean canFindNextProof()(Code) | | Tests if this rule can find another proof, and, if so, sets
this rule's variables to the values that make the proof true.
true if this rule can find anotherproof. |
getScope | public Scope getScope()(Code) | | Return the home of this dynamic rule's variables.
the home of this dynamic rule's variables |
isEmpty | public boolean isEmpty()(Code) | | Return true if this rule contains no
structures.
true if this rule contains nostructures. |
lookup | public Variable lookup(String name)(Code) | | Return a variable of the given name.
a variable of the given name Parameters: String - the name to look up |
resolvent | public DynamicRule resolvent()(Code) | | Returns the series of structures which, if proven, prove
the truth of the head.
the tail of this rule |
tail | public DynamicRule tail()(Code) | | Returns the series of structures after the head.
the tail of this rule |
variables | public Unification variables()(Code) | | Returns this executable rule's variables.
unification a collection of variables from thisrule |
|
|