|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.javasimon.callback.FilterRule
public class FilterRule
Represents filtering rule that checks whether subcallbacks will get the event. Rule can be one of the following types:
FilterRule.Type.MUST - rule MUST be true and following rules are checked
FilterRule.Type.SUFFICE - if this rule is true the filter passes the event to children
otherwise next rules are checked
FilterRule.Type.MUST_NOT - if this rule is true the filter ignores the event, otherwise
next rules are checked
FilterCallback.Rule)| Nested Class Summary | |
|---|---|
static class |
FilterRule.Type
Enumeration of rule types that determines the evaluation of mutliple rules in a chain. |
| Field Summary | |
|---|---|
private String |
condition
|
private static Replacer[] |
CONDITION_REPLACERS
|
private static ScriptEngine |
ECMA_SCRIPT_ENGINE
|
private CompiledScript |
expression
|
private SimonPattern |
pattern
|
private FilterRule.Type |
type
|
static String |
VAR_ACTIVE
Name of the rule variable for number of concurrently active splits of a particular Simon (active). |
static String |
VAR_COUNTER
Name of the rule variable for current value of the counter (counter). |
static String |
VAR_MAX
Name of the rule variable for maximal value of the Simon - stopwatch in ns, counter without unit (max). |
static String |
VAR_MAX_ACTIVE
Name of the rule variable for maximal number of concurrently active splits (maxactive). |
static String |
VAR_MIN
Name of the rule variable for minimal value of the Simon - stopwatch in ns, counter without unit (min). |
static String |
VAR_SPLIT
Name of the rule variable for last split time in ns (split). |
static String |
VAR_TOTAL
Name of the rule variable for total split time (total). |
static String |
VAR_VALUE
Name of the rule variable for increment or decrement value (value). |
| Constructor Summary | |
|---|---|
FilterRule(FilterRule.Type type,
String condition,
SimonPattern pattern)
Creates the rule with a specified type, condition and pattern. |
|
| Method Summary | |
|---|---|
private boolean |
eval(Bindings bindings)
|
String |
getCondition()
Returns the additional condition of this rule. |
SimonPattern |
getPattern()
Retruns the Simon pattern of this rule. |
FilterRule.Type |
getType()
Returns the type of this rule. |
boolean |
checkCondition(Simon simon,
Object... params)
Checks the Simon and optional parameters against the condition specified for a rule. |
private boolean |
checkCounter(Counter counter,
Object... params)
|
private boolean |
checkStopwtach(Stopwatch stopwatch,
Object... params)
|
private void |
processParams(Bindings bindings,
Object... params)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String VAR_SPLIT
public static final String VAR_ACTIVE
public static final String VAR_MAX_ACTIVE
public static final String VAR_COUNTER
public static final String VAR_MAX
public static final String VAR_MIN
public static final String VAR_TOTAL
public static final String VAR_VALUE
private static final ScriptEngine ECMA_SCRIPT_ENGINE
private static final Replacer[] CONDITION_REPLACERS
private FilterRule.Type type
private String condition
private CompiledScript expression
private SimonPattern pattern
| Constructor Detail |
|---|
public FilterRule(FilterRule.Type type,
String condition,
SimonPattern pattern)
Callback.onManagerWarning(String, Exception), Callback.onManagerMessage(String)).
Both condition and pattern are optional and can be null.
type - rule type determining the role of the rule in the chain of the filtercondition - additional conditional expression that must be truepattern - Simon pattern that must match| Method Detail |
|---|
public FilterRule.Type getType()
public String getCondition()
public SimonPattern getPattern()
public boolean checkCondition(Simon simon,
Object... params)
throws ScriptException
simon - related Simonparams - optional parameters, e.g. value that is added to a Counter
ScriptException - possible exception raised by the expression evaluation
private boolean checkCounter(Counter counter,
Object... params)
throws ScriptException
ScriptException
private boolean checkStopwtach(Stopwatch stopwatch,
Object... params)
throws ScriptException
ScriptException
private void processParams(Bindings bindings,
Object... params)
private boolean eval(Bindings bindings)
throws ScriptException
ScriptException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||