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

2011-10-22 Thread Martin A
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. 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@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


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

2011-10-22 Thread Ansgar Konermann
Am 22.10.2011 20:28 schrieb Martin A wml...@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@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


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

2011-10-22 Thread Martin A
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.konerm...@googlemail.com


 Am 22.10.2011 20:28 schrieb Martin A wml...@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@lists.jboss.org
  https://lists.jboss.org/mailman/listinfo/rules-users
 


 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users