|
Rule Execution Server API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ilog.rules.factory.IlrRulesetFactory
public class IlrRulesetFactory
This class represents an input unit of the rule language. It is
the main class of the factory API.
An instance of this class can be obtained from an
IlrRuleset
object. Conversely, an IlrRuleset
object can analyze the contents of an IlrRulesetFactory
object to create rules.
Warning: Serialized objects of this class will not be compatible with future releases. The current serialization support is appropriate for short-term storage or RMI between applications running the same version of IBM Decision Server.
IlrRuleset.makeFactory()
,
IlrRuleset.parseFactory(IlrRulesetFactory)
,
Serialized Form
Constructor Summary | |
---|---|
IlrRulesetFactory(IlrClass contextClass)
Constructs a ruleset factory using a derived context class, in other words, any subclass of ilog.rules.engine.IlrContext . |
|
IlrRulesetFactory(IlrReflect reflect)
Constructs a ruleset factory using the base execution context class, in other words, ilog.rules.engine.IlrContext.class . |
|
IlrRulesetFactory(IlrReflect reflect,
Class contextClass)
Constructs a ruleset factory using a derived context class, in other words, any subclass of ilog.rules.engine.IlrContext . |
Method Summary | |
---|---|
void |
addFunction(IlrFunctionFactory function)
Adds a function in a package. |
void |
addHasher(IlrHasher hasher)
Adds a new hasher in the ruleset hasher list. |
void |
addInitialAction(IlrStatement action)
Deprecated. |
void |
addInstance(IlrClass clazz,
IlrValue instance)
Adds the specified value in the object list in which the rule engine looks for objects of the specified class. |
void |
addOverridingRelation(String name,
ArrayList children)
Declares an overriding relation between rule groups. |
void |
addPackage(IlrPackageFactory pkg)
Adds a package in the ruleset. |
void |
addPackageVariable(IlrPackageFactory pkgF,
IlrType clazz,
String name,
IlrValue value)
Defines a package local variable. |
void |
addPropertyTypeDeclaration(Object type,
String pptyName)
Adds a property type declaration. |
void |
addRule(IlrRuleFactory rule)
Adds a rule in its package. |
void |
addRulesetVariable(int modifier,
IlrType clazz,
String name,
IlrValue value)
Defines a ruleset variable. |
void |
addTask(IlrTaskFactory task)
Adds a task to the tasks of the factory. |
void |
createInitialRule()
Deprecated. |
void |
declareHierarchicalProperty(IlrHierarchicalProperty ppty)
Declares a hierarchical property. |
Enumeration |
enumerateFunctions()
Gets an enumeration to visit all the functions of this factory, which means all the functions contained in all packages of this factory. |
Enumeration |
enumerateRules()
Gets an enumeration to visit all the rules of this factory, that is, all the rules contained in all packages of this factory. |
Class |
getContextClass()
Gets the context class of the ruleset factory. |
IlrContextValue |
getContextValue()
Gets the context value of the ruleset factory. |
IlrPackageFactory |
getDefaultPackage()
Returns the default package of the ruleset. |
IlrFunctionFactory |
getFunction(String name,
Class[] argTypes)
Gets a function factory by name and its signature. |
int |
getFunctionCount()
Gets the number of functions in this factory, which means the total of functions contained by all packages of this factory. |
IlrFunctionFactory[] |
getFunctions()
Gets the functions of this factory, which means the functions contained in all packages of this factory. |
IlrHierarchicalProperty |
getHierarchicalProperty(String name)
Gets a hierarchical property by name. |
IlrStatement[] |
getInitialActions()
Deprecated. |
IlrFunctionFactory |
getMatchingFunction(String name,
Class[] args)
Gets a function factory by name and matching the signature parameter. |
IlrFunctionFactory |
getMatchingFunction(String name,
IlrValue[] args)
Gets a function factory by name and matching the signature parameter. |
String |
getName()
Gets the name of the ruleset. |
IlrPackageFactory |
getPackage(String name)
Returns a package by name. |
IlrPackageFactory[] |
getPackages()
Gets the packages of this factory. |
IlrVariable |
getPackageVariable(String pkgName,
String name)
Returns the variable that implements the local variable whose name is passed as a parameter, in the given package. |
IlrPropertyList |
getProperties()
Gets the property list of this ruleset factory. |
IlrReflect |
getReflect()
Gets the reflect objects. |
IlrRuleFactory |
getRule(String name)
Gets a rule factory by name. |
int |
getRuleCount()
Gets the number of rules in this factory, which means the total of rules contained by all packages of this factory. |
ilog.rules.factory.IlrRuleOverridingFactory |
getRuleOverriding()
Returns the rule overriding declarations. |
IlrRuleFactory[] |
getRules()
Gets the rules of this factory, which means the rules contained in all packages of this factory. |
IlrVariable |
getRulesetVariable(String name)
Returns the variable that implements the ruleset parameter. |
IlrRuleWriter |
getRuleWriter()
Gets the rule writer used for writing the rules of this ruleset factory. |
IlrTaskFactory |
getTask(String name)
Gets a task factory by name. |
IlrTaskFactory[] |
getTasks()
Returns an array with all the tasks defined in the ruleset, which means all the tasks defined in all the packages of the ruleset. |
IlrClass |
getXOMContextClass()
Gets the context class of the ruleset factory. |
Object |
getXOMPropertyType(String property)
Returns the type of the given property. |
boolean |
isHierarchicalProperty(String name)
Returns a boolean value indicating whether there is a hierarchical property defined in the ruleset with this name. |
void |
removeFunction(IlrFunctionFactory function)
Removes a function from the package in which it is contained. |
void |
removeRule(IlrRuleFactory rule)
Removes a rule from the package in which it is contained. |
void |
setHasher(IlrType clazz,
String name,
IlrValue value)
Deprecated. |
void |
setInstances(IlrClass clazz,
IlrValue instances)
Sets the instances of the specified class with which the rule engine will work. |
void |
setName(String name)
Sets the name of the ruleset. |
void |
setRuleWriter(IlrRuleWriter ruleWriter)
Sets the rule writer used to write the rules of this ruleset factory. |
String |
toLanguage()
Converts this ruleset factory into the rule language as a rule input unit. |
String |
toLanguage(IlrFunctionFactory function)
Converts a function factory into the rule language. |
String |
toLanguage(IlrPackageFactory pkg)
Converts a package factory into the rule language. |
String |
toLanguage(IlrRuleFactory rule)
Converts a rule factory into the rule language. |
String |
toLanguage(IlrTaskFactory task)
Converts a task factory into the rule language. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public IlrRulesetFactory(IlrReflect reflect)
ilog.rules.engine.IlrContext.class
. The
factory is attached to the passed reflect object.
reflect
- A reflect.public IlrRulesetFactory(IlrReflect reflect, Class contextClass)
ilog.rules.engine.IlrContext
.
The rules contained in this ruleset factory will operate in
any instance of the derived context class.
reflect
- A reflect.contextClass
- The context class.
This is a derived class of ilog.rules.engine.IlrContext
.public IlrRulesetFactory(IlrClass contextClass)
ilog.rules.engine.IlrContext
.
The rules contained in this ruleset factory will operate in
any instance of the derived context class.
contextClass
- The context class.
This is a derived class of ilog.rules.engine.IlrContext
.Method Detail |
---|
public final IlrReflect getReflect()
public final IlrRuleWriter getRuleWriter()
public final void setRuleWriter(IlrRuleWriter ruleWriter)
ruleWriter
- A rule writer.public final String getName()
public final void setName(String name)
name
- The name of the ruleset.
The argument can be null
.public final IlrPropertyList getProperties()
public final Class getContextClass()
public final IlrClass getXOMContextClass()
public final IlrContextValue getContextValue()
?context
variable of the rule language.
public final void createInitialRule()
public final void addInitialAction(IlrStatement action)
action
- The action to be added.public final IlrStatement[] getInitialActions()
null
if no initial rule has been created.public final void addPackage(IlrPackageFactory pkg)
pkg
- The package to be added.public final IlrPackageFactory getPackage(String name)
name
- The name of the package factory.
name
.
When name
is null
, a null
object is returned.public final IlrPackageFactory getDefaultPackage()
public final IlrPackageFactory[] getPackages()
public final void addRule(IlrRuleFactory rule)
rule
- The rule to be added.public final void removeRule(IlrRuleFactory rule)
rule
- The rule to be removed.public final IlrRuleFactory getRule(String name)
name
- The name of the rule factory.
name
.
When name
is null
, a null
object is returned.public final int getRuleCount()
public final IlrRuleFactory[] getRules()
public final Enumeration enumerateRules()
public final void addFunction(IlrFunctionFactory function)
function
- The function to be added.public final void removeFunction(IlrFunctionFactory function)
function
- The function to be removed.public final IlrFunctionFactory getMatchingFunction(String name, IlrValue[] args)
name
- The name of the function factory.args
- The type of the function arguments.
name
.
When name
is null
, a null
object is returned.public final IlrFunctionFactory getMatchingFunction(String name, Class[] args)
name
- The name of the function factory.args
- The Java classes of the function arguments.
name
.
When name
is null
, a null
object is returned.public final IlrFunctionFactory getFunction(String name, Class[] argTypes)
name
- The name of the function factory.argTypes
- The type of the function arguments.
name
.
When name
is null
, a null
object is returned.public final int getFunctionCount()
public final IlrFunctionFactory[] getFunctions()
public final Enumeration enumerateFunctions()
public String toLanguage()
IlrRuleWriter
public String toLanguage(IlrPackageFactory pkg)
IlrRuleWriter
internally.
pkg
- The package factory to convert into rule language.
IlrRuleWriter
public String toLanguage(IlrRuleFactory rule)
IlrRuleWriter
internally.
rule
- The rule factory to convert into rule language.
IlrRuleWriter
public String toLanguage(IlrFunctionFactory function)
IlrRuleWriter
internally.
function
- The function factory to convert into rule language.
IlrRuleWriter
public String toLanguage(IlrTaskFactory task)
IlrRuleWriter
internally.
task
- The task factory to convert into rule language.
IlrRuleWriter
public void addTask(IlrTaskFactory task)
task
- The task to be added.public IlrTaskFactory[] getTasks()
public final IlrTaskFactory getTask(String name)
name
- The name of the task factory.
name
.
When name
is null
, a null
object is returned.public Object getXOMPropertyType(String property)
null
.
The property type can be either an IlrType
or
IlrHierarchicalProperty
object.
property
- The property name.
null
.public void addPropertyTypeDeclaration(Object type, String pptyName)
?rule.?location
,
where ?rule is an IlrRule
variable and ?location
a property defined on the rule,
is possible if the type of the ?location
property
has been defined.
type
- The type of the property to be declared. The type can be
either an IlrType
object or a hierarchical property
implemented with an IlrHierarchicalProperty
object.
If the type is neither an IlrType
nor an
IlrHierarchicalProperty
, an
IllegalArgumentException
is thrown.pptyName
- The name of the property to declare.public void declareHierarchicalProperty(IlrHierarchicalProperty ppty)
ppty
- A hierarchical property to declare to the ruleset.public IlrHierarchicalProperty getHierarchicalProperty(String name)
name
- The name of the hierarchical property.
public boolean isHierarchicalProperty(String name)
true
if a hierarchical property
whose name is name
is defined in the ruleset,
else it returns false
.public void addRulesetVariable(int modifier, IlrType clazz, String name, IlrValue value)
IlrRulesetConstants.In
,
IlrRulesetConstants.InOut
,
IlrRulesetConstants.Out
, or 0
for local
variables. If another value is given, an
IllegalArgumentException
exception is thrown.
An initial value can be given except for in
or
inout
ruleset variables.
A local variable is added to the default package; any other kind of variable
is considered as part of the ruleset signature and therefore attached to
the ruleset.
If the variable contains any '.' characters, an
IllegalArgumentException
exception is thrown.
clazz
- The parameter type.name
- The parameter name.value
- The initial value.modifier
- The parameter modifier.public void addPackageVariable(IlrPackageFactory pkgF, IlrType clazz, String name, IlrValue value)
pkgF
- The package in which the variable is to be inserted.clazz
- The parameter type.name
- The parameter name.value
- The initial value.public IlrVariable getRulesetVariable(String name)
in
and inout
ruleset variables.
If it is not found, the variable name is searched in the ruleset
variables defined as out
.
name
- The name of the requested variable.public IlrVariable getPackageVariable(String pkgName, String name)
pkgName
- The package containing the variable.name
- The name of the variable we are looking for.public void addOverridingRelation(String name, ArrayList children)
name
- The name of the overrider group.children
- The list of overridden groups.public ilog.rules.factory.IlrRuleOverridingFactory getRuleOverriding()
IlrRuleOverridingFactory
that models the
rules overriding relations.public void setInstances(IlrClass clazz, IlrValue instances)
java.util.Collection
.
For objects of this class bound in the rules condition part,
the rule engine will not try to match with objects stored in the working
memory, but it will take them from the specified collection.
clazz
- The class for which the instances are specified.instances
- The collection of objects.public void addInstance(IlrClass clazz, IlrValue instance)
clazz
- The class for which the instances are specified.instance
- The value added in the object list for the specified class.public void setHasher(IlrType clazz, String name, IlrValue value)
integer
type.
clazz
- The class for which the hasher is defined.name
- The name of the variable used in the expression of the
hasher value.value
- The hasher value of integer
type.public void addHasher(IlrHasher hasher)
hasher
- The new hasher to be added in the ruleset hasher list.
|
Rule Execution Server API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |