Class SGraphSegment

    • Constructor Detail

      • SGraphSegment

        public SGraphSegment​(SGraph graph1)
        Constructor.
        Parameters:
        graph1 - is the graph in which the segment is.
      • SGraphSegment

        public SGraphSegment​(SGraph graph1,
                             double length1)
        Constructor.
        Parameters:
        graph1 - is the graph in which the segment is.
        length1 - is the length of the segment.
    • Method Detail

      • getGraph

        @Pure
        public SGraph getGraph()
        Replies the graph in which this segment is.
        Returns:
        the graph in which this segment is.
      • connectBeginToBegin

        public void connectBeginToBegin​(SGraphSegment segment)
        Connect the begin point of this segment to the begin point of the given segment. This function change the connection points of the two segments.
        Parameters:
        segment - the segment.
        Throws:
        IllegalArgumentException - if the given segment is not in the same graph.
      • connectBeginToEnd

        public void connectBeginToEnd​(SGraphSegment segment)
        Connect the begin point of this segment to the end point of the given segment. This function change the connection points of the two segments.
        Parameters:
        segment - the segment.
        Throws:
        IllegalArgumentException - if the given segment is not in the same graph.
      • connectEndToBegin

        public void connectEndToBegin​(SGraphSegment segment)
        Connect the end point of this segment to the begin point of the given segment. This function change the connection points of the two segments.
        Parameters:
        segment - the segment.
        Throws:
        IllegalArgumentException - if the given segment is not in the same graph.
      • connectEndToEnd

        public void connectEndToEnd​(SGraphSegment segment)
        Connect the end point of this segment to the end point of the given segment. This function change the connection points of the two segments.
        Parameters:
        segment - the segment.
        Throws:
        IllegalArgumentException - if the given segment is not in the samegraph.
      • disconnectBegin

        public void disconnectBegin()
        Disconnect the begin point of this segment.
      • disconnectEnd

        public void disconnectEnd()
        Disconnect the end point of this segment.
      • setLength

        public void setLength​(double length)
        Set the length of the segment.
        Parameters:
        length - is the length of the segment.
      • addUserData

        public boolean addUserData​(Object userData)
        Add a user data in the data associated to this point.
        Parameters:
        userData - the user data to add.
        Returns:
        true if the data was added; otherwise false.
      • removeUserData

        public boolean removeUserData​(Object userData)
        Remove a user data from the data associated to this point.
        Parameters:
        userData - the user data to remove.
        Returns:
        true if the data was removed; otherwise false.
      • getUserDataCount

        @Pure
        public int getUserDataCount()
        Replies the number of user data.
        Returns:
        the number of user data.
      • getUserDataAt

        @Pure
        public Object getUserDataAt​(int index)
        Replies the user data at the given index.
        Parameters:
        index - is the index of the data.
        Returns:
        the data
      • setUserDataAt

        public void setUserDataAt​(int index,
                                  Object data)
        Set the user data at the given index.
        Parameters:
        index - is the index of the data.
        data - is the data
      • getAllUserData

        @Pure
        public Collection<Object> getAllUserData()
        Replies all the user data.
        Returns:
        an unmodifiable collection of user data.