Interface EffectorFunction
effect descriptions, given an item forest and attribute values.-
Method Summary
Modifier and TypeMethodDescriptionvoidproduceEffects(ItemForest itemForest, RowValues rowValues, EffectCollector effectCollector, ProgressSink progressSink) The main method in the Effector SPI, which processes an item forest and produces effect descriptions.
-
Method Details
-
produceEffects
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
consistentvalues for all attributesrequiredby 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 theeffect providerto 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
ProgressSinkis also provided for reporting progress and checking cancellation. The function is supposed toinitializethe progress sink in the beginning (e.g. with the size ofitemForest, if it processes all rows one by one),incrementthe progress andcheckfor cancellation while it works (typically in the body of its main loop), andreportcompletion in the end.- Parameters:
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)
-