Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Boolean Expression Evaluation Framework

 
Priyanka Dandekar
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We are looking for an expression evaluation framework where we can provide input as boolean conditions like this

(MyData1 = 'A') AND (MyData2 = 'B' OR MyData2 = 'C' OR MyData2 = 'D')


I would be getting a String expression and would provide the data to that expression to find what will be the result.

Any suggestions of pointers would be appreciated.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't recall if it supports exactly this syntax, but check out the JEP library. Version 2.4 was released under the GPL, so you may be able to use it for free.
 
Sachin Joshi
Ranch Hand
Posts: 83
Java Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JEP is a good Java library, and its 2.4.1 version was GPL.

The Boolean expressions are supported but it does not give direct boolean result.

The results of a boolean expression would be returned to you as a Double object where 1.0 = TRUE and 0.0 is FALSE.


The Boolean Expression Evaluation Example code can be used as a Utility in your application for Boolean expression evaluation.
[ September 22, 2008: Message edited by: Sachin Joshi ]
 
Priyanka Dandekar
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf and Sachin, thanks a lot for your responses. This is definitely useful for me.

Sachin I am using your util class for implementation, it looks handy.
 
mohan pusarla
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
If i can understand you correctly Your system always get the expression at the Run time and the values to be replaced in the expression also comes in run time. Recently i was also in search of looking for a similar framework approach. I found cayenne framework..you can use it very easily.Reply me back if you have any queries.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mohan,
can you provide a link to this "cayenne" framework? The only Java project with that name I can find is an ORM tool, and I don't think that would be applicable here.
 
Gupta Mohit Gupta
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check http://code.google.com/p/xpressionengine/. It may cater the requirements.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic