|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.process.filter.Filter atg.process.filter.ExpressionFilter atg.projects.b2bstore.scenario.PercentageComparisonFilter
public class PercentageComparisonFilter
A filter class for scenario conditions of the form
value1 [is at least / is at most] ____ percent [greater
than / less than / of] value2
This class expects its evaluate
method to be called with
exactly 5 operands having the following types and semantics:
value1
in the expression above.
ge
for
a greater than or equal to comparison ("is at least" in the
expression above) or le
for a less than or equal
to comparison ("is at most" in the expression above). Any
other value will cause a ProcessException to be thrown when
the condition is evaluated.
gt
if the
expression is "X percent greater than value", or lt
if the expression is "X percent less than value", or
of
if the expression is "X percent of value".
Any other value will cause a ProcessException to be thrown
when the condition is evaluated.
value2
in the expression above.
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
|
protected static int |
COMP_GTE
|
protected static int |
COMP_LTE
|
protected int |
mComparisonType
|
static boolean |
mDebugging
|
protected double |
mPercentage
|
protected int |
mPercentageType
|
protected static int |
PCT_LESS_THAN
|
protected static int |
PCT_MORE_THAN
|
protected static int |
PCT_OF
|
protected static java.util.ResourceBundle |
sDefaultResources
|
Fields inherited from class atg.process.filter.Filter |
---|
FALSE, TRUE |
Constructor Summary | |
---|---|
PercentageComparisonFilter()
|
Method Summary | |
---|---|
protected java.lang.String |
badTypeMsg(int pIndex,
java.lang.String pDescription,
java.lang.Object pValue,
java.lang.String pExpectedClass)
Get the error message to deliver when an operand has the wrong type. |
protected java.lang.String |
errorMsg(java.lang.String pResourceKey)
Get an error message string based on an error message resource key. |
protected java.lang.String |
errorMsg(java.lang.String pResourceKey,
java.lang.Object[] pArgs)
Get a formatted error message string based on an error message resource key and an array of message arguments. |
protected Filter |
evaluate(ProcessExecutionContext pContext)
Evaluates this filter in the given scenario execution context. |
void |
initialize(java.lang.String pOperator,
Expression[] pOperands)
Initializes this ExpressionFilter given its operator and operands. |
protected java.lang.String |
invariantOperandWasNullMsg(int pIndex,
java.lang.String pDescription)
Get the error message to deliver if we cannot compute the value of an operand that is supposed to be invariant in the initialize() method. |
protected java.lang.String |
invariantValueNotAvailableMsg(int pIndex,
java.lang.String pDescription)
Get the error message to deliver if we cannot compute the value of an operand that is supposed to be invariant in the initialize() method. |
Methods inherited from class atg.process.filter.ExpressionFilter |
---|
configure, equals, getOperands, getOperator, operandsEquals, setOperands, setOperator, toString |
Methods inherited from class atg.process.filter.Filter |
---|
andFilters, andFilters, assumeFalse, assumeTrue, createProcessInstanceQuery, createSubjectQuery, getResourceBundle, getSubjectType, hashCode, implies, isCacheable, negate, orFilters, orFilters, setCacheable, test |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static java.lang.String CLASS_VERSION
public static final boolean mDebugging
protected static final int COMP_GTE
protected static final int COMP_LTE
protected static final int PCT_MORE_THAN
protected static final int PCT_LESS_THAN
protected static final int PCT_OF
protected static java.util.ResourceBundle sDefaultResources
protected int mComparisonType
protected int mPercentageType
protected double mPercentage
Constructor Detail |
---|
public PercentageComparisonFilter()
Method Detail |
---|
public void initialize(java.lang.String pOperator, Expression[] pOperands) throws ProcessException
initialize
in class ExpressionFilter
ProcessException
- If any of the operand values is not available or is null
or is an unrecognized constant value.protected Filter evaluate(ProcessExecutionContext pContext) throws ProcessException
evaluate
in class Filter
pContext
- The scenario execution context to use when getting operand
values.
Filter.FALSE if the filter can be fully evaluated and the condition is not satisfied
this
if the filter cannot be fully evaluated
because one or more operand values are not available in the
scenario execution context
null
if the filter cannot be evaluated because
one or more operand values are null
ProcessException
- If any operand has the wrong type or if any String constant
operand has an unrecognized valueprotected java.lang.String errorMsg(java.lang.String pResourceKey)
pResourceKey
- A key that identifies the error message in the MessageResources file.
protected java.lang.String errorMsg(java.lang.String pResourceKey, java.lang.Object[] pArgs)
pResourceKey
- A key that identifies the error message format in the MessageResources
file. The corresponding value will be a java.text.MessageFormat format
string.pArgs
- An array of objects that will be inserted into the format string.
protected java.lang.String invariantValueNotAvailableMsg(int pIndex, java.lang.String pDescription)
pIndex
- The positional index of the operand whose type was wrong.pDescription
- A description of the operand whose type was wrong.
protected java.lang.String invariantOperandWasNullMsg(int pIndex, java.lang.String pDescription)
pIndex
- The positional index of the operand whose type was wrong.pDescription
- A description of the operand whose type was wrong.
protected java.lang.String badTypeMsg(int pIndex, java.lang.String pDescription, java.lang.Object pValue, java.lang.String pExpectedClass)
pIndex
- The positional index of the operand whose type was wrong.pDescription
- A description of the operand whose type was wrong.pValue
- The operand value, used to derive the actual type.pExpectedClass
- The type that pValue was expected to have, e.g. "java.lang.String"
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |