K - the type of the Map entry keysV - the type of the Map entry valuesP - the type of the partial resultR - the type of the final resultpublic class ScriptAggregator<K,V,P,R> extends AbstractScript implements InvocableMap.StreamingAggregator<K,V,P,R>, SerializationSupport
InvocableMap.StreamingAggregator that wraps a script written
in one of the languages supported by Graal VM.m_aoArgs, m_sLanguage, m_sNameALLOW_INCONSISTENCIES, BY_MEMBER, BY_PARTITION, PARALLEL, PRESENT_ONLY, RETAINS_ENTRIES, SERIAL| Constructor and Description |
|---|
ScriptAggregator()
Default constructor for ExternalizableLite.
|
ScriptAggregator(String language,
String name,
int characteristics,
Object... args)
Create a
InvocableMap.StreamingAggregator that wraps the specified script. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
accumulate(InvocableMap.Entry<? extends K,? extends V> entry)
Accumulate one entry into the result.
|
int |
characteristics()
A bit mask representing the set of characteristics of this aggregator.
|
boolean |
combine(P partialResult)
Merge another partial result into the result.
|
R |
finalizeResult()
Return the final result of the aggregation.
|
P |
getPartialResult()
Return the partial result of the aggregation.
|
void |
readExternal(DataInput in)
Restore the contents of this object by loading the object's state from
the passed DataInput object.
|
void |
readExternal(PofReader in)
Restore the contents of a user type instance by reading its state using
the specified PofReader object.
|
Object |
readResolve()
Designate a replacement for an object after an instance of it is read from
the buffer.
|
InvocableMap.StreamingAggregator<K,V,P,R> |
supply()
Create a new instance of this aggregator.
|
void |
writeExternal(DataOutput out)
Save the contents of this object by storing the object's state into
the passed DataOutput object.
|
void |
writeExternal(PofWriter out)
Save the contents of a POF user type instance by writing its state using
the specified PofWriter object.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaccumulate, aggregate, isAllowInconsistencies, isByMember, isByPartition, isParallel, isPresentOnly, isRetainsEntries, isSerialwriteReplacepublic ScriptAggregator()
public ScriptAggregator(String language, String name, int characteristics, Object... args)
InvocableMap.StreamingAggregator that wraps the specified script.language - the language the script is written.name - the name of the Filter that needs to
be evaluatedcharacteristics - a bit mask representing the set of characteristics
of this aggregatorargs - the arguments to be passed to the script during
evaluationpublic int characteristics()
InvocableMap.StreamingAggregator
Be default, characteristics are a combination of InvocableMap.StreamingAggregator.PARALLEL
and InvocableMap.StreamingAggregator.RETAINS_ENTRIES, which is sub-optimal and should be
overridden by the aggregator implementation if the aggregator does not
need to retain entries (which is often the case).
characteristics in interface InvocableMap.StreamingAggregator<K,V,P,R>InvocableMap.StreamingAggregator.PARALLEL,
InvocableMap.StreamingAggregator.SERIAL,
InvocableMap.StreamingAggregator.BY_MEMBER,
InvocableMap.StreamingAggregator.BY_PARTITION,
InvocableMap.StreamingAggregator.RETAINS_ENTRIES,
InvocableMap.StreamingAggregator.PRESENT_ONLYpublic InvocableMap.StreamingAggregator<K,V,P,R> supply()
InvocableMap.StreamingAggregatorpublic boolean accumulate(InvocableMap.Entry<? extends K,? extends V> entry)
InvocableMap.StreamingAggregatoraccumulate in interface InvocableMap.StreamingAggregator<K,V,P,R>entry - the entry to accumulate into the aggregation resulttrue to continue the aggregation, and false to
signal to the caller that the result is ready and the
aggregation can be short-circuitedpublic boolean combine(P partialResult)
InvocableMap.StreamingAggregatorpublic P getPartialResult()
InvocableMap.StreamingAggregatorgetPartialResult in interface InvocableMap.StreamingAggregator<K,V,P,R>public R finalizeResult()
InvocableMap.StreamingAggregatorfinalizeResult in interface InvocableMap.StreamingAggregator<K,V,P,R>public void readExternal(PofReader in) throws IOException
PortableObjectreadExternal in interface PortableObjectreadExternal in class AbstractScriptin - the PofReader from which to read the object's stateIOException - if an I/O error occurspublic void writeExternal(PofWriter out) throws IOException
PortableObjectwriteExternal in interface PortableObjectwriteExternal in class AbstractScriptout - the PofWriter to which to write the object's stateIOException - if an I/O error occurspublic void readExternal(DataInput in) throws IOException
ExternalizableLitereadExternal in interface ExternalizableLitereadExternal in class AbstractScriptin - the DataInput stream to read data from in order to restore
the state of this objectIOException - if an I/O exception occursNotActiveException - if the object is not in its initial
state, and therefore cannot be deserialized intopublic void writeExternal(DataOutput out) throws IOException
ExternalizableLitewriteExternal in interface ExternalizableLitewriteExternal in class AbstractScriptout - the DataOutput stream to write the state of this object toIOException - if an I/O exception occurspublic Object readResolve() throws ObjectStreamException
SerializationSupport
This method is invoked by the Serializer if the object implements
SerializationSupport interface.
readResolve in interface SerializationSupportObjectStreamException