Using DSL Grammar
Using DSL grammar, you can combine different behaviours in intuitive ways to bring out functionality while creating custom profiler rules.
The two behaviors available in this framework are as follows:
falseIdentity- Always evaluates to false, regardless of the input.
trueIdentity- Always evaluates to true, regardless of the input.
These two behaviors are used in the following examples and descriptions.
Binary AND operator
And works the same way it does other languages. Hence following observations.
falseIdentity and trueIdentity == falseIdentity
falseIdentity and falseIdentity == falseIdentity
trueIdentity and trueIdentity == trueIdentity
trueIdentity and falseIdentity == falseIdentity
Here we are using == to show their equality.
Binary OR operator
The or operator works the same way it does in other languages.
falseIdentity or trueIdentity == trueIdentity
falseIdentity or falseIdentity == falseIdentity
trueIdentity or trueIdentity == trueIdentity
trueIdentity or falseIdentity == trueIdentity
Expand DSL to use as follows.
val rule1= falseIdentity and trueIdentity and trueIdentity
val rule2= trueIdentity and trueIdentity and trueIdentity
val rule3=rule1 and rule2
rule3 or trueIdentity
The above expression evaluates to true.