org.weblab_project.core.comparator
Class SegmentComparator
java.lang.Object
org.weblab_project.core.comparator.SegmentComparator
- All Implemented Interfaces:
- java.io.Serializable, java.util.Comparator<Segment>
public class SegmentComparator
- extends java.lang.Object
- implements java.io.Serializable, java.util.Comparator<Segment>
A Comparator
for Segment
s.
First of all Segment
are ordered using their type:
LinearSegment
, TemporalSegment
,
SpatialSegment
an then any other Segment
.
Then Segment
s of same types are compare together.
For LinearSegment
and TemporalSegment
: The
smaller is the one that starts first. If equals, the smaller is the first
that stops too. If equals, they are equals (in comparison terms, non
consistent with equals
of Resource
).
For SpatialSegment
: The smaller is the one with the less
Coordinate
s. If equals, we process all the coordinates to
find the first difference between Xs and then Ys (Coordinate
by Coordinate
). The smaller is the smaller using this first
difference. If all number (x and y) in Coordinate
s are
equals, then Segment
s are equals (in comparison terms, non
consistent with equals
of Resource
).
- Author:
- EADS WebLab Team
- See Also:
- Serialized Form
- WARNING:
- Comparison is inconsistent with
equals()
since no
equals()
was generated by JAX-WS and it will use the
default one from Object
.
- Date:
- 2008-01-03
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 |
SegmentComparator
public SegmentComparator()
compare
public int compare(Segment seg1,
Segment seg2)
- Specified by:
compare
in interface java.util.Comparator<Segment>
Copyright © 2004-2010. All Rights Reserved.