com.ibm.websphere.brb.implementor
Class RuleValueForRangeNonInclusive

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

public class RuleValueForRangeNonInclusive
extends java.lang.Object
implements RuleImplementor

This rule returns a string value based on where a number falls with respect to a range. There are five constants which can be passed to this rule either as firing parameters or as initialization parameters. There is always at least one runtime firing parameter, representing the value to be compared against the range. The range does not include the lower and upper bounds.

The five constants are (in order):

  1. Lower bound of determining range
  2. Upper bound of determining range
  3. Result if the inbound number value is less than or equal to the lower bound
  4. Result if the inbound number value falls in the range, not including the lower and upper bounds
  5. Result if the inbound number value is greater than or equal to the upper bound.

The lower bound, upper bound, and value to compare must be one the following types: java.lang.Integer, java.lang.Long, java.lang.Double, java.lang.Float, java.lang.String, or java.util.Date. A String value will be converted to a Double, if possible, using Double.valueOf(). Otherwise it will be treated as a text string for comparison purposes. An exception is thrown if the values are not one of these types. Also, an exception is thrown if the three values are not compatible for comparison. For example, a Double and a Date are not compatible. The result values can be of any type.


Constructor Summary
RuleValueForRangeNonInclusive()
          RuleValueForRange parameterless constructor.
 
Method Summary
 java.lang.Object fire(TriggerPoint tp, java.lang.Object target, IRuleCopy rule, java.lang.Object[] parms)
          This is where the algorithm implemented by this rule is performed.
 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 constants used by this rule.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RuleValueForRangeNonInclusive

public RuleValueForRangeNonInclusive()
RuleValueForRange parameterless constructor.

Method Detail

fire

public java.lang.Object fire(TriggerPoint tp,
                             java.lang.Object target,
                             IRuleCopy rule,
                             java.lang.Object[] parms)
                      throws BusinessRuleBeansException
This is where the algorithm implemented by this rule is performed. Two alternative signatures are supported, depending on whether this rule was initialized with parameters on the init method or whether the parameters are all passed on the fire method. The first signature takes 6 parameters where the first five represent the constants associated with the rule, and the sixth the number to be evaluated. The other signature contains only one parameter: the number to be evaluated.

The lower bound, upper bound, and value to compare must be one the following types: java.lang.Integer, java.lang.Long, java.lang.Double, java.lang.Float, java.lang.String, or java.util.Date. A String value will be converted to a Double, if possible, using Double.valueOf(). Otherwise it will be treated as a text string for comparison purposes. An exception is thrown if the values are not one of these types. Also, an exception is thrown if the three values are not compatible for comparison. For example, a Double and a Date are not compatible. The result values can be of any type.

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 constants used by this rule. Five initialization parameters can be passed. They are, in order: If no initialization parameters are supplied, then these values can be passed as firing parameters.

The lower bound and upper bound must be one the following types: java.lang.Integer, java.lang.Long, java.lang.Double, java.lang.Float, java.lang.String, or java.util.Date. A String value will be converted to a Double, if possible, using Double.valueOf(). Otherwise it will be treated as a text string for comparison purposes. An exception is thrown if the values are not one of these types. The result values can be of any type.

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