diff options
author | michelou <michelou@epfl.ch> | 2007-11-06 17:20:34 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2007-11-06 17:20:34 +0000 |
commit | 98d92d4659ee62384671c7a8ea1bba286165f413 (patch) | |
tree | 399d0c0c47eeee6c43e0a074a90a8ba4ae79dabf | |
parent | db0c13fdadf2d1b936f27822ef0bffb678bff345 (diff) | |
download | scala-98d92d4659ee62384671c7a8ea1bba286165f413.tar.gz scala-98d92d4659ee62384671c7a8ea1bba286165f413.tar.bz2 scala-98d92d4659ee62384671c7a8ea1bba286165f413.zip |
removed leading tabs
-rw-r--r-- | src/library/scala/runtime/Comparator.java | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/library/scala/runtime/Comparator.java b/src/library/scala/runtime/Comparator.java index 9b25100e70..cd4303c79f 100644 --- a/src/library/scala/runtime/Comparator.java +++ b/src/library/scala/runtime/Comparator.java @@ -13,10 +13,12 @@ package scala.runtime; /** An object (static class) providing a correct notion of equality in * the general case, in particular with boxed values. + * * @author Gilles Dubochet * @author Martin Odersky * @contributor Stepan Koltsov - * @version 1.2 */ + * @version 1.2 + */ public class Comparator { private static final int CHAR = 0, BYTE = 1, SHORT = 2, INT = 3, LONG = 4, FLOAT = 5, DOUBLE = 6, OTHER = 7; @@ -32,13 +34,14 @@ public class Comparator { return OTHER; } - /** A rich implementation of the equals method that overrides the default - * equals because Java's boxed primitives are utterly broken. This equals + /** A rich implementation of the <code>equals</code> method that overrides the + * default equals because Java's boxed primitives are utterly broken. This equals * is inserted instead of a normal equals by the Scala compiler (in the * ICode phase, method <code>genEqEqPrimitive</code>) only when either * side of the comparison is a subclass of <code>AnyVal</code>, of * <code>java.lang.Number</code>, of <code>java.lang.Character</code> or - * is exactly <code>Any</code> or <code>AnyRef</code>. */ + * is exactly <code>Any</code> or <code>AnyRef</code>. + */ public static boolean equals(Object a, Object b) { if (a == null || b == null) return a == b; @@ -53,25 +56,25 @@ public class Comparator { int bb = (bcode == CHAR) ? ((Character) b).charValue() : ((Number) b).intValue(); return aa == bb; } - else if (maxcode <= LONG) { + else if (maxcode <= LONG) { long aa = (acode == CHAR) ? ((Character) a).charValue() : ((Number) a).longValue(); long bb = (bcode == CHAR) ? ((Character) b).charValue() : ((Number) b).longValue(); return aa == bb; } - else if (maxcode <= FLOAT) { + else if (maxcode <= FLOAT) { float aa = (acode == CHAR) ? ((Character) a).charValue() : ((Number) a).floatValue(); float bb = (bcode == CHAR) ? ((Character) b).charValue() : ((Number) b).floatValue(); return aa == bb; } - else if (maxcode <= DOUBLE) { + else if (maxcode <= DOUBLE) { double aa = (acode == CHAR) ? ((Character) a).charValue() : ((Number) a).doubleValue(); double bb = (bcode == CHAR) ? ((Character) b).charValue() : ((Number) b).doubleValue(); return aa == bb; } - else + else return b.equals(a); - } - else - return false; + } + else + return false; } } |