Source Code Cross Referenced for Comparator.java in  » Testing » KeY » java » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Testing » KeY » java.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* Comparator.java -- Interface for objects that specify an ordering
002:           Copyright (C) 1998, 2001 Free Software Foundation, Inc.
003:
004:        This file is part of GNU Classpath.
005:
006:        GNU Classpath is free software; you can redistribute it and/or modify
007:        it under the terms of the GNU General Public License as published by
008:        the Free Software Foundation; either version 2, or (at your option)
009:        any later version.
010:
011:        GNU Classpath is distributed in the hope that it will be useful, but
012:        WITHOUT ANY WARRANTY; without even the implied warranty of
013:        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:        General Public License for more details.
015:
016:        You should have received a copy of the GNU General Public License
017:        along with GNU Classpath; see the file COPYING.  If not, write to the
018:        Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
019:        02111-1307 USA.
020:
021:        Linking this library statically or dynamically with other modules is
022:        making a combined work based on this library.  Thus, the terms and
023:        conditions of the GNU General Public License cover the whole
024:        combination.
025:
026:        As a special exception, the copyright holders of this library give you
027:        permission to link this library with independent modules to produce an
028:        executable, regardless of the license terms of these independent
029:        modules, and to copy and distribute the resulting executable under
030:        terms of your choice, provided that you also meet, for each linked
031:        independent module, the terms and conditions of the license of that
032:        module.  An independent module is a module which is not derived from
033:        or based on this library.  If you modify this library, you may extend
034:        this exception to your version of the library, but you are not
035:        obligated to do so.  If you do not wish to do so, delete this
036:        exception statement from your version. */
037:
038:        package java.util;
039:
040:        /**
041:         * Interface for objects that specify an ordering between objects. The ordering
042:         * should be <em>total</em>, such that any two objects of the correct type
043:         * can be compared, and the comparison is reflexive, anti-symmetric, and
044:         * transitive.  It is also recommended that the comparator be <em>consistent
045:         * with equals</em>, although this is not a strict requirement. A relation
046:         * is consistent with equals if these two statements always have the same
047:         * results (if no exceptions occur):<br>
048:         * <code>compare((Object) e1, (Object) e2) == 0</code> and
049:         * <code>e1.equals((Object) e2)</code><br>
050:         * Comparators that violate consistency with equals may cause strange behavior
051:         * in sorted lists and sets.  For example, a case-sensitive dictionary order
052:         * comparison of Strings is consistent with equals, but if it is
053:         * case-insensitive it is not, because "abc" and "ABC" compare as equal even
054:         * though "abc".equals("ABC") returns false.
055:         * <P>
056:         * In general, Comparators should be Serializable, because when they are passed
057:         * to Serializable data structures such as SortedMap or SortedSet, the entire
058:         * data structure will only serialize correctly if the comparator is
059:         * Serializable.
060:         *
061:         * @author Original author unknown
062:         * @author Eric Blake <ebb9@email.byu.edu>
063:         * @see Comparable
064:         * @see TreeMap
065:         * @see TreeSet
066:         * @see SortedMap
067:         * @see SortedSet
068:         * @see Arrays#sort(Object[], Comparator)
069:         * @see java.io.Serializable
070:         * @since 1.2
071:         * @status updated to 1.4
072:         */
073:        public interface Comparator {
074:            /**
075:             * Return an integer that is negative, zero or positive depending on whether
076:             * the first argument is less than, equal to or greater than the second
077:             * according to this ordering. This method should obey the following
078:             * contract:
079:             * <ul>
080:             *   <li>if compare(a, b) &lt; 0 then compare(b, a) &gt; 0</li>
081:             *   <li>if compare(a, b) throws an exception, so does compare(b, a)</li>
082:             *   <li>if compare(a, b) &lt; 0 and compare(b, c) &lt; 0 then compare(a, c)
083:             *       &lt; 0</li>
084:             *   <li>if compare(a, b) == 0 then compare(a, c) and compare(b, c) must
085:             *       have the same sign</li
086:             * </ul>
087:             * To be consistent with equals, the following additional constraint is
088:             * in place:
089:             * <ul>
090:             *   <li>if a.equals(b) or both a and b are null, then
091:             *       compare(a, b) == 0.</li>
092:             * </ul><p>
093:             *
094:             * Although it is permissible for a comparator to provide an order
095:             * inconsistent with equals, that should be documented.
096:             *
097:             * @param o1 the first object
098:             * @param o2 the second object
099:             * @return the comparison
100:             * @throws ClassCastException if the elements are not of types that can be
101:             *         compared by this ordering.
102:             */
103:            int compare(Object o1, Object o2);
104:
105:            /**
106:             * Return true if the object is equal to this object.  To be
107:             * considered equal, the argument object must satisfy the constraints
108:             * of <code>Object.equals()</code>, be a Comparator, and impose the
109:             * same ordering as this Comparator. The default implementation
110:             * inherited from Object is usually adequate.
111:             *
112:             * @param obj The object
113:             * @return true if it is a Comparator that imposes the same order
114:             * @see Object#equals(Object)
115:             */
116:            boolean equals(Object obj);
117:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.