Package ptolemy.actor.util
Class GeneralComparator
- java.lang.Object
-
- ptolemy.actor.util.GeneralComparator
-
- All Implemented Interfaces:
java.util.Comparator
public class GeneralComparator extends java.lang.Object implements java.util.Comparator
This class compares two comparable objects, object_1 and object_2, by calling compare(object_1, object_2). A comparable object implements theComparable
interface. This method returns -1, 0, or 1 if object_1 is less than, equal to, or bigger than object_2.- Since:
- Ptolemy II 5.2
- Version:
- $Id$
- Author:
- Haiyang Zheng
- Pt.AcceptedRating:
- Green (hyzheng)
- Pt.ProposedRating:
- Green (hyzheng)
-
-
Constructor Summary
Constructors Constructor Description GeneralComparator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(java.lang.Object first, java.lang.Object second)
Return -1, 0, or 1 if the first object is less than, equal to, or bigger than the second object.
-
-
-
Method Detail
-
compare
public int compare(java.lang.Object first, java.lang.Object second)
Return -1, 0, or 1 if the first object is less than, equal to, or bigger than the second object.If any of the argument is not a object of Comparable class, a ClassCastException will be thrown.
- Specified by:
compare
in interfacejava.util.Comparator
- Parameters:
first
- The first comparable object.second
- The second comparable object.- Returns:
- The comparison result, -1, 0, or 1.
-
-