check on null using boolean expressions

32 views
Skip to first unread message

werner...@googlemail.com

unread,
Jun 9, 2009, 5:09:59 AM6/9/09
to Jep Users
Hi folks,

in our project, we require a check on null values within String-
expressions returning a boolean result.

This should look like
Jep jep = new Jep();
jep.parse("x is null");
Boolean result = (Boolean) jep.evaluate();

I went through the discussions but did not find an appropriate issue.
It this poosible at all using jep? There is an existing class "IsNull"
however, I would prefer using the expression like shown above or a
similar solution.


Thanks in advance


Werner

Richard Morris

unread,
Jun 18, 2009, 11:38:17 AM6/18/09
to jep-...@googlegroups.com

Hi Werner,
Sorry for delay in replying, I was away last week.

Yes it should be possible to do something like "x is null". You would
need the ConfigurableParser to do it which makes things easier to adjust
the syntax required. You would then need to create a new operator "is"
see http://www.singularsys.com/jep/doc/html/operators.html
this operator would take two arguments the second of which would always
be null. The PFMC for the operator would test its first argument to
check that it was null.

Hope thats of help

Rich


--
Richard Morris
Web: www.singsurf.org www.pfaf.org
Email: ri...@singsurf.org
Tel: (+44) 01208 872963
Post: 1 Lerryn View, Lerryn, Lostwithiel, Cornwall, PL22 0QJ

Reply all
Reply to author
Forward
0 new messages