| java.lang.Object org.mandarax.util.LogicFactorySupport
All known Subclasses: org.mandarax.examples.crm.DiscountCalculator,
LogicFactorySupport | public class LogicFactorySupport (Code) | | Utility class to facilitate creating rules, facts and terms.
author: Jens Dietrich version: 3.4 <7 March 05> since: 1.2 |
Method Summary | |
public ConstantTerm | cons(Object obj, Class type) Create a constant term. | public ComplexTerm | cplx(Function function, Object[] objs) Create a complex term. | public ComplexTerm | cplx(Function function, Object obj1) Create a complex term with one (sub)term. | public ComplexTerm | cplx(Function function, Object obj1, Object obj2) Create a complex term with two (sub)terms. | public ComplexTerm | cplx(Function function, Object obj1, Object obj2, Object obj3) Create a complex term with three (sub)terms. | public ComplexTerm | cplx(Function function, Object obj1, Object obj2, Object obj3, Object obj4) Create a complex term with four (sub)terms. | public Prerequisite | cut() Create a prerequiste using the cut predicate. | public Fact | fact(Predicate predicate, Object[] objs) Create a fact. | public Fact | fact(Predicate predicate, Object obj) Create a fact with one term. | public Fact | fact(Predicate predicate, Object obj1, Object obj2) Create a fact with two terms. | public Fact | fact(Predicate predicate, Object obj1, Object obj2, Object obj3) Create a fact with three terms. | public Fact | fact(Predicate predicate, Object obj1, Object obj2, Object obj3, Object obj4) Create a fact with four terms. | public Prerequisite | fact2prereq(Fact fact) Convert a fact to a prerequisite. | public Rule | orRule(Fact prerequisite1, Fact prerequisite2, Fact conclusion) Create a rule with two prerequisites. | public Rule | orRule(Fact prerequisite1, Fact prerequisite2, Fact prerequisite3, Fact conclusion) Create a rule with three prerequisites. | public Rule | orRule(Fact prerequisite1, Fact prerequisite2, Fact prerequisite3, Fact prerequisite4, Fact conclusion) Create a rule with four prerequisites. | public Rule | orRule(Prerequisite prerequisite1, Prerequisite prerequisite2, Fact conclusion) Create a rule with two prerequisites. | public Rule | orRule(Prerequisite prerequisite1, Prerequisite prerequisite2, Prerequisite prerequisite3, Fact conclusion) Create a rule with three prerequisites. | public Rule | orRule(Prerequisite prerequisite1, Prerequisite prerequisite2, Prerequisite prerequisite3, Prerequisite prerequisite4, Fact conclusion) Create a rule with four prerequisites. | public Prerequisite | prereq(Predicate predicate, Object[] objs) Create a prerequisite. | public Prerequisite | prereq(Predicate predicate, Object obj) Create a prerequisite with one term. | public Prerequisite | prereq(Predicate predicate, Object obj1, Object obj2) Create a prerequisite with two terms. | public Prerequisite | prereq(Predicate predicate, Object obj1, Object obj2, Object obj3) Create a prerequisite with three terms. | public Prerequisite | prereq(Predicate predicate, Object obj1, Object obj2, Object obj3, Object obj4) Create a prerequisite with four terms. | public Prerequisite | prereq(Predicate predicate, Object[] objs, boolean negatedAF) Create a prerequisite. | public Prerequisite | prereq(Predicate predicate, Object obj, boolean negatedAF) Create a prerequisite with one term. | public Prerequisite | prereq(Predicate predicate, Object obj1, Object obj2, boolean negatedAF) Create a prerequisite with two terms. | public Prerequisite | prereq(Predicate predicate, Object obj1, Object obj2, Object obj3, boolean negatedAF) Create a prerequisite with three terms. | public Prerequisite | prereq(Predicate predicate, Object obj1, Object obj2, Object obj3, Object obj4, boolean negatedAF) Create a prerequisite with four terms. | public Query | query(Fact fact, String name) Create a query with one fact. | public Query | query(Fact fact1, Fact fact2, String name) Create a query with two facts. | public Query | query(Fact fact1, Fact fact2, Fact fact3, String name) Create a query with three facts. | public Query | query(Fact[] facts, String name) Create a query with N facts. | public Rule | rule(List body, Fact conclusion) Create a rule. | public Rule | rule(Fact conclusion) Create a rule with no prerequisites. | public Rule | rule(Fact prerequisite, Fact conclusion) Create a rule with one prerequisite. | public Rule | rule(Fact prerequisite1, Fact prerequisite2, Fact conclusion) Create a rule with two prerequisites. | public Rule | rule(Fact prerequisite1, Fact prerequisite2, Fact prerequisite3, Fact conclusion) Create a rule with three prerequisites. | public Rule | rule(Fact prerequisite1, Fact prerequisite2, Fact prerequisite3, Fact prerequisite4, Fact conclusion) Create a rule with four prerequisites. | public Rule | rule(Prerequisite prerequisite, Fact conclusion) Create a rule with one prerequisite. | public Rule | rule(Prerequisite prerequisite1, Prerequisite prerequisite2, Fact conclusion) Create a rule with two prerequisites. | public Rule | rule(Prerequisite prerequisite1, Prerequisite prerequisite2, Prerequisite prerequisite3, Fact conclusion) Create a rule with three prerequisites. | public Rule | rule(Prerequisite prerequisite1, Prerequisite prerequisite2, Prerequisite prerequisite3, Prerequisite prerequisite4, Fact conclusion) Create a rule with four prerequisites. | public Term | variable(String name, Class clazz) Convenient method to create a variable. | public Term | variable(String name) Convenient method to create a string type variable. |
LogicFactorySupport | public LogicFactorySupport()(Code) | | Constructor.
|
LogicFactorySupport | public LogicFactorySupport(LogicFactory aFactory)(Code) | | Constructor.
Parameters: aFactory - the logic factory to be used |
cons | public ConstantTerm cons(Object obj, Class type)(Code) | | Create a constant term.
the constant term created Parameters: obj - the object Parameters: type - the type |
cplx | public ComplexTerm cplx(Function function, Object[] objs)(Code) | | Create a complex term.
See toTerm how the object is converted to a term.
the complex term created Parameters: function - the function Parameters: objs - objects (will be interpreted as terms) |
cplx | public ComplexTerm cplx(Function function, Object obj1)(Code) | | Create a complex term with one (sub)term.
See toTerm how the object is converted to a term.
the complex term created Parameters: function - the function Parameters: obj - an object |
cplx | public ComplexTerm cplx(Function function, Object obj1, Object obj2)(Code) | | Create a complex term with two (sub)terms.
See toTerm how the object is converted to a term.
the complex term created Parameters: function - the function Parameters: obj1 - an object Parameters: obj2 - an object |
cplx | public ComplexTerm cplx(Function function, Object obj1, Object obj2, Object obj3)(Code) | | Create a complex term with three (sub)terms.
See toTerm how the object is converted to a term.
the complex term created Parameters: function - the function Parameters: obj1 - an object Parameters: obj2 - an object Parameters: obj3 - an object |
cplx | public ComplexTerm cplx(Function function, Object obj1, Object obj2, Object obj3, Object obj4)(Code) | | Create a complex term with four (sub)terms.
See toTerm how the object is converted to a term.
the complex term created Parameters: function - the function Parameters: obj1 - an object Parameters: obj2 - an object Parameters: obj3 - an object Parameters: obj4 - an object |
cut | public Prerequisite cut()(Code) | | Create a prerequiste using the cut predicate.
a prerequisite |
fact | public Fact fact(Predicate predicate, Object[] objs)(Code) | | Create a fact.
See toTerm how the object is converted to a term.
the fact created Parameters: predicate - the predicate Parameters: objs - objects (will be interpreted as terms) |
fact | public Fact fact(Predicate predicate, Object obj)(Code) | | Create a fact with one term.
See toTerm how the object is converted to a term.
the fact created Parameters: predicate - the predicate Parameters: obj - an object |
fact | public Fact fact(Predicate predicate, Object obj1, Object obj2)(Code) | | Create a fact with two terms.
See toTerm how the object is converted to a term.
the fact created Parameters: predicate - the predicate Parameters: obj1 - an object Parameters: obj2 - an object |
fact | public Fact fact(Predicate predicate, Object obj1, Object obj2, Object obj3)(Code) | | Create a fact with three terms.
See toTerm how the object is converted to a term.
the fact created Parameters: predicate - the predicate Parameters: obj1 - an object Parameters: obj2 - an object Parameters: obj3 - an object |
fact | public Fact fact(Predicate predicate, Object obj1, Object obj2, Object obj3, Object obj4)(Code) | | Create a fact with four terms.
See toTerm how the object is converted to a term.
the fact created Parameters: predicate - the predicate Parameters: obj1 - an object Parameters: obj2 - an object Parameters: obj3 - an object Parameters: obj4 - an object |
fact2prereq | public Prerequisite fact2prereq(Fact fact)(Code) | | Convert a fact to a prerequisite.
Parameters: fact - a fact a prerequisite |
orRule | public Rule orRule(Fact prerequisite1, Fact prerequisite2, Fact conclusion)(Code) | | Create a rule with two prerequisites.
The prerequisites are connected by OR.
the rule created Parameters: prerequisite1 - a prerequisite Parameters: prerequisite2 - a prerequisite Parameters: conclusion - the concusion of the rule |
orRule | public Rule orRule(Fact prerequisite1, Fact prerequisite2, Fact prerequisite3, Fact conclusion)(Code) | | Create a rule with three prerequisites.
The prerequisites are connected by OR.
the rule created Parameters: prerequisite1 - a prerequisite Parameters: prerequisite2 - a prerequisite Parameters: prerequisite3 - a prerequisite Parameters: conclusion - the concusion of the rule |
orRule | public Rule orRule(Fact prerequisite1, Fact prerequisite2, Fact prerequisite3, Fact prerequisite4, Fact conclusion)(Code) | | Create a rule with four prerequisites.
The prerequisites are connected by OR.
the rule created Parameters: prerequisite1 - a prerequisite Parameters: prerequisite2 - a prerequisite Parameters: prerequisite3 - a prerequisite Parameters: prerequisite4 - a prerequisite Parameters: conclusion - the concusion of the rule |
orRule | public Rule orRule(Prerequisite prerequisite1, Prerequisite prerequisite2, Fact conclusion)(Code) | | Create a rule with two prerequisites.
The prerequisites are connected by OR.
the rule created Parameters: prerequisite1 - a prerequisite Parameters: prerequisite2 - a prerequisite Parameters: conclusion - the concusion of the rule |
orRule | public Rule orRule(Prerequisite prerequisite1, Prerequisite prerequisite2, Prerequisite prerequisite3, Fact conclusion)(Code) | | Create a rule with three prerequisites.
The prerequisites are connected by OR.
the rule created Parameters: prerequisite1 - a prerequisite Parameters: prerequisite2 - a prerequisite Parameters: prerequisite3 - a prerequisite Parameters: conclusion - the concusion of the rule |
orRule | public Rule orRule(Prerequisite prerequisite1, Prerequisite prerequisite2, Prerequisite prerequisite3, Prerequisite prerequisite4, Fact conclusion)(Code) | | Create a rule with four prerequisites.
The prerequisites are connected by OR.
the rule created Parameters: prerequisite1 - a prerequisite Parameters: prerequisite2 - a prerequisite Parameters: prerequisite3 - a prerequisite Parameters: prerequisite4 - a prerequisite Parameters: conclusion - the concusion of the rule |
prereq | public Prerequisite prereq(Predicate predicate, Object[] objs)(Code) | | Create a prerequisite.
See toTerm how the object is converted to a term.
the prerequisite created Parameters: predicate - the predicate Parameters: objs - objects (will be interpreted as terms) |
prereq | public Prerequisite prereq(Predicate predicate, Object obj)(Code) | | Create a prerequisite with one term.
See toTerm how the object is converted to a term.
the prerequisite created Parameters: predicate - the predicate Parameters: obj - an object |
prereq | public Prerequisite prereq(Predicate predicate, Object obj1, Object obj2)(Code) | | Create a prerequisite with two terms.
See toTerm how the object is converted to a term.
the prerequisite created Parameters: predicate - the predicate Parameters: obj1 - an object Parameters: obj2 - an object |
prereq | public Prerequisite prereq(Predicate predicate, Object obj1, Object obj2, Object obj3)(Code) | | Create a prerequisite with three terms.
See toTerm how the object is converted to a term.
the prerequisite created Parameters: predicate - the predicate Parameters: obj1 - an object Parameters: obj2 - an object Parameters: obj3 - an object |
prereq | public Prerequisite prereq(Predicate predicate, Object obj1, Object obj2, Object obj3, Object obj4)(Code) | | Create a prerequisite with four terms.
See toTerm how the object is converted to a term.
the prerequisite created Parameters: predicate - the predicate Parameters: obj1 - an object Parameters: obj2 - an object Parameters: obj3 - an object Parameters: obj4 - an object |
prereq | public Prerequisite prereq(Predicate predicate, Object[] objs, boolean negatedAF)(Code) | | Create a prerequisite.
See toTerm how the object is converted to a term.
the prerequisite created Parameters: predicate - the predicate Parameters: objs - objects (will be interpreted as terms) Parameters: negatedAF - whether the prerequisite is negated (using negation as failure) |
prereq | public Prerequisite prereq(Predicate predicate, Object obj, boolean negatedAF)(Code) | | Create a prerequisite with one term.
See toTerm how the object is converted to a term.
the prerequisite created Parameters: predicate - the predicate Parameters: obj - an object Parameters: negatedAF - whether the prerequisite is negated (using negation as failure) |
prereq | public Prerequisite prereq(Predicate predicate, Object obj1, Object obj2, boolean negatedAF)(Code) | | Create a prerequisite with two terms.
See toTerm how the object is converted to a term.
the prerequisite created Parameters: predicate - the predicate Parameters: obj1 - an object Parameters: obj2 - an object Parameters: negatedAF - whether the prerequisite is negated (using negation as failure) |
prereq | public Prerequisite prereq(Predicate predicate, Object obj1, Object obj2, Object obj3, boolean negatedAF)(Code) | | Create a prerequisite with three terms.
See toTerm how the object is converted to a term.
the prerequisite created Parameters: predicate - the predicate Parameters: obj1 - an object Parameters: obj2 - an object Parameters: obj3 - an object Parameters: negatedAF - whether the prerequisite is negated (using negation as failure) |
prereq | public Prerequisite prereq(Predicate predicate, Object obj1, Object obj2, Object obj3, Object obj4, boolean negatedAF)(Code) | | Create a prerequisite with four terms.
See toTerm how the object is converted to a term.
the prerequisite created Parameters: predicate - the predicate Parameters: obj1 - an object Parameters: obj2 - an object Parameters: obj3 - an object Parameters: obj4 - an object Parameters: negatedAF - whether the prerequisite is negated (using negation as failure) |
query | public Query query(Fact fact, String name)(Code) | | Create a query with one fact.
the query created Parameters: fact - a fact Parameters: name - the name of the query |
query | public Query query(Fact fact1, Fact fact2, String name)(Code) | | Create a query with two facts.
the query created Parameters: fact1 - a fact Parameters: fact2 - a fact Parameters: name - the name of the query |
query | public Query query(Fact fact1, Fact fact2, Fact fact3, String name)(Code) | | Create a query with three facts.
the query created Parameters: fact1 - a fact Parameters: fact2 - a fact Parameters: fact3 - a fact Parameters: name - the name of the query |
query | public Query query(Fact[] facts, String name)(Code) | | Create a query with N facts.
the query created Parameters: fact1 - a fact Parameters: fact2 - a fact Parameters: name - the name of the query |
rule | public Rule rule(List body, Fact conclusion)(Code) | | Create a rule.
the rule created Parameters: body - the prerequisites of the rule Parameters: conclusion - the concusion of the rule |
rule | public Rule rule(Fact conclusion)(Code) | | Create a rule with no prerequisites.
the rule created Parameters: conclusion - the concusion of the rule |
rule | public Rule rule(Fact prerequisite, Fact conclusion)(Code) | | Create a rule with one prerequisite.
the rule created Parameters: prerequisite - a prerequisite Parameters: conclusion - the concusion of the rule |
rule | public Rule rule(Fact prerequisite1, Fact prerequisite2, Fact conclusion)(Code) | | Create a rule with two prerequisites.
the rule created Parameters: prerequisite1 - a prerequisite Parameters: prerequisite2 - a prerequisite Parameters: conclusion - the concusion of the rule |
rule | public Rule rule(Fact prerequisite1, Fact prerequisite2, Fact prerequisite3, Fact conclusion)(Code) | | Create a rule with three prerequisites.
the rule created Parameters: prerequisite1 - a prerequisite Parameters: prerequisite2 - a prerequisite Parameters: prerequisite3 - a prerequisite Parameters: conclusion - the concusion of the rule |
rule | public Rule rule(Fact prerequisite1, Fact prerequisite2, Fact prerequisite3, Fact prerequisite4, Fact conclusion)(Code) | | Create a rule with four prerequisites.
the rule created Parameters: prerequisite1 - a prerequisite Parameters: prerequisite2 - a prerequisite Parameters: prerequisite3 - a prerequisite Parameters: prerequisite4 - a prerequisite Parameters: conclusion - the concusion of the rule |
rule | public Rule rule(Prerequisite prerequisite, Fact conclusion)(Code) | | Create a rule with one prerequisite.
the rule created Parameters: prerequisite - a prerequisite Parameters: conclusion - the concusion of the rule |
rule | public Rule rule(Prerequisite prerequisite1, Prerequisite prerequisite2, Fact conclusion)(Code) | | Create a rule with two prerequisites.
the rule created Parameters: prerequisite1 - a prerequisite Parameters: prerequisite2 - a prerequisite Parameters: conclusion - the concusion of the rule |
rule | public Rule rule(Prerequisite prerequisite1, Prerequisite prerequisite2, Prerequisite prerequisite3, Fact conclusion)(Code) | | Create a rule with three prerequisites.
the rule created Parameters: prerequisite1 - a prerequisite Parameters: prerequisite2 - a prerequisite Parameters: prerequisite3 - a prerequisite Parameters: conclusion - the concusion of the rule |
rule | public Rule rule(Prerequisite prerequisite1, Prerequisite prerequisite2, Prerequisite prerequisite3, Prerequisite prerequisite4, Fact conclusion)(Code) | | Create a rule with four prerequisites.
the rule created Parameters: prerequisite1 - a prerequisite Parameters: prerequisite2 - a prerequisite Parameters: prerequisite3 - a prerequisite Parameters: prerequisite4 - a prerequisite Parameters: conclusion - the concusion of the rule |
variable | public Term variable(String name, Class clazz)(Code) | | Convenient method to create a variable.
a term Parameters: name - a var name Parameters: clazz - a type |
variable | public Term variable(String name)(Code) | | Convenient method to create a string type variable.
a term Parameters: name - a var name |
|
|