Class NFEMemoryRuleHandlerContext

  • All Implemented Interfaces:
    NFERuleHandlerContext

    public class NFEMemoryRuleHandlerContext
    extends java.lang.Object
    implements NFERuleHandlerContext
    In-memory implementation of a rule handler context. Internally it uses the current NFE model instance to perform most of its tasks.
    • Method Detail

      • getAvailableConnections

        public int[] getAvailableConnections​(NFEFeatureElement pointFeatElem)
        Description copied from interface: NFERuleHandlerContext
        Gets the number of available connections for the given point feature element. The number of available connections are calculated based on the cardinality defined for the point's feature class. Virtual connections made by the handler are considered as actual connections.
        Specified by:
        getAvailableConnections in interface NFERuleHandlerContext
        Parameters:
        pointFeatElem - a point feature element
        Returns:
        a two-element array with the number of available in and out connections at the position 0 and 1 respectively
      • getUsedConnections

        public int[] getUsedConnections​(NFEFeatureElement pointFeatElem,
                                        long lineFeatLayerId,
                                        long lineFeatClassId)
        Description copied from interface: NFERuleHandlerContext
        Gets the number of in an out connections the given point contains with lines of the specified feature layer and feature class. Virtual connections performed by the handler are considered.
        Specified by:
        getUsedConnections in interface NFERuleHandlerContext
        Returns:
        a two-element array with the number of used in and out connections at the position 0 and 1 respectively
      • connectionExists

        public boolean connectionExists​(NFEFeatureElement featElem1,
                                        NFEFeatureElement featElem2)
        Description copied from interface: NFERuleHandlerContext
        Tells whether the given feature elements are connected. A Line and point are considered connected when their underlying link and node are connected. Points are considered connected if they are connected to the same underlying link. Lines are considered connected if they are connected to the same underlying node.
        Specified by:
        connectionExists in interface NFERuleHandlerContext
        Parameters:
        featElem1 - a feature element
        featElem2 - a feature element
        Returns:
        true if the elements are connected
      • inConnectionExists

        public boolean inConnectionExists​(NFEFeatureElement pointFeatElem,
                                          NFEFeatureElement lineFeatElem)
        Description copied from interface: NFERuleHandlerContext
        Tells whether the line feature element is an incoming connection of the point feature element
        Specified by:
        inConnectionExists in interface NFERuleHandlerContext
        Parameters:
        pointFeatElem - a point feature element
        lineFeatElem - a line feature element
        Returns:
        true if the line is an in-connection
      • outConnectionExists

        public boolean outConnectionExists​(NFEFeatureElement pointFeatElem,
                                           NFEFeatureElement lineFeatElem)
        Description copied from interface: NFERuleHandlerContext
        Tells whether the line feature element is an outgoing connection of the point feature element
        Specified by:
        outConnectionExists in interface NFERuleHandlerContext
        Parameters:
        pointFeatElem - a point feature element
        lineFeatElem - a line feature element
        Returns:
        true if the line is an out-connection
      • reserveInConnection

        public boolean reserveInConnection​(NFEFeatureElement pointFeatElem,
                                           NFEFeatureElement lineFeatElem)
        Description copied from interface: NFERuleHandlerContext
        Creates a virtual in connection between the point and line feature element. A virtual connection only exists in the handler context. No rule handler can see virtual connections made by another handler, unless, the contexts are nested due to nested handler calls.
        Specified by:
        reserveInConnection in interface NFERuleHandlerContext
        Parameters:
        pointFeatElem - a point feature element
        lineFeatElem - a line feature element
        Returns:
        true if the virtual connection could be performed.
      • reserveOutConnection

        public boolean reserveOutConnection​(NFEFeatureElement pointFeatElem,
                                            NFEFeatureElement lineFeatElem)
        Description copied from interface: NFERuleHandlerContext
        Creates a virtual out connection between the point and line feature element. A virtual connection only exists in the handler context. No rule handler can see virtual connections made by another handler, unless, the contexts are nested due to nested handler calls.
        Specified by:
        reserveOutConnection in interface NFERuleHandlerContext
        Parameters:
        pointFeatElem - a point feature element
        lineFeatElem - a line feature element
        Returns:
        true if the virtual connection could be performed.
      • requestDefaultPointFeatureElement

        public NFEFeatureElement requestDefaultPointFeatureElement​(JGeometry pointGeom)
        Description copied from interface: NFERuleHandlerContext
        Creates a new standalone point feature element with the given point geometry. The new only can be created if the handler's rule is allowed to create a default point. The characteristics of the new point such as feature layer and feature class are also given by the handler's rule. The created point is considered standalone, that is, it is not included in any of the model's feature layers.
        Specified by:
        requestDefaultPointFeatureElement in interface NFERuleHandlerContext
        Parameters:
        pointGeom - a point geometry
        Returns:
        a new standalone point feature element or null if the rule does not specify the creation of a default point
      • isStandaloneFeatureElement

        public boolean isStandaloneFeatureElement​(NFEFeatureElement featElem)
        Description copied from interface: NFERuleHandlerContext
        Thells whether the feature element is standalone. A feature element is standalone if it is not included in any of the model's feature layers
        Specified by:
        isStandaloneFeatureElement in interface NFERuleHandlerContext
        Parameters:
        featElem - a feature element
        Returns:
        true if the feature element is standalone