Reputation: 370
Lets say I have an object type MyObject
with member data someValue
and otherValue
and I insert two logical rules as follows:
Rule "Checks Some Value"
when
$myO : MyObject( someValue == Constants.someValueChecker )
then
insertLogical(new SomeValueChecked($myO));
end
Rule "Checks Other Value"
when
$myO : MyObject( otherValue == Constants.otherValueChecker )
then
insertLogical(new OtherValueChecked($myO));
end
My question is, is there a way to verify whether these rules have fired for the same instance of MyObject? Also, is there a way to, given a particular instance of MyObject, know if these rules have fired for it?
Upvotes: 0
Views: 704
Reputation: 31290
To verify that both "some" and "other" value have been checked for the same object (and assuming that the reference to MyObject
is kept in member myObject
):
rule "some and other value"
when
SomeValueChecked( $obj: myObject )
OtherValueChecked( myObject == $obj )
then
...
end
And for checking whether both have fired for a particular instance of MyObject
:
rule "some and other checked for green"
when
$obj: MyObject( color == Colour.GREEN ) // or some other property
SomeValueChecked( myObject == $obj )
OtherValueChecked( myObject == $obj )
then
...
end
It should be obvious what is required to check for "some" or "other" alone.
Upvotes: 1