- 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) void
add(Iterable<SGraphSegment> segments)
Add the given segments in the connection.(package private) void
add(SGraphSegment segment)
Add the given segment in the connection.boolean
addUserData(Object userData)
Add a user data in the data associated to this point.(package private) void
clear()
Clear the connection.int
compareTo(GraphPoint<SGraphPoint,SGraphSegment> pt)
Collection<Object>
getAllUserData()
Replies all the user data.int
getConnectedSegmentCount()
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.SGraph
getGraph()
Replies the graph in which this connection is.Object
getUserDataAt(int index)
Replies the user data at the given index.int
getUserDataCount()
Replies the number of user data.boolean
isConnectedSegment(SGraphSegment segment)
Replies if the specified segment was connected to this point.boolean
isFinalConnectionPoint()
Replies if this point is a final connection point ie, a point connected to only one segment.(package private) void
remove(SGraphSegment segment)
Remove the given segment from the connection.boolean
removeUserData(Object userData)
Remove a user data from the data associated to this point.void
setUserDataAt(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:GraphPoint
Replies the count of segments connected to this point.- Specified by:
getConnectedSegmentCount
in interfaceGraphPoint<SGraphPoint,SGraphSegment>
- Returns:
- the count of segments connected to this point.
-
getConnectedSegments
@Pure public Iterable<SGraphSegment> getConnectedSegments()
Description copied from interface:GraphPoint
Replies the list of segments connected to this point.- Specified by:
getConnectedSegments
in interfaceGraphPoint<SGraphPoint,SGraphSegment>
- Returns:
- the list of segments connected to this point.
-
isConnectedSegment
@Pure public boolean isConnectedSegment(SGraphSegment segment)
Description copied from interface:GraphPoint
Replies if the specified segment was connected to this point.- Specified by:
isConnectedSegment
in interfaceGraphPoint<SGraphPoint,SGraphSegment>
- Parameters:
segment
- the starting point.- Returns:
true
if the given segment is connected to this node, otherwisefalse
-
isFinalConnectionPoint
@Pure public boolean isFinalConnectionPoint()
Description copied from interface:GraphPoint
Replies if this point is a final connection point ie, a point connected to only one segment.- Specified by:
isFinalConnectionPoint
in interfaceGraphPoint<SGraphPoint,SGraphSegment>
- Returns:
true
if zero or one segment was connected to this point, otherwhisefalse
-
compareTo
@Pure public int compareTo(GraphPoint<SGraphPoint,SGraphSegment> pt)
- Specified by:
compareTo
in interfaceComparable<GraphPoint<SGraphPoint,SGraphSegment>>
-
getConnectedSegmentsStartingFrom
@Pure public Iterable<SGraphSegment> getConnectedSegmentsStartingFrom(SGraphSegment startingPoint)
Description copied from interface:GraphPoint
Replies 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:
getConnectedSegmentsStartingFrom
in 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:GraphPoint
Replies 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:
getConnectedSegmentsStartingFromInReverseOrder
in 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:GraphPoint
Replies 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:
getConnectionsStartingFrom
in 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:GraphPoint
Replies 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:
getConnectionsStartingFromInReverseOrder
in 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:GraphPoint
Replies the list of segment connections for this point.- Specified by:
getConnections
in 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:
true
if 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:
true
if 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.
-
-