org.weblab_project.core.comparator
Class SegmentComparator

java.lang.Object
  extended by 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 Segments.
First of all Segment are ordered using their type: LinearSegment, TemporalSegment, SpatialSegment an 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).

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

Constructor Summary
SegmentComparator()
           
 
Method Summary
 int compare(Segment seg1, Segment seg2)
           
 
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
 

Constructor Detail

SegmentComparator

public SegmentComparator()
Method Detail

compare

public int compare(Segment seg1,
                   Segment seg2)
Specified by:
compare in interface java.util.Comparator<Segment>


Copyright © 2004-2010. All Rights Reserved.