Class 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 Detail

      • AssociatesModel

        public AssociatesModel()
    • 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 via Object#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 via Object#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.