org.ow2.weblab.core.extended.comparator
Class SegmentComparator
java.lang.Object
org.ow2.weblab.core.extended.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 Segments.
First of all Segment are ordered using their type: LinearSegment, TemporalSegment, SpatioTemporalSegment,
SpatialSegment, TrackSegment and then any other Segment.
Then Segments 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 Coordinates. 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 Coordinates are equals, then Segments are equals (in comparison terms, non consistent with equals of
Resource).
For SpatioTemporalSegment we first use the same process than for TemporalSegment (using the timestamp property). If the timestamp
are we compare them using the same process than for SpatialSegment.
Finally, for TrackSegment, the less Segment it contains, the "smaller" it is. Then one by one contained Segment are compared and the first
difference is the comparison rasult.
- Author:
- Cassidian 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-2011 WebLab Project. All Rights Reserved.