- java.lang.Object
-
- org.arakhne.afc.math.graph.simple.SGraphPoint
-
- All Implemented Interfaces:
Comparable<GraphPoint<SGraphPoint,SGraphSegment>>,GraphPoint<SGraphPoint,SGraphSegment>
public class SGraphPoint extends Object implements GraphPoint<SGraphPoint,SGraphSegment>
This class provides a simple implementation of a graph's point for aSGraph.- Since:
- 13.0
- Version:
- 17.0 2020-01-04 14:41:42
- Author:
- Stéphane GALLAND
- Maven Group Id:
- org.arakhne.afc.core
- Maven Artifact Id:
- mathgraph
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.arakhne.afc.math.graph.GraphPoint
GraphPoint.GraphPointConnection<PT extends GraphPoint<PT,ST>,ST extends GraphSegment<ST,PT>>
-
-
Constructor Summary
Constructors Constructor Description SGraphPoint(SGraph graph1)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidadd(Iterable<SGraphSegment> segments)Add the given segments in the connection.(package private) voidadd(SGraphSegment segment)Add the given segment in the connection.booleanaddUserData(Object userData)Add a user data in the data associated to this point.(package private) voidclear()Clear the connection.intcompareTo(GraphPoint<SGraphPoint,SGraphSegment> pt)Collection<Object>getAllUserData()Replies all the user data.intgetConnectedSegmentCount()Replies the count of segments connected to this point.Iterable<SGraphSegment>getConnectedSegments()Replies the list of segments connected to this point.Iterable<SGraphSegment>getConnectedSegmentsStartingFrom(SGraphSegment startingPoint)Replies the list of segments connected to this point.Iterable<SGraphSegment>getConnectedSegmentsStartingFromInReverseOrder(SGraphSegment startingPoint)Replies the list of segments connected to this point in reverse order.Iterable<? extends GraphPoint.GraphPointConnection<SGraphPoint,SGraphSegment>>getConnections()Replies the list of segment connections for this point.Iterable<? extends GraphPoint.GraphPointConnection<SGraphPoint,SGraphSegment>>getConnectionsStartingFrom(SGraphSegment startingPoint)Replies the list of segment connections for this point.Iterable<? extends GraphPoint.GraphPointConnection<SGraphPoint,SGraphSegment>>getConnectionsStartingFromInReverseOrder(SGraphSegment startingPoint)Replies the list of segment connections for this point in reverse order.SGraphgetGraph()Replies the graph in which this connection is.ObjectgetUserDataAt(int index)Replies the user data at the given index.intgetUserDataCount()Replies the number of user data.booleanisConnectedSegment(SGraphSegment segment)Replies if the specified segment was connected to this point.booleanisFinalConnectionPoint()Replies if this point is a final connection point ie, a point connected to only one segment.(package private) voidremove(SGraphSegment segment)Remove the given segment from the connection.booleanremoveUserData(Object userData)Remove a user data from the data associated to this point.voidsetUserDataAt(int index, Object data)Set the user data at the given index.
-
-
-
Constructor Detail
-
SGraphPoint
SGraphPoint(SGraph graph1)
Constructor.- Parameters:
graph1- is the graph in which the connection is.
-
-
Method Detail
-
clear
void clear()
Clear the connection.
-
add
void add(Iterable<SGraphSegment> segments)
Add the given segments in the connection.- Parameters:
segments- the segments to add.
-
add
void add(SGraphSegment segment)
Add the given segment in the connection.- Parameters:
segment- the segment to add.
-
remove
void remove(SGraphSegment segment)
Remove the given segment from the connection.- Parameters:
segment- the segment to remove.
-
getGraph
@Pure public SGraph getGraph()
Replies the graph in which this connection is.- Returns:
- the graph in which this connection is.
-
getConnectedSegmentCount
@Pure public int getConnectedSegmentCount()
Description copied from interface:GraphPointReplies the count of segments connected to this point.- Specified by:
getConnectedSegmentCountin interfaceGraphPoint<SGraphPoint,SGraphSegment>- Returns:
- the count of segments connected to this point.
-
getConnectedSegments
@Pure public Iterable<SGraphSegment> getConnectedSegments()
Description copied from interface:GraphPointReplies the list of segments connected to this point.- Specified by:
getConnectedSegmentsin interfaceGraphPoint<SGraphPoint,SGraphSegment>- Returns:
- the list of segments connected to this point.
-
isConnectedSegment
@Pure public boolean isConnectedSegment(SGraphSegment segment)
Description copied from interface:GraphPointReplies if the specified segment was connected to this point.- Specified by:
isConnectedSegmentin interfaceGraphPoint<SGraphPoint,SGraphSegment>- Parameters:
segment- the starting point.- Returns:
trueif the given segment is connected to this node, otherwisefalse
-
isFinalConnectionPoint
@Pure public boolean isFinalConnectionPoint()
Description copied from interface:GraphPointReplies if this point is a final connection point ie, a point connected to only one segment.- Specified by:
isFinalConnectionPointin interfaceGraphPoint<SGraphPoint,SGraphSegment>- Returns:
trueif zero or one segment was connected to this point, otherwhisefalse
-
compareTo
@Pure public int compareTo(GraphPoint<SGraphPoint,SGraphSegment> pt)
- Specified by:
compareToin interfaceComparable<GraphPoint<SGraphPoint,SGraphSegment>>
-
getConnectedSegmentsStartingFrom
@Pure public Iterable<SGraphSegment> getConnectedSegmentsStartingFrom(SGraphSegment startingPoint)
Description copied from interface:GraphPointReplies the list of segments connected to this point.If the graph point implementation is supporting an ordered list of segment, it will reply the segments starting from the given segment. If the implementation does not support any order, it will reply the same as
GraphPoint.getConnectedSegments().- Specified by:
getConnectedSegmentsStartingFromin interfaceGraphPoint<SGraphPoint,SGraphSegment>- Parameters:
startingPoint- the startint point.- Returns:
- the list of segments connected to this point.
-
getConnectedSegmentsStartingFromInReverseOrder
public Iterable<SGraphSegment> getConnectedSegmentsStartingFromInReverseOrder(SGraphSegment startingPoint)
Description copied from interface:GraphPointReplies the list of segments connected to this point in reverse order.If the graph point implementation is supporting an ordered list of segment, it will reply the segments starting from the given segment. If the implementation does not support any order, it will reply the same as
GraphPoint.getConnectedSegments()in reverse order.- Specified by:
getConnectedSegmentsStartingFromInReverseOrderin interfaceGraphPoint<SGraphPoint,SGraphSegment>- Parameters:
startingPoint- the startint segment.- Returns:
- the list of segments connected to this point.
-
getConnectionsStartingFrom
@Pure public Iterable<? extends GraphPoint.GraphPointConnection<SGraphPoint,SGraphSegment>> getConnectionsStartingFrom(SGraphSegment startingPoint)
Description copied from interface:GraphPointReplies the list of segment connections for this point.If the graph point implementation is supporting an ordered list of segment, it will reply the segments starting from the given segment. If the implementation does not support any order, it will reply the same as
GraphPoint.getConnections().- Specified by:
getConnectionsStartingFromin interfaceGraphPoint<SGraphPoint,SGraphSegment>- Parameters:
startingPoint- the starting point.- Returns:
- the list of segments connected to this point.
-
getConnectionsStartingFromInReverseOrder
@Pure public Iterable<? extends GraphPoint.GraphPointConnection<SGraphPoint,SGraphSegment>> getConnectionsStartingFromInReverseOrder(SGraphSegment startingPoint)
Description copied from interface:GraphPointReplies the list of segment connections for this point in reverse order.If the graph point implementation is supporting an ordered list of segment, it will reply the segments starting from the given segment. If the implementation does not support any order, it will reply the same as
GraphPoint.getConnections().- Specified by:
getConnectionsStartingFromInReverseOrderin interfaceGraphPoint<SGraphPoint,SGraphSegment>- Parameters:
startingPoint- the starting point.- Returns:
- the list of segments connected to this point.
-
getConnections
@Pure public Iterable<? extends GraphPoint.GraphPointConnection<SGraphPoint,SGraphSegment>> getConnections()
Description copied from interface:GraphPointReplies the list of segment connections for this point.- Specified by:
getConnectionsin interfaceGraphPoint<SGraphPoint,SGraphSegment>- Returns:
- the list of segments connected to this point.
-
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:
trueif the data was added; otherwisefalse.
-
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:
trueif the data was removed; otherwisefalse.
-
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.
-
-