[rules-users] check if a Enum object is present in condition

Martin A wmlsub at gmail.com
Sat Oct 22 15:27:44 EDT 2011


Hi, Ansgar,

Thanks for your prompt response :) I was actually referring to enum
literals. Now it works!

Thanks,
Martin

2011/10/22 Ansgar Konermann <ansgar.konermann at googlemail.com>

>
> Am 22.10.2011 20:28 schrieb "Martin A" <wmlsub at gmail.com>:
>
> >
> > Hello,
> >
> > I try to put a condition in my LHS, such as:
> >
> > rule "initial_playground_dialog"
> >     #agenda-group "firstTimeUser"
> >     #salience 99
> >     when
> >         $gst :
> GameStateController(!hasEventOccurred("initial_playground_dialog"))
> >         $list : List()
> >         $screen : FrontendScreen.PLAYGROUND
> >     then
> >        ....
> > end
> >
> > where 'FrontendScreen' is an enum and PLAYGROUND is its property.
>
> Is it actually a property of an enum or rather one of the enum literals?
>
> If it is actually a property, you will need to obtain an instance of the
> FrontendScreen enum first. If PLAYGROUND is actually an enum literal and you
> want to bind this literal to a variable, use:
>
> $screen: FrontendScreen( this == FrontendScreen.PLAYGROUND )
>
> Regards
>
> Ansgar
>
> > However I get a syntax error. What's the proper way to check for and
> assign such a session object?
> >
> > Any help is appreciated!
> >
> > Best regards,
> > Martin
> >
> > _______________________________________________
> > rules-users mailing list
> > rules-users at lists.jboss.org
> > https://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/20111022/6edf67a4/attachment.html 


More information about the rules-users mailing list