Class UnitRuleGroup
- java.lang.Object
-
- org.rossonet.ext.rules.core.BasicRule
-
- org.rossonet.ext.rules.support.composite.CompositeRule
-
- org.rossonet.ext.rules.support.composite.UnitRuleGroup
-
public class UnitRuleGroup extends CompositeRule
A unit rule group is a composite rule that acts as a unit: Either all rules are applied or nothing is applied (all or nothing semantic). This class is not thread-safe.
-
-
Field Summary
-
Fields inherited from class org.rossonet.ext.rules.support.composite.CompositeRule
rules
-
Fields inherited from class org.rossonet.ext.rules.core.BasicRule
description, name, priority
-
Fields inherited from interface org.rossonet.ext.rules.api.Rule
DEFAULT_DESCRIPTION, DEFAULT_NAME, DEFAULT_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description UnitRuleGroup()Create a unit rule group.UnitRuleGroup(java.lang.String name)Create a unit rule group.UnitRuleGroup(java.lang.String name, java.lang.String description)Create a unit rule group.UnitRuleGroup(java.lang.String name, java.lang.String description, int priority)Create a unit rule group.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanevaluate(Facts facts)This method implements the rule's condition(s).voidexecute(Facts facts)This method implements the rule's action(s).-
Methods inherited from class org.rossonet.ext.rules.support.composite.CompositeRule
addRule, removeRule
-
Methods inherited from class org.rossonet.ext.rules.core.BasicRule
compareTo, equals, getDescription, getName, getPriority, hashCode, setDescription, setPriority, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.rossonet.ext.rules.api.Rule
isTraceEnable
-
-
-
-
Constructor Detail
-
UnitRuleGroup
public UnitRuleGroup()
Create a unit rule group.
-
UnitRuleGroup
public UnitRuleGroup(java.lang.String name)
Create a unit rule group.- Parameters:
name- of the composite rule
-
UnitRuleGroup
public UnitRuleGroup(java.lang.String name, java.lang.String description)Create a unit rule group.- Parameters:
name- of the composite ruledescription- of the composite rule
-
UnitRuleGroup
public UnitRuleGroup(java.lang.String name, java.lang.String description, int priority)Create a unit rule group.- Parameters:
name- of the composite ruledescription- of the composite rulepriority- of the composite rule
-
-
Method Detail
-
evaluate
public boolean evaluate(Facts facts)
Description copied from class:BasicRuleThis method implements the rule's condition(s). Implementations should handle any runtime exception and return true/false accordingly- Specified by:
evaluatein interfaceRule- Specified by:
evaluatein classCompositeRule- Returns:
- true if the rule should be applied given the provided facts, false otherwise
-
execute
public void execute(Facts facts) throws java.lang.Exception
Description copied from class:BasicRuleThis method implements the rule's action(s).- Specified by:
executein interfaceRule- Specified by:
executein classCompositeRule- Throws:
java.lang.Exception- thrown if an exception occurs when performing action(s)
-
-