Class AssociatesModel
java.lang.Object
de.xima.fc.workflow.designer.model.AssociatesModel
- All Implemented Interfaces:
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:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<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.
-
Constructor Details
-
AssociatesModel
public AssociatesModel()
-
-
Method Details
-
associateDeep
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
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.
-