@PublicSpi
public interface EffectorFunction
effect descriptions
, given an item forest and attribute values.Modifier and Type | Method and Description |
---|---|
void |
produceEffects(ItemForest itemForest,
RowValues rowValues,
EffectCollector effectCollector,
ProgressSink progressSink)
The main method in the Effector SPI, which processes an item forest
and produces effect descriptions.
|
void produceEffects(@NotNull ItemForest itemForest, @NotNull RowValues rowValues, @NotNull EffectCollector effectCollector, @NotNull ProgressSink progressSink)
The main method in the Effector SPI, which processes an item forest and produces effect descriptions.
Before calling this method, Structure takes a snapshot of the forest
processed by the current effector invocation (or a sub-forest thereof,
depending on the position of the effector row within the forest) and
tries to calculate consistent
values for all attributes required
by the effector, for all rows in that forest.
Structure then calls this method, which uses the forest and attribute
values to generate effect descriptions, returning them via the provided
EffectCollector
. Please note that it is the responsibility of the
effect
provider
to check item existence and all necessary permissions, as well as
de-duplicate the output and resolve any potential conflicts. Therefore, the
effector function itself can often "fire and forget" effects into the
collector, with only minimal sanity checks, or none at all. However, if
necessary, the function can still report warnings to the user with special
"warning"
effect descriptions.
A ProgressSink
is also provided for reporting progress and
checking cancellation. The function is supposed to initialize
the progress sink in the beginning (e.g. with the size of
itemForest
, if it processes all rows one by one), increment
the progress and check
for
cancellation while it works (typically in the body of its main loop), and
report
completion in the end.
itemForest
- processed item forest (input)rowValues
- required attribute values (input)effectCollector
- collector for the generated effect descriptions (output)progressSink
- used for reporting progress and checking cancellation (input/output)Copyright © 2024 Tempo Software. All Rights Reserved.