Class NFERulesModel

  • All Implemented Interfaces:
    java.util.EventListener, NFEModelListener

    public class NFERulesModel
    extends java.lang.Object
    implements NFEModelListener
    NFE component used as a holder and manager of rules. Components interested on events related to rules instances should be subscribed to the NFERulesModels as NFEModelListeners.
    • Constructor Detail

      • NFERulesModel

        public NFERulesModel​(NFEModel model)
        Creates a new instance of NFERulesModel
        Parameters:
        model - the current NFE model
    • Method Detail

      • getModel

        public NFEModel getModel()
        Gets the NFE model associated to the rules model
        Returns:
        an NFE model instance
      • addConnectivityRules

        public void addConnectivityRules​(java.util.Collection<? extends NFEConnectivityRule> rules)
        Adds all the connectivity rules to the rules model.
        Parameters:
        rules - a collection containing connectivity rule implementations
      • addLinePointRule

        public void addLinePointRule​(NFELinePointRule lpRule)
        Adds a line-point rule to the rules model
        Parameters:
        lpRule - a line-point rule
      • removeLinePointRule

        public boolean removeLinePointRule​(NFELinePointRule lpRule)
        Removes the given line-point rule from the model
        Parameters:
        lpRule - a line-point rule
        Returns:
        true if the rule could be removed
      • getLinePointRules

        public java.util.Collection<NFELinePointRule> getLinePointRules()
        Gets all the line-point rules contained in the rules model
        Returns:
        a collection containing line-point rules
      • addLineLineRule

        public void addLineLineRule​(NFELineLineRule llRule)
        Adds a line-line rule to the rules model
        Parameters:
        llRule - a line-line rule
      • getLineLineRules

        public java.util.Collection<NFELineLineRule> getLineLineRules()
        Gets all the line-line rules contained in the rules model
        Returns:
        a line-line rule
      • removeLineLineRule

        public boolean removeLineLineRule​(NFELineLineRule llRule)
        Removes the given line-line rule
        Parameters:
        llRule - a line-line rule from the model
        Returns:
        true if the rule could be removed
      • addCardinalityRules

        public void addCardinalityRules​(java.util.Collection<NFECardinalityRule> cardRules)
        Adds all the cardinality rules to the rules model
        Parameters:
        cardRules - a collection containing cardinality rules
      • addCardinalityRule

        public void addCardinalityRule​(NFECardinalityRule cardRule)
        Adds a cardinality rule to the rules model
        Parameters:
        cardRule - a cardinality rule
      • getCardinalityRules

        public java.util.Collection<NFECardinalityRule> getCardinalityRules()
        Gets all the cardinality rules contained in the rules model
        Returns:
        a collection containing cardinality rules
      • getCardinalityRule

        public NFECardinalityRule getCardinalityRule​(NFEFeatureClass featClass)
        Gets cardinality rule applicable for the given feature class
        Parameters:
        featClass - a feature class
        Returns:
        a cardinality rule or null if the feature class does not have any cardinality rule
      • removeCardinalityRule

        public boolean removeCardinalityRule​(NFECardinalityRule cardRule)
        Removes a cardinality rule from the model
        Parameters:
        cardRule - a cardinality rule
        Returns:
        true if the rule could be removed
      • addRuleInstance

        public boolean addRuleInstance​(NFERuleInstance ruleInstance)
        Adds a new rule instance to the rule model
        Parameters:
        ruleInstance - a rule instance
        Returns:
        true if the rule could be added to the model
      • removeRuleInstance

        public NFERuleInstance removeRuleInstance​(long ruleInstanceId)
        Removes from the rules model the rule instance identified by the given id
        Parameters:
        ruleInstanceId - a rule instance id
        Returns:
        true if the rule instance could be removed
      • getRuleInstance

        public NFERuleInstance getRuleInstance​(long ruleInstanceId)
        Gets the rule instance identified by the given id
        Parameters:
        ruleInstanceId - a rule instance id
        Returns:
        a rule instance
      • getRuleInstances

        public java.util.Collection<NFERuleInstance> getRuleInstances​(NFEFeatureElement featElem)
        Gets all the rule instances associated to the given feature element
        Parameters:
        featElem - a feature element
        Returns:
        a collection of rule instances
      • getRuleInstances

        public java.util.Collection<NFERuleInstance> getRuleInstances​(NFEFeatureElement featElem,
                                                                      NFEConnectivityRule.ConnectivityRuleType type)
        Gets all the rule instances associated to the given feature element and created by a connectivity rule of the specified type
        Parameters:
        featElem - a feature element
        type - a connectivity rule type
        Returns:
        a collection of rule instances
      • addModelListener

        public void addModelListener​(NFEModelListener listener)
        Subscribes a model listener to receive events about rule instances
        Parameters:
        listener - a model listener implementation
      • removeModelListener

        public void removeModelListener​(NFEModelListener listener)
        Removes a model listener
        Parameters:
        listener - a model listener implementation
      • notifyModelObjectAdded

        protected void notifyModelObjectAdded​(java.lang.Object modelObject)
      • notifyModelObjectRemoved

        protected void notifyModelObjectRemoved​(java.lang.Object modelObject)
      • modelObjectsAdded

        public void modelObjectsAdded​(NFEModelObjectsEvent event)
        Description copied from interface: NFEModelListener
        Invoked when one or more model objects have been added
        Specified by:
        modelObjectsAdded in interface NFEModelListener
        Parameters:
        event - contains a collection of references to the model objects that have been added
      • modelObjectsRemoved

        public void modelObjectsRemoved​(NFEModelObjectsEvent event)
        Description copied from interface: NFEModelListener
        Invoked when one or more model objects have been removed
        Specified by:
        modelObjectsRemoved in interface NFEModelListener
        Parameters:
        event - contains a collection of references to the model objects that have been removed
      • transferRuleInstances

        public void transferRuleInstances​(NFEFeatureElement srcFeatElem,
                                          NFEFeatureElement dstFeatElem)
        Associates to dstFeatElem all the rule instances associated to srcFeatElem. Also removes the associations with srcFeatElem
        Parameters:
        srcFeatElem - the feature element from which the rule instances want to be moved
        dstFeatElem - the feature element which will be associated to the rule instances