[rules-users] accumulate min over java.util.Date

Wolfgang Laun wolfgang.laun at gmail.com
Fri Mar 25 11:01:59 EDT 2011


That's why I wrote "don't be hasty" ;-)

accumulate is generic right now: You can code the steps explicitly, or you
can plug in your own accumulate function. Writing "lower" and "upper" for
Comparable (or Date) is a matter of 100 LOC each.

-W



2011/3/25 Greg Barton <greg_barton at yahoo.com>

> Which is why I prefaced with "if it can work that way..." A JIRA can be for
> feature requests, and that's what this would be.  Whether just adding a
> Comparable based accumulate function is the solution, or making accumulate
> generic like "from" is now, a JIRA does not have to specify the solution,
> just the request.
>
> GreG
>
> On Mar 25, 2011, at 4:22, Wolfgang Laun <wolfgang.laun at gmail.com> wrote:
>
> Now don't be hasty with a JIRA. Using Comparable for the arguments of the
> min and max accumulate functions will give you a result that is --
> Comparable. So:
>
>
>   $min: Comparable() from accumulate( Schedule( $d: date ), min( $d ) )
>
> OK, this will give you the minimum data, bound to $min, although it won't
> let you write any constraint for the "Comparable" result fact. But, what's
> worse, it will not let you write
>
>   $min: Number( intValue > 100 ) from accumulate( X( $y: y ), min( $y ) )
>
>
> any more (unless I'm very much mistaken).
>
> -W
>
>
>
> On 25 March 2011 03:56, Greg Barton < <greg_barton at yahoo.com>
> greg_barton at yahoo.com> wrote:
>
>> Well, if it can work that way it should.  I'd say open a JIRA and request
>> that feature.  It works with the "principle of least confusion." :)
>>
>> --- On Thu, 3/24/11, jkrupka < <jkrupka at gmail.com>jkrupka at gmail.com>
>> wrote:
>>
>> > From: jkrupka < <jkrupka at gmail.com>jkrupka at gmail.com>
>> > Subject: Re: [rules-users] accumulate min over java.util.Date
>> > To: <rules-users at lists.jboss.org>rules-users at lists.jboss.org
>> > Date: Thursday, March 24, 2011, 8:26 PM
>> > Yea the docs weren't really clear
>> > about it, so I just thought it would work
>> > for anything that implemented Comparable =)
>> >
>> > Yep, used the long from getTime() - not the prettiest way
>> > of doing it, but
>> > it works great.
>> >
>> > Thanks!
>> >
>> > --
>> > View this message in context:
>> <http://drools-java-rules-engine.46999.n3.nabble.com/accumulate-min-over-java-util-Date-tp2726081p2728477.html>
>> http://drools-java-rules-engine.46999.n3.nabble.com/accumulate-min-over-java-util-Date-tp2726081p2728477.html
>>
>> > Sent from the Drools - User mailing list archive at
>> > Nabble.com.
>> > _______________________________________________
>> > rules-users mailing list
>> > <rules-users at lists.jboss.org>rules-users at lists.jboss.org
>> > <https://lists.jboss.org/mailman/listinfo/rules-users>
>> https://lists.jboss.org/mailman/listinfo/rules-users
>> >
>>
>>
>>
>> _______________________________________________
>> rules-users mailing list
>>  <rules-users at lists.jboss.org>rules-users at lists.jboss.org
>>  <https://lists.jboss.org/mailman/listinfo/rules-users>
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110325/3edacbe0/attachment.html 


More information about the rules-users mailing list