[rules-users] Comparing Objects of same class.

Wolfgang Laun wolfgang.laun at gmail.com
Tue Jun 17 11:04:45 EDT 2014


Let S be the (nonempty) set of all students and d the length
of the span of days. There exists a student s0 so that s0.doj
is the minimum over all S. Then accumulate and count students
x over S so that s0.doj <= x.doj and x.doj < s0.doj + d. If this
count exceeds the threshold t: display the students. Finally,
remove all students y from S where y.doj = s0.doj.

Repeat until S is empty.

I don't see any particular reason for doing this in Drools,
although it's feasible with just a handful of rules. But it is
a ridiculously simply exercise in Java.

Does this have any practical value? Students' behaviour is
notoriously erratic. Is this for a brand new branch of
behavioural psychology?!

-W




On 17/06/2014, naresh.t <nareshthota005 at gmail.com> wrote:
> Hi,
>
> more details...
>
> lets take a rule like If any 5 students joined in 5 days of span...
>
> No        Name    DOJ
> 1           A        *5/24*
> 2           B        * 5/25*
> 3           C         *5/27*
> 4           D         *5/23*
> 5           E         5/30
> 6           F         5/20
> 7           G         5/15
>
> If we take, A,B,C and D details, these 4 students are joined in <=5 days of
> span(lowest date :->D:5/23 and highest date :->c:5/27 --> diff is 4 days).
> If any other student joined in these <=5 days (5/23 to 5/27 ) then we need
> those all 5 students details.
>
> If we take F, A, B and D, these 4 students also joined in <= 5 days...but
> no.of 5 students condition is missing.
>
>
> As we said we are able to work on static rules like if student joined
> <=5/23
> & !>=5/30 etc.
>
> Thanks & Regards
>      Naresh
>
>
>
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Comparing-Objects-of-same-class-tp4030073p4030079.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>


More information about the rules-users mailing list