[rules-users] check if a
Wolfgang Laun
wolfgang.laun at gmail.com
Mon Nov 1 12:05:02 EDT 2010
As you have posted before, you can use the evaluator by referring to the
field in a previously bound fact.
$object : MyObject ( activated == false,
$name : name,
$firstValue : firstValue,
$valueList : valueList )
// getting the event representing the Value object
$firstValueEvent: Value( this == $firstValue )
$newValue: Value ( name == $name
&& this != $firstValueEvent
&& this after[0ms,1h]
$firstValueEvent
&& $object.parameterValueList not
contains this
&& $object.valueList not contains
this ### ###
&& eval(valueExceededLimit(this)) )
I've tried to invert the order. Check carefully, I may have missed a trick
;-)
$newValue: Value ( $name : name, eval(valueExceededLimit(this)) )
$object : MyObject ( activated == false,
name == $name,
$firstValue: firstValue != $newValue,
parameterValueList not contains $newValue,
valueList not contains $newValue,
$firstValueEvent: Value( this == $firstValue && != $newValue,
this before[0ms,1h] $newValue )
-W
2010/11/1 Tina Vießmann <tviessmann at stud.hs-bremen.de>
> I understand why the order needs to be inverted. But that results in the
> inversion of the whole condition. I'm not sure how to revert the condition.
> The complete condition without 'not contains' and inversion is:
>
> $object : MyObject ( activated == false,
> $name : name,
> $firstValue : firstValue,
> $valueList : valueList )
>
> // getting the event representing the Value object
> $firstValueEvent: Value( this == $firstValue )
>
> $newValue: Value ( name == $name
> && this != $firstValueEvent
> && this after[0ms,1h]
> $firstValueEvent
> && $object.parameterValueList not
> contains $newValue
> && eval(
> !($valueList.contains($newValue))
> &&
> valueExceededLimit($newValue)) )
>
>
>
>
>
>
> To use not contains, you'll have to invert the order of the patterns:
> $ value : Value ( // other restrictions )
> $object : MyObject ( $valueList : valueList not contains $value )
> This will use the evaluator which should be more efficient than eval()
> -W
>
>
> 2010/11/1 Mauricio Salatino <salaboy at gmail.com>
>
>> can you try with
>> $valueList not contains $value
>> but internally I suppose that it will work in the same way that the eval.
>>
>>
>> On Mon, Nov 1, 2010 at 11:55 AM, Tina Vießmann <
>> tviessmann at stud.hs-bremen.de> wrote:
>>
>>> Is it possible to write the following conditions without using eval?
>>>
>>>
>>> $object : MyObject ( $valueList : valueList ) // of type List
>>> $ value : Value ( // other restrictions
>>> && eval( !($valueList.contains($value)) ) )
>>>
>>>
>>> Thank you :)
>>> Tina
>>> _______________________________________________
>>> rules-users mailing list
>>> rules-users at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>>
>>
>>
>> --
>> - CTO @ http://www.plugtree.com
>> - MyJourney @ http://salaboy.wordpress.com
>> - Co-Founder @ http://www.jbug.com.ar
>>
>> - Salatino "Salaboy" Mauricio -
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
> _______________________________________________
> rules-users mailing listrules-users at lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20101101/22a15ec9/attachment.html
More information about the rules-users
mailing list