It's not a secret anymore!
The moose likes XML and Related Technologies and the fly likes Storing equations in XML? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Storing equations in XML?" Watch "Storing equations in XML?" New topic

Storing equations in XML?

Anthony Smith
Ranch Hand

Joined: Sep 10, 2001
Posts: 285

I am really looking for an open source solution vs. creating anything to do this is possible. This is sort of related to a rules engine of some sort.

Let me just give an example.

I sell candy and I have three factors that make up your price:

If I deliver candy it will cost you a buck $1
If your candy weighs less than 1 pound I only charge you a buck $1
If your candy weighs 1 pound or more but less then 5 pounds I charge you $2
If your candy weighs 5 pounds or more but less than 10 pounds I charge you $2.50
If your candy weighs 10 pounds or more, I charge you $.75 a pound
If you want black candy it is $2, red is $3

You total cost for candy is the delivery charge the weight charge plus the type. If it equals over $5 than I will just charge you $5. SO $5 is the max that I will charge you.

I dont want to put this stuff in java code. I want to be able to update it from tiem to time w/o changing the code... ideas?
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040

I read this post, not ignoring, but can't think of anything off the
top of my head right now.....

- m
Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
How about trying out a real rule engine like one of these or Ernest's JESS?

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
I agree. Here's the link:
subject: Storing equations in XML?
It's not a secret anymore!