Class NFENetworkElement

  • All Implemented Interfaces:
    NFEModelObject
    Direct Known Subclasses:
    NFELink, NFENode

    public abstract class NFENetworkElement
    extends NFEBasicModelObject
    This is the base class for nodes and links. It contains methods and properties common to both types of network elements.
    • Constructor Detail

      • NFENetworkElement

        public NFENetworkElement()
    • Method Detail

      • setId

        public void setId​(long id)
        Sets the ID of the network element
        Parameters:
        id - a node or link ID
      • getId

        public long getId()
        Gets the ID of the network element
        Returns:
        a node or link ID
      • setName

        public void setName​(java.lang.String name)
        Sets the name of the network element
        Parameters:
        name - the network element's name
      • getName

        public java.lang.String getName()
        Gets the network element's name
        Returns:
        the network element's name
      • setActive

        public void setActive​(boolean active)
        Sets the network element as active or inactive
        Parameters:
        active - a boolean value indicating whether the network element is active or not
      • isActive

        public boolean isActive()
        Tells whether the network element is active or not
        Returns:
        a boolean value indicating whether the network element is active or not
      • setCost

        public void setCost​(double cost)
        Sets the cost of the network element
        Parameters:
        cost - the network element's cost
      • getCost

        public double getCost()
        Gets the cost of the network element
        Returns:
        the network element's cost
      • setGeometry

        public void setGeometry​(JGeometry geometry)
        Sets the network element's geometry
        Parameters:
        geometry - a line string geometry for links, a point geometry for nodes
      • getGeometry

        public JGeometry getGeometry()
        gets the network element's geometry
        Returns:
        a line string geometry for links, a point geometry for nodes
      • setNetwork

        public void setNetwork​(NFENetwork network)
        Sets the network to which the network element belongs
        Parameters:
        network - a network instance
      • getNetwork

        public NFENetwork getNetwork()
        Gets the network to which the network element belongs
        Returns:
        a network instance or null the network element does not belong to any network
      • isNode

        public abstract boolean isNode()
        Tells whether the network element is a node or not
        Returns:
        true if the network element is a node
      • isLink

        public abstract boolean isLink()
        Tells whether the network element is a link or not
        Returns:
        true if the network element is a link
      • getKey

        public abstract java.lang.String getKey()
        Gets the network element's key. The key is a unique value to differentiate a network element among other network elements in the same network. There could be a node and a link with the same ID but cannot exist two network elements (node or links) with the same key
        Returns:
        the network element's key
      • createCopy

        public abstract NFENetworkElement createCopy()
        Returns object copy.
        Returns:
        object copy
      • notifyPropertyChanged

        protected void notifyPropertyChanged​(java.lang.String propertyName,
                                             java.lang.Object previousValue)
        Notifies the container about a change made to a property
        Parameters:
        propertyName - the changed property name
        previousValue - the property value before changed