j-easy / easy-rules

The simple, stupid rules engine for Java
https://github.com/j-easy/easy-rules/wiki
MIT License
4.86k stars 1.05k forks source link

question: appropriateness of easy-rules? #373

Open SoundSoftware opened 2 years ago

SoundSoftware commented 2 years ago

hi,

i'm new to easy rules. its simplicity is very appealing.

i have a candidate problem to solve: our boat club allocates docks based on member seniority. applications (bids) are submitted when a dock becomes available. when bids are submitted they will have a seniority number as an attribute. so the problem is to find the bid with the lowest seniority number.

so in psuedo code the rule might be:

rule seniorityRule

when fact/bid has seniority number < currentLowNumber
then replace currentLowNumber with currentBidNumber

easy-rules appears to be well suited to rules which involve a condition referencing a constant not rules which compare a fact to a fact.

so here are my questions: 1) where should i hold the currentLowNumber (as a fact or somewhere else? if it's a fact when/where do i retrieve it to compare? thru a listener before the rule executes?) 2) how is the search terminated? thru another rule like:

rule bidWinner when there doesn't exist a bid with a lower seniority <== not sure how to code or it's even possible
then display "and the winner is member with " currentLowNumber

any ideas/direction would be appreciated

john cummings