Package adams.gui.core
Class Point2DComparator
- java.lang.Object
-
- adams.gui.core.Point2DComparator
-
- All Implemented Interfaces:
Serializable,Comparator<Point2D>
public class Point2DComparator extends Object implements Comparator<Point2D>, Serializable
A comparator forPoint2Dobjects.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanm_Ascendingwhether to compare ascending or descending.protected booleanm_UseOnlyXwhether to only use X for comparison.
-
Constructor Summary
Constructors Constructor Description Point2DComparator()The default constructor uses comparison by points in ascending manner, using only X.Point2DComparator(boolean ascending, boolean useOnlyX)This constructor initializes the comparator either in ascending manner or descending.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompare(Point2D o1, Point2D o2)Compares its two arguments for order.-
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
-
Point2DComparator
public Point2DComparator()
The default constructor uses comparison by points in ascending manner, using only X.
-
Point2DComparator
public Point2DComparator(boolean ascending, boolean useOnlyX)This constructor initializes the comparator either in ascending manner or descending.- Parameters:
ascending- if true then the ordering is done in ascending manner, otherwise descending
-
-
Method Detail
-
compare
public int compare(Point2D o1, Point2D o2)
Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.- Specified by:
comparein interfaceComparator<Point2D>- Parameters:
o1- the first objecto2- the second object- Returns:
- a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
-
-