Equality and Relational Operators Evaluation
A java infix evaluator based on "Shunting Yard" algorithm.
Brought to you by:
fathzer
Is there any chance of implementing equality and relational operator evaluation? The library is amazing and the smallest one I could check out, but I missed this feature (unless it exists and I haven't seen it). Great software work.
Thanks in advance.
Adalberto José Brasaca
Systems Analyst
aj-brasaca@hotmail.com
Brazil
Anonymous
Hello,
Thanks for the compliments :-)
Unfortunately, my answer will not be the one you expect ...
As you can see in previous tickets, lot of people want their own evaluator (BigDecimal, boolean, vectors, with more functions, etc... or mixed boolean and numbers - like you if I understood well). Some use Javaluator with their own grammars.
That's the reason why Javaluator offers AbstractEvaluator, a generic evaluator, that is doing the hard part (parsing the expression and deals with operators precedence). Javaluator provides DoubleEvaluator as an example of how to implement your own evaluator ... and because working with double is really very very common.
We do not plan to implement other evaluators, but creating your own is quite simple. You can have a look at the tutorial to see examples : http://javaluator.fathzer.com/en/doc/tutorial.php (in your case I think the example in "Creating your own evaluators" will help you).
Best regards,
Jean-Marc
Hi Jean-Marc,
Thanks for your feedback. What I would like to use were the operators "==", "<", "<=", ">" and ">=". I'll take a look at the examples you cited.
Thank you very much.
Adalberto.