public class CollectSetAccumulateFunction extends AbstractAccumulateFunction
An implementation of an accumulator capable of collecting sets of values. This is similar to the "collect" CE, but allows us to collect any value, not only facts.
Example:
rule "Set of unique employee names"
when
$names : Set() from accumulate(
Employee( $n : firstName, $l : lastName ),
collectSet( $n + " " + $l ) )
then
// do something
end
The set obviously does not computes duplications and the order of the elements in the set is not guaranteed.
| Modifier and Type | Class and Description |
|---|---|
static class |
CollectSetAccumulateFunction.CollectListData |
| Constructor and Description |
|---|
CollectSetAccumulateFunction() |
| Modifier and Type | Method and Description |
|---|---|
void |
accumulate(Serializable context,
Object value) |
Serializable |
createContext() |
Object |
getResult(Serializable context) |
Class<?> |
getResultType() |
void |
init(Serializable context) |
void |
readExternal(ObjectInput in) |
void |
reverse(Serializable context,
Object value) |
boolean |
supportsReverse() |
void |
writeExternal(ObjectOutput out) |
equals, hashCodepublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic void writeExternal(ObjectOutput out) throws IOException
IOExceptionpublic Serializable createContext()
public void init(Serializable context) throws Exception
Exceptionpublic void accumulate(Serializable context, Object value)
public void reverse(Serializable context, Object value) throws Exception
Exceptionpublic Object getResult(Serializable context) throws Exception
Exceptionpublic boolean supportsReverse()
public Class<?> getResultType()
Copyright © 2001–2017 JBoss by Red Hat. All rights reserved.