Class AssociatesModel
- java.lang.Object
-
- de.xima.fc.workflow.designer.model.AssociatesModel
-
- All Implemented Interfaces:
Serializable
public final class AssociatesModel extends Object implements Serializable
Stores quantities derived from the current state.By providing the proper dependencies, the derived quantities are recomputed only when that dependency has changed. For example, we only need to recompute the flow analysis when the structure of the node has changed, e.g. when a node was added or moved.
- Since:
- 7.0.0
- Author:
- XIMA MEDIA GmbH
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AssociatesModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> T
associateDeep(Object key, Supplier<T> associateFn, Object... dependencies)
Computes a quantity derived from the given fields of this model.<T> ValueDiff<T>
associateDeepDiff(Object key, Supplier<T> associateFn, Object... dependencies)
Computes a quantity derived from the given fields of this model.<T> T
associateShallow(Object key, Supplier<T> associateFn, Object... dependencies)
Computes a quantity derived from the given fields of this model.<T> ValueDiff<T>
associateShallowDiff(Object key, Supplier<T> associateFn, Object... dependencies)
Computes a quantity derived from the given fields of this model.void
clear()
Clears all stored associates.
-
-
-
Method Detail
-
associateDeep
public <T> T associateDeep(Object key, Supplier<T> associateFn, Object... dependencies)
Computes a quantity derived from the given fields of this model. Internally caches the result until one of the given fields changes.- Type Parameters:
T
- Type of the derived quantity.- Parameters:
key
- Which derived value to compute. The key should be unique for each type of quantity.associateFn
- A function that computes a derived quantity from the process model. This is given the flowchart model as a parameter, but you must not access any fields that were not specified, or you may end up with outdated results.dependencies
- Dependencies for the quantity. When any of these dependencies change (as determined viaObject#equals(Object)
comparison), the quantity is recomputed.- Returns:
- The derived quantity.
-
associateDeepDiff
public <T> ValueDiff<T> associateDeepDiff(Object key, Supplier<T> associateFn, Object... dependencies)
Computes a quantity derived from the given fields of this model. Internally caches the result until one of the given fields changes.- Type Parameters:
T
- Type of the derived quantity.- Parameters:
key
- Which derived value to compute. The key should be unique for each type of quantity.associateFn
- A function that computes a derived quantity from the process model. This is given the flowchart model as a parameter, but you must not access any fields that were not specified, or you may end up with outdated results.dependencies
- Dependencies for the quantity. When any of these dependencies change (as determined viaObject#equals(Object)
comparison), the quantity is recomputed.- Returns:
- The old and new value for the derived quantity, and whether it has changed.
-
associateShallow
public <T> T associateShallow(Object key, Supplier<T> associateFn, Object... dependencies)
Computes a quantity derived from the given fields of this model. Internally caches the result until one of the given fields changes.- Type Parameters:
T
- Type of the derived quantity.- Parameters:
key
- Which derived value to compute. The key should be unique for each type of quantity.associateFn
- A function that computes a derived quantity from the process model. This is given the flowchart model as a parameter, but you must not access any fields that were not specified, or you may end up with outdated results.dependencies
- Dependencies for the quantity. When any of these dependencies change (as determined via a shallow==
comparison), the quantity is recomputed.- Returns:
- The derived quantity.
-
associateShallowDiff
public <T> ValueDiff<T> associateShallowDiff(Object key, Supplier<T> associateFn, Object... dependencies)
Computes a quantity derived from the given fields of this model. Internally caches the result until one of the given fields changes.- Type Parameters:
T
- Type of the derived quantity.- Parameters:
key
- Which derived value to compute. The key should be unique for each type of quantity.associateFn
- A function that computes a derived quantity from the process model. This is given the flowchart model as a parameter, but you must not access any fields that were not specified, or you may end up with outdated results.dependencies
- Dependencies for the quantity. When any of these dependencies change (as determined via a shallow==
comparison), the quantity is recomputed.- Returns:
- The old and new value for the derived quantity, and whether it has changed.
-
clear
public void clear()
Clears all stored associates.
-
-