Comparator.h

Go to the documentation of this file.
00001 #ifndef JAVA_UTIL_COMPARATOR_H
00002 #define JAVA_UTIL_COMPARATOR_H 1
00003 
00004 #ifndef JAVA_LANG_OBJECT_H
00005 #include <java_lang/Object.h>
00006 #endif /* JAVA_LANG_OBJECT_H */
00007 
00008 namespace java {
00009   namespace util {
00010 
00073     class JAVA_UTIL_SPEC Comparator : virtual public Interface {
00074 
00075     public:
00076 
00096       static Ref<Comparator> reverseOrder();
00097 
00130       virtual jint compare(const ObjectRef& o1, const ObjectRef& o2) const = 0;
00131 
00132       /*
00133        * 
00134        * Indicates whether some other object is &quot;equal to&quot; this
00135        * Comparator.  This method must obey the general contract of
00136        * <tt>Object.equals(Object)</tt>.  Additionally, this method can return
00137        * <tt>true</tt> <i>only</i> if the specified Object is also a comparator
00138        * and it imposes the same ordering as this comparator.  Thus,
00139        * <code>comp1.equals(comp2)</code> implies that <tt>sgn(comp1.compare(o1,
00140        * o2))==sgn(comp2.compare(o1, o2))</tt> for every object reference
00141        * <tt>o1</tt> and <tt>o2</tt>.<p>
00142        *
00143        * Note that it is <i>always</i> safe <i>not</i> to override
00144        * <tt>Object.equals(Object)</tt>.  However, overriding this method may,
00145        * in some cases, improve performance by allowing programs to determine
00146        * that two distinct Comparators impose the same order.
00147        *
00148        * @param   obj   the reference object with which to compare.
00149        * @return  <code>true</code> only if the specified object is also
00150        *                a comparator and it imposes the same ordering as this
00151        *                comparator.
00152        */
00153       //virtual jboolean equals(const Object& obj) const = 0;
00154 
00155     private:
00156 
00157       REGISTER_MEMBERS;
00158 
00159     };
00160 
00161   } // namespace util
00162 } // namespace java
00163 
00164 #endif /* JAVA_UTIL_COMPARATOR_H */

Generated on Fri May 16 11:54:42 2008 for CrossPlatformJavaLikeC++API by  doxygen 1.5.3