com.ibm.websphere.brb.implementor
Class RuleAND

java.lang.Object
  extended bycom.ibm.websphere.brb.implementor.RuleAND
All Implemented Interfaces:
RuleImplementor

public class RuleAND
extends java.lang.Object
implements RuleImplementor

Combination rule comprised of two or more rules which are all fired and their results ANDed together. The dependent rules may return either ConstaintReturn or java.lang.Boolean. Note that the algorithm does not short-circuit evaluation when the first false result is encountered. All dependent rules are triggered regardless of the results.

When triggering a dependent rule, if more than one rule is found with the same name, then all rules with that name will be triggered and their results will be ANDed together.


Field Summary
protected  java.lang.String[] dependentRules
           
 
Constructor Summary
RuleAND()
          Parameterless constructor for RuleAND.
 
Method Summary
 java.lang.Object fire(TriggerPoint tp, java.lang.Object target, IRuleCopy rule, java.lang.Object[] parms)
          Fires all dependent rules, ANDing the results together.
 java.lang.String getDescription()
          The programmer's description of what the algorithm does.
 void init(java.lang.Object[] parms, java.lang.String[] dependentRules, java.lang.String userDefinedData, IRuleCopy rule)
          Initializes with persistent parameters used by this rule.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dependentRules

protected java.lang.String[] dependentRules
Constructor Detail

RuleAND

public RuleAND()
Parameterless constructor for RuleAND.

Method Detail

fire

public java.lang.Object fire(TriggerPoint tp,
                             java.lang.Object target,
                             IRuleCopy rule,
                             java.lang.Object[] parms)
                      throws BusinessRuleBeansException
Fires all dependent rules, ANDing the results together. The dependent rules may return either ConstraintReturn or java.lang.Boolean. A true ConstraintReturn is returned if all dependent rules return true. Otherwise a false ConstraintReturn is returned holding information about each of the dependent rules that returned a failing ConstraintReturn. Note that the algorithm does not short-circuit evaluation when the first false result is encountered. All dependent rules are triggered regardless of the results.

When triggering a dependent rule, if more than one rule is found with the same name, then all rules with that name will be triggered and their results will be ANDed together.

Specified by:
fire in interface RuleImplementor
Parameters:
tp - the trigger point which is firing this rule implementor.
target - the target object of the trigger point
rule - the rule that the implementor is running on behalf of
Returns:
The result of firing the rule implementor. Implementors that carry out classifications must return a single String. Implementors which check constraints should generally return a ConstraintReturn, especially if the results are to be combined and returned by the BRBeans framework.
Throws:
BusinessRuleBeansException

getDescription

public java.lang.String getDescription()
The programmer's description of what the algorithm does.

Specified by:
getDescription in interface RuleImplementor
Returns:
A description of this rule implementor.

init

public void init(java.lang.Object[] parms,
                 java.lang.String[] dependentRules,
                 java.lang.String userDefinedData,
                 IRuleCopy rule)
          throws BusinessRuleBeansException
Initializes with persistent parameters used by this rule. This rule has two or more dependent rules whose names are provided and retained.

Specified by:
init in interface RuleImplementor
Parameters:
parms - the parameters needed to initialize this RuleImplementor
dependentRules - the names of the dependent rules to this rule; if there are none, null is passed
userDefinedData - userDefinedData property from the Rule
rule - the Rule on whose behalf the rule implementor is running
Throws:
BusinessRuleBeansException