["step" etc is explained in http://markproctor.blogspot.com/2007/06/local-search-101.html ]

Currently I have something like this

interface ScoreCalculator {
   double calculateScore(...);
}

This used to be stateless, but now it needs to be statefull,
because some score calculators change the weight of constraints between steps. This also means that some ScoreCalculators need to get notified when a step is decided.

So I see 2 ways of implementing this:

1) extend the interface:

interface ScoreCalculator {
   double calculateScore(...);
   void stepTaken(...);
}

2) Start introducing Listeners:

interface StepListener {
   void stepTaken(StepEvent event);
}

if (scoreCalculater instanceof StepListener) {
   stepEventFireThingy.add((StepListener) scoreCalculater);
}

Which one would you prefer?

--
With kind regards,
Geoffrey De Smet

_______________________________________________
rules-dev mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-dev

Reply via email to