Module org.arakhne.afc.gis.gisroad
Package org.arakhne.afc.gis.road
Class RoadSegmentIterationComparator
- java.lang.Object
-
- org.arakhne.afc.gis.road.RoadSegmentIterationComparator
-
- All Implemented Interfaces:
Comparator<GraphIterationElement<RoadSegment,RoadConnection>>
final class RoadSegmentIterationComparator extends Object implements Comparator<GraphIterationElement<RoadSegment,RoadConnection>>
This class permits to compare two road segments.It is used during road network iterations.
- Since:
- 14.0
- Version:
- 17.0 2020-01-04 14:41:55
- Author:
- Stéphane GALLAND
- Maven Group Id:
- org.arakhne.afc.gis
- Maven Artifact Id:
- gisroad
-
-
Field Summary
Fields Modifier and Type Field Description static RoadSegmentIterationComparator
NOT_ORIENTED_SEGMENT_SINGLETON
Singleton of a comparator which assumes not-oriented segments.static RoadSegmentIterationComparator
ORIENTED_SEGMENT_SINGLETON
Singleton of a comparator which assumes oriented segments.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(GraphIterationElement<RoadSegment,RoadConnection> o1, GraphIterationElement<RoadSegment,RoadConnection> o2)
protected int
compareConnections(RoadConnection p1, RoadConnection p2)
Compare the two given entry points.protected int
compareSegments(RoadSegment s1, RoadSegment 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
-
-
-
-
Field Detail
-
ORIENTED_SEGMENT_SINGLETON
public static final RoadSegmentIterationComparator ORIENTED_SEGMENT_SINGLETON
Singleton of a comparator which assumes oriented segments.- See Also:
NOT_ORIENTED_SEGMENT_SINGLETON
-
NOT_ORIENTED_SEGMENT_SINGLETON
public static final RoadSegmentIterationComparator NOT_ORIENTED_SEGMENT_SINGLETON
Singleton of a comparator which assumes not-oriented segments.- See Also:
ORIENTED_SEGMENT_SINGLETON
-
-
Method Detail
-
compare
@Pure public int compare(GraphIterationElement<RoadSegment,RoadConnection> o1, GraphIterationElement<RoadSegment,RoadConnection> o2)
- Specified by:
compare
in interfaceComparator<GraphIterationElement<RoadSegment,RoadConnection>>
-
compareSegments
@Pure protected int compareSegments(RoadSegment s1, RoadSegment 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(RoadConnection p1, RoadConnection 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
-
-