Class PointOnNet

  • Direct Known Subclasses:
    HeavyPointOnNet

    public class PointOnNet
    extends java.lang.Object
    This class defines the methods supported by a point on a network. A point on a network can fall on a node or in the middle of a link. User data associated with a PointOnNet can be used in network constraints, cost calculators or heuristic cost functions, etc. For example, the heuristic cost function used in A* shortest path search needs to know the location of the end point. If the end point is specified using link ID and a percentage, then the user must set the location user data of the end point either by passing it to the PointOnNet constructor or by calling setUserData method on the PointOnNet object. The following is an example on how to set the user data in a PointOnNet object. double xCoordinate = -122.45; double yCoordinate = 37.77; PointOnNet point = new PointOnNet(linkId, percentage); Object[] userDataObjects = {xCoordinate, yCoordinate}; UserData userData = new UserDataImpl(userDataObjects); point.setUserData(userData);
    Since:
    11gR1
    • Constructor Detail

      • PointOnNet

        public PointOnNet​(long nodeId)
        Constructs a PointOnNet for a node.
        Parameters:
        nodeId - node ID
      • PointOnNet

        public PointOnNet​(long linkId,
                          double percentage)
        Constructs a PointOnNet for a point on link.
        Parameters:
        linkId - link ID
        percentage - percentage on the link
      • PointOnNet

        public PointOnNet​(long nodeId,
                          CategorizedUserData cud)
        Constructs a PointOnNet for a node.
        Parameters:
        nodeId - node ID
        cud - categorized user data
      • PointOnNet

        public PointOnNet​(long nodeId,
                          UserData userData)
        Constructs a PointOnNet for a node.
        Parameters:
        nodeId - node ID
        userData - user data
      • PointOnNet

        public PointOnNet​(long linkId,
                          double percentage,
                          CategorizedUserData cud)
        Constructs a PointOnNet for a point on link.
        Parameters:
        linkId - link ID
        percentage - percentage on the link
        cud - categorized user data
      • PointOnNet

        public PointOnNet​(long linkId,
                          double percentage,
                          UserData userData)
        Constructs a PointOnNet for a point on link.
        Parameters:
        linkId - link ID
        percentage - percentage on the link
        userData - user data
    • Method Detail

      • isNode

        public boolean isNode()
        Checks whether this point falls on a node or not.
        Returns:
        true if the point falls on a node; false, if the point falls on a link.
      • isPointOnLink

        public boolean isPointOnLink()
        Checks whether this point falls on a link or not.
        Returns:
        true if the point falls on a link; false, if the point falls on a node.
      • getNodeId

        public long getNodeId()
        Returns the node ID, if the point falls on a node.
        Returns:
        the node ID, if the point falls on a node.
      • getLinkId

        public long getLinkId()
        Returns the link ID, if the point falls on a link.
        Returns:
        the link ID, if the point falls on a link.
      • getPercentage

        public double getPercentage()
        Returns the percentage on the link, if the point falls on a link.
        Returns:
        the percentage on the link, if the point falls on a link.
      • getUserData

        public UserData getUserData()
        Returns the user data associated with this point on net in the default user data category.
        Returns:
        user data
      • setUserData

        public void setUserData​(UserData userData)
        Sets user data. Overwrite previous value, if the user data already exists.
        Parameters:
        userData - user data
      • removeUserData

        public void removeUserData()
        Removes all user data associated to this object.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getUserData

        public UserData getUserData​(int category)
      • setUserData

        public void setUserData​(int category,
                                UserData userData)
      • clone

        public java.lang.Object clone()
                               throws java.lang.CloneNotSupportedException
        Support cloneable
        Overrides:
        clone in class java.lang.Object
        Returns:
        cloned object
        Throws:
        java.lang.CloneNotSupportedException