Class RuleRegistry<T extends Rule>

  • Type Parameters:
    T - the actual Rule type

    public class RuleRegistry<T extends Rule>
    extends java.lang.Object
    Rule registry that maintains which VElements are affected if a setting is changed.
    Author:
    emueller, jfaltermeier
    • Constructor Detail

      • RuleRegistry

        public RuleRegistry​(ViewModelContext context)
        Default constructor.
        Parameters:
        context - the view model context of the RuleService using this registry
    • Method Detail

      • register

        public java.util.Set<UniqueSetting> register​(VElement renderable,
                                                     T rule,
                                                     Condition condition,
                                                     org.eclipse.emf.ecore.EObject domainModel)
        Creates a setting from the given EObject and the Condition and register it with the VElement.
        Parameters:
        renderable - the VElement to be updated in case the condition changes
        rule - the parent rule holding the Condition
        condition - contains the attribute that the condition is depending on
        domainModel - the domain object that owns the attribute possibly being changed
        Returns:
        the registered UniqueSettings
      • removeRule

        public VElement removeRule​(T rule)
        Removes the given rule from the registry.
        Parameters:
        rule - the rule to be removed
        Returns:
        the VElement that belonged to the removed rule
      • removeRenderable

        public void removeRenderable​(VElement renderable)
        Removes the given VElement from the registry.
        Parameters:
        renderable - the renderable to be removed
      • removeCondition

        public VElement removeCondition​(Condition condition)
        Removes the given condition from the registry.
        Parameters:
        condition - the condition to be removed
        Returns:
        the VElement that belonged to the removed condition
      • getSettings

        public java.util.Set<UniqueSetting> getSettings()
        Returns the settings of this registry.
        Returns:
        the settings of this registry.
      • getAffectedRenderables

        public java.util.Map<T,​VElement> getAffectedRenderables​(UniqueSetting setting)
        Returns all rules that would be affected if the value of given setting is changed.
        Parameters:
        setting - the setting
        Returns:
        a list of VElements that are affected of the setting change
      • dispose

        public void dispose()
        Disposes this RuleRegistry.