Package org.arakhne.afc.math.graph
Class GraphIterationElementComparator<ST extends GraphSegment<ST,PT>,PT extends GraphPoint<PT,ST>>
- java.lang.Object
-
- org.arakhne.afc.math.graph.GraphIterationElementComparator<ST,PT>
-
- Type Parameters:
PT
- is the type of node in the graphST
- is the type of edge in the graph
- All Implemented Interfaces:
Comparator<GraphIterationElement<ST,PT>>
public class GraphIterationElementComparator<ST extends GraphSegment<ST,PT>,PT extends GraphPoint<PT,ST>> extends Object implements Comparator<GraphIterationElement<ST,PT>>
Compare two iteration elements.- 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
-
-
Constructor Summary
Constructors Constructor Description GraphIterationElementComparator(boolean assumeOrientedSegments1)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(GraphIterationElement<ST,PT> o1, GraphIterationElement<ST,PT> o2)
protected int
compareConnections(PT p1, PT p2)
Compare the two given entry points.protected int
compareSegments(ST s1, ST s2)
Compare the two given segments.boolean
isOrientedSegments()
Replies if this comparator is assuming that segments are oriented.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
-
-
-
Constructor Detail
-
GraphIterationElementComparator
public GraphIterationElementComparator(boolean assumeOrientedSegments1)
Constructor.- Parameters:
assumeOrientedSegments1
- may betrue
to assume that the same segment has two different instances for graph iteration: the first instance is associated the first point of the segment and the second instance is associated to the last point of the segment. If this parameter isfalse
to assume that the end points of a segment are not distinguished.
-
-
Method Detail
-
compare
@Pure public int compare(GraphIterationElement<ST,PT> o1, GraphIterationElement<ST,PT> o2)
- Specified by:
compare
in interfaceComparator<ST extends GraphSegment<ST,PT>>
-
compareSegments
@Pure protected int compareSegments(ST s1, ST s2)
Compare the two given segments.- Parameters:
s1
- the first segment.s2
- the second segment.- Returns:
-1
ifs1
is lower thans2
,1
ifs1
is greater thans2
, otherwise0
.
-
compareConnections
@Pure protected int compareConnections(PT p1, PT p2)
Compare the two given entry points.- Parameters:
p1
- the first connection.p2
- the second connection.- Returns:
-1
ifp1
is lower thanp2
,1
ifp1
is greater thanp2
, otherwise0
.
-
isOrientedSegments
@Pure public boolean isOrientedSegments()
Replies if this comparator is assuming that segments are oriented.- Returns:
true
if segments are oriented, otherwisefalse
-
-