[jboss-jira] [JBoss JIRA] (DROOLS-1421) Support multi-argument accumulate functions

Geoffrey De Smet (JIRA) issues at jboss.org
Fri Jan 27 10:42:00 EST 2017


Geoffrey De Smet created DROOLS-1421:
----------------------------------------

             Summary: Support multi-argument accumulate functions
                 Key: DROOLS-1421
                 URL: https://issues.jboss.org/browse/DROOLS-1421
             Project: Drools
          Issue Type: Enhancement
          Components: core engine
    Affects Versions: 6.5.0.Final
            Reporter: Geoffrey De Smet
            Assignee: Mario Fusco


I'd like to be able to do this:

{code}
       accumulate(
            TaskAssignment($person : person, $duration : duration);
            $b : loadBalance($person, $duration)
       )
{code}

This loadBalance function basically does sqrt(sum(squared(sum($duration) per $person))), so it cannot be split up into 2 separate accumulate functions. This loadBalance of fairness function is very common for employee rostering, task assignment (incl jbpm), cloud optimization, etc, so we 'll provide it out of the box.

Internally, the compiler should do some syntactic sugar for DRL
{code}
$b : loadBalance($p, $d)
=> syntactic sugar =>
$b : loadBalance(new Object[]{$p, $d})
{code}

The AccumulateFunction would then get an Object[] instance:

{code}
    public void accumulate(Serializable context, Object o) {
        Object[] value = (Object[]) o;
        ...
    }
{code}

It's ok that the AccumulateFunction is still complex as that's only coded once, but the use of that function is in a lot of user code and examples.



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the jboss-jira mailing list