[rules-users] Newbie question on accessing predecessor and successor in a list
CSchr
christian.schrinner at sbb.ch
Mon Nov 3 10:56:05 EST 2008
Hi everyone!
I'm relatively new to Drools and rule languages.
I'm wondering if it is possible to access the predecessor and successor in a
match using from operator on an (Array)List. I have something like this
(simplified):
...
$segment : Segment( countries contains Country.Switzerland && ... ) from
$journey.segmentList
$preSegment : Segment ( indexOf(this) == indexOf($segment) - 1,
countries not contains Country.Switzerland && ...
) from $journey.segmentList
I need something like indexOf() for the exact predecessor of the matched
segment.
If the matched business object was an element of a double linked list it
would be easy. Unfortunately I don't have the luxury to change the business
object into knowing it's predecessor or successor. I have to prove that we
could write our java coded business rules in Drools rule language without
changing the business object model.
Thanks in advance,
Chris
--
View this message in context: http://www.nabble.com/Newbie-question-on-accessing-predecessor-and-successor-in-a-list-tp20302694p20302694.html
Sent from the drools - user mailing list archive at Nabble.com.
More information about the rules-users
mailing list