Sorted (but still need to rename some fields to remove 'f' prefix)
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@56 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/super/com/google/gwt/emul/java/lang/Boolean.java b/user/super/com/google/gwt/emul/java/lang/Boolean.java
index a530a21..5cd3494 100644
--- a/user/super/com/google/gwt/emul/java/lang/Boolean.java
+++ b/user/super/com/google/gwt/emul/java/lang/Boolean.java
@@ -23,8 +23,25 @@
// CHECKSTYLE_OFF: These have to be created somewhere
public static Boolean FALSE = new Boolean(false);
public static Boolean TRUE = new Boolean(true);
+
// CHECKSTYLE_ON
+ public static String toString(boolean x) {
+ return String.valueOf(x);
+ }
+
+ public static Boolean valueOf(boolean b) {
+ return b ? TRUE : FALSE;
+ }
+
+ public static Boolean valueOf(String s) {
+ if (s != null && s.equalsIgnoreCase("true")) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+ }
+
private boolean fValue;
public Boolean(boolean value) {
@@ -39,8 +56,8 @@
return fValue;
}
- public static String toString(boolean x) {
- return String.valueOf(x);
+ public boolean equals(Object o) {
+ return (o instanceof Boolean) && (((Boolean) o).fValue == fValue);
}
public int hashCode() {
@@ -50,23 +67,7 @@
return fValue ? hashCodeForTrue : hashCodeForFalse;
}
- public boolean equals(Object o) {
- return (o instanceof Boolean) && (((Boolean) o).fValue == fValue);
- }
-
public String toString() {
return fValue ? "true" : "false";
}
-
- public static Boolean valueOf(String s) {
- if (s != null && s.equalsIgnoreCase("true")) {
- return TRUE;
- } else {
- return FALSE;
- }
- }
-
- public static Boolean valueOf(boolean b) {
- return b ? TRUE : FALSE;
- }
}
diff --git a/user/super/com/google/gwt/emul/java/lang/Byte.java b/user/super/com/google/gwt/emul/java/lang/Byte.java
index d6ee987..bc6b229 100644
--- a/user/super/com/google/gwt/emul/java/lang/Byte.java
+++ b/user/super/com/google/gwt/emul/java/lang/Byte.java
@@ -22,6 +22,42 @@
public static final byte MIN_VALUE = (byte) 0x80;
public static final byte MAX_VALUE = (byte) 0x7F;
+ public static Byte decode(String s) throws NumberFormatException {
+ long x = __parseLongInfer(s);
+ if (__isLongNaN(x)) {
+ throw new NumberFormatException(s);
+ } else {
+ return new Byte((byte) x);
+ }
+ }
+
+ public static byte parseByte(String s) throws NumberFormatException {
+ final int baseTen = 10;
+ return parseByte(s, baseTen);
+ }
+
+ public static byte parseByte(String s, int radix)
+ throws NumberFormatException {
+ long x = __parseLongRadix(s, radix);
+ if (__isLongNaN(x)) {
+ throw new NumberFormatException(s);
+ } else {
+ return (byte) x;
+ }
+ }
+
+ public static String toString(byte b) {
+ return String.valueOf(b);
+ }
+
+ public static Byte valueOf(String s) throws NumberFormatException {
+ return new Byte(Byte.parseByte(s));
+ }
+
+ public static Byte valueOf(String s, int radix) throws NumberFormatException {
+ return new Byte(Byte.parseByte(s, radix));
+ }
+
private final byte fValue;
public Byte(byte value) {
@@ -32,11 +68,7 @@
fValue = parseByte(s);
}
- public int compareTo(Object o) {
- return compareTo((Byte) o);
- }
-
- public int hashCode() {
+ public byte byteValue() {
return fValue;
}
@@ -50,47 +82,26 @@
}
}
- public boolean equals(Object o) {
- return (o instanceof Byte) && (((Byte) o).fValue == fValue);
- }
-
- public static String toString(byte b) {
- return String.valueOf(b);
- }
-
- public String toString() {
- return toString(fValue);
- }
-
- public static Byte decode(String s) throws NumberFormatException {
- long x = __parseLongInfer(s);
- if (__isLongNaN(x)) {
- throw new NumberFormatException(s);
- } else {
- return new Byte((byte) x);
- }
- }
-
- public static Byte valueOf(String s) throws NumberFormatException {
- return new Byte(Byte.parseByte(s));
- }
-
- public static Byte valueOf(String s, int radix) throws NumberFormatException {
- return new Byte(Byte.parseByte(s, radix));
- }
-
- public byte byteValue() {
- return fValue;
+ public int compareTo(Object o) {
+ return compareTo((Byte) o);
}
public double doubleValue() {
return fValue;
}
+ public boolean equals(Object o) {
+ return (o instanceof Byte) && (((Byte) o).fValue == fValue);
+ }
+
public float floatValue() {
return fValue;
}
+ public int hashCode() {
+ return fValue;
+ }
+
public int intValue() {
return fValue;
}
@@ -103,18 +114,7 @@
return fValue;
}
- public static byte parseByte(String s, int radix)
- throws NumberFormatException {
- long x = __parseLongRadix(s, radix);
- if (__isLongNaN(x)) {
- throw new NumberFormatException(s);
- } else {
- return (byte) x;
- }
- }
-
- public static byte parseByte(String s) throws NumberFormatException {
- final int baseTen = 10;
- return parseByte(s, baseTen);
+ public String toString() {
+ return toString(fValue);
}
}
diff --git a/user/super/com/google/gwt/emul/java/lang/Character.java b/user/super/com/google/gwt/emul/java/lang/Character.java
index c209417..6b13ada 100644
--- a/user/super/com/google/gwt/emul/java/lang/Character.java
+++ b/user/super/com/google/gwt/emul/java/lang/Character.java
@@ -26,66 +26,6 @@
public static final char MIN_VALUE = '\u0000';
public static final char MAX_VALUE = '\uFFFF';
- private final char fValue;
-
- public Character(char value) {
- fValue = value;
- }
-
- public char charValue() {
- return fValue;
- }
-
- public static String toString(char x) {
- return String.valueOf(x);
- }
-
- public static native char toUpperCase(char c) /*-{
- return String.fromCharCode(c).toUpperCase().charCodeAt(0);
- }-*/;
-
- public static native char toLowerCase(char c) /*-{
- return String.fromCharCode(c).toLowerCase().charCodeAt(0);
- }-*/;
-
- public static native boolean isLetter(char c) /*-{
- return (null != String.fromCharCode(c).match(/[A-Z]/i));
- }-*/;
-
- public static native boolean isDigit(char c) /*-{
- return (null != String.fromCharCode(c).match(/\d/));
- }-*/;
-
- public static native boolean isLetterOrDigit(char c) /*-{
- return (null != String.fromCharCode(c).match(/[A-Z\d]/i));
- }-*/;
-
- public int hashCode() {
- return fValue;
- }
-
- public int compareTo(Character c) {
- if (fValue < c.fValue) {
- return -1;
- } else if (fValue > c.fValue) {
- return 1;
- } else {
- return 0;
- }
- }
-
- public int compareTo(Object o) {
- return compareTo((Character) o);
- }
-
- public boolean equals(Object o) {
- return (o instanceof Character) && (((Character) o).fValue == fValue);
- }
-
- public String toString() {
- return String.valueOf(fValue);
- }
-
public static int digit(char c, int radix) {
if (radix < MIN_RADIX || radix > MAX_RADIX) {
return -1;
@@ -119,6 +59,18 @@
}
}
+ public static native boolean isDigit(char c) /*-{
+ return (null != String.fromCharCode(c).match(/\d/));
+ }-*/;
+
+ public static native boolean isLetter(char c) /*-{
+ return (null != String.fromCharCode(c).match(/[A-Z]/i));
+ }-*/;
+
+ public static native boolean isLetterOrDigit(char c) /*-{
+ return (null != String.fromCharCode(c).match(/[A-Z\d]/i));
+ }-*/;
+
public static boolean isLowerCase(char c) {
return toLowerCase(c) == c && isLetter(c);
}
@@ -143,4 +95,52 @@
public static boolean isUpperCase(char c) {
return toUpperCase(c) == c && isLetter(c);
}
+
+ public static native char toLowerCase(char c) /*-{
+ return String.fromCharCode(c).toLowerCase().charCodeAt(0);
+ }-*/;
+
+ public static String toString(char x) {
+ return String.valueOf(x);
+ }
+
+ public static native char toUpperCase(char c) /*-{
+ return String.fromCharCode(c).toUpperCase().charCodeAt(0);
+ }-*/;
+
+ private final char fValue;
+
+ public Character(char value) {
+ fValue = value;
+ }
+
+ public char charValue() {
+ return fValue;
+ }
+
+ public int compareTo(Character c) {
+ if (fValue < c.fValue) {
+ return -1;
+ } else if (fValue > c.fValue) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+
+ public int compareTo(Object o) {
+ return compareTo((Character) o);
+ }
+
+ public boolean equals(Object o) {
+ return (o instanceof Character) && (((Character) o).fValue == fValue);
+ }
+
+ public int hashCode() {
+ return fValue;
+ }
+
+ public String toString() {
+ return String.valueOf(fValue);
+ }
}
diff --git a/user/super/com/google/gwt/emul/java/lang/Double.java b/user/super/com/google/gwt/emul/java/lang/Double.java
index 764a980..8cc648e 100644
--- a/user/super/com/google/gwt/emul/java/lang/Double.java
+++ b/user/super/com/google/gwt/emul/java/lang/Double.java
@@ -25,6 +25,41 @@
public static final double NEGATIVE_INFINITY = -1d / 0d;
public static final double POSITIVE_INFINITY = 1d / 0d;
+ public static int compare(double x, double y) {
+ if (x < y) {
+ return -1;
+ } else if (x > y) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+
+ public static native boolean isInfinite(double x) /*-{
+ return !isFinite(x);
+ }-*/;
+
+ public static native boolean isNaN(double x) /*-{
+ return isNaN(x);
+ }-*/;
+
+ public static double parseDouble(String s) throws NumberFormatException {
+ double x = __parseDouble(s);
+ if (isNaN(x)) {
+ throw new NumberFormatException(s);
+ } else {
+ return x;
+ }
+ }
+
+ public static String toString(double b) {
+ return String.valueOf(b);
+ }
+
+ public static Double valueOf(String s) throws NumberFormatException {
+ return new Double(Double.parseDouble(s));
+ }
+
private final double fValue;
public Double(double value) {
@@ -35,10 +70,36 @@
fValue = parseDouble(s);
}
+ public byte byteValue() {
+ return (byte) fValue;
+ }
+
+ public int compareTo(Double b) {
+ if (fValue < b.fValue) {
+ return -1;
+ } else if (fValue > b.fValue) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+
public int compareTo(Object o) {
return compareTo((Double) o);
}
+ public double doubleValue() {
+ return fValue;
+ }
+
+ public boolean equals(Object o) {
+ return (o instanceof Double) && (((Double) o).fValue == fValue);
+ }
+
+ public float floatValue() {
+ return (float) fValue;
+ }
+
/**
* Performance caution: using Double objects as map keys is not recommended.
* Using double values as keys is generally a bad idea due to difficulty
@@ -52,48 +113,18 @@
return (int) fValue;
}
- public int compareTo(Double b) {
- if (fValue < b.fValue) {
- return -1;
- } else if (fValue > b.fValue) {
- return 1;
- } else {
- return 0;
- }
- }
-
- public boolean equals(Object o) {
- return (o instanceof Double) && (((Double) o).fValue == fValue);
- }
-
- public static String toString(double b) {
- return String.valueOf(b);
- }
-
- public String toString() {
- return toString(fValue);
- }
-
- public static Double valueOf(String s) throws NumberFormatException {
- return new Double(Double.parseDouble(s));
- }
-
- public byte byteValue() {
- return (byte) fValue;
- }
-
- public float floatValue() {
- return (float) fValue;
- }
-
- public double doubleValue() {
- return fValue;
- }
-
public int intValue() {
return (int) fValue;
}
+ public boolean isInfinite() {
+ return isInfinite(fValue);
+ }
+
+ public boolean isNaN() {
+ return isNaN(fValue);
+ }
+
public long longValue() {
return (long) fValue;
}
@@ -102,39 +133,8 @@
return (short) fValue;
}
- public static int compare(double x, double y) {
- if (x < y) {
- return -1;
- } else if (x > y) {
- return 1;
- } else {
- return 0;
- }
+ public String toString() {
+ return toString(fValue);
}
- public static double parseDouble(String s) throws NumberFormatException {
- double x = __parseDouble(s);
- if (isNaN(x)) {
- throw new NumberFormatException(s);
- } else {
- return x;
- }
- }
-
- public boolean isNaN() {
- return isNaN(fValue);
- }
-
- public static native boolean isNaN(double x) /*-{
- return isNaN(x);
- }-*/;
-
- public boolean isInfinite() {
- return isInfinite(fValue);
- }
-
- public static native boolean isInfinite(double x) /*-{
- return !isFinite(x);
- }-*/;
-
}
diff --git a/user/super/com/google/gwt/emul/java/lang/Float.java b/user/super/com/google/gwt/emul/java/lang/Float.java
index 596a3ca..cb965b1 100644
--- a/user/super/com/google/gwt/emul/java/lang/Float.java
+++ b/user/super/com/google/gwt/emul/java/lang/Float.java
@@ -25,6 +25,41 @@
public static final float NEGATIVE_INFINITY = -1f / 0f;
public static final float POSITIVE_INFINITY = 1f / 0f;
+ public static int compare(float x, float y) {
+ if (x < y) {
+ return -1;
+ } else if (x > y) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+
+ public static native boolean isInfinite(float x) /*-{
+ return !isFinite(x);
+ }-*/;
+
+ public static native boolean isNaN(float x) /*-{
+ return isNaN(x);
+ }-*/;
+
+ public static float parseFloat(String s) throws NumberFormatException {
+ float x = __parseFloat(s);
+ if (isNaN(x)) {
+ throw new NumberFormatException(s);
+ } else {
+ return x;
+ }
+ }
+
+ public static String toString(float b) {
+ return String.valueOf(b);
+ }
+
+ public static Float valueOf(String s) throws NumberFormatException {
+ return new Float(Float.parseFloat(s));
+ }
+
private final float fValue;
public Float(float value) {
@@ -35,10 +70,36 @@
fValue = parseFloat(s);
}
+ public byte byteValue() {
+ return (byte) fValue;
+ }
+
+ public int compareTo(Float b) {
+ if (fValue < b.fValue) {
+ return -1;
+ } else if (fValue > b.fValue) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+
public int compareTo(Object o) {
return compareTo((Float) o);
}
+ public double doubleValue() {
+ return fValue;
+ }
+
+ public boolean equals(Object o) {
+ return (o instanceof Float) && (((Float) o).fValue == fValue);
+ }
+
+ public float floatValue() {
+ return fValue;
+ }
+
/**
* Performance caution: using Float objects as map keys is not recommended.
* Using floating point values as keys is generally a bad idea due to
@@ -52,48 +113,18 @@
return (int) fValue;
}
- public int compareTo(Float b) {
- if (fValue < b.fValue) {
- return -1;
- } else if (fValue > b.fValue) {
- return 1;
- } else {
- return 0;
- }
- }
-
- public boolean equals(Object o) {
- return (o instanceof Float) && (((Float) o).fValue == fValue);
- }
-
- public static String toString(float b) {
- return String.valueOf(b);
- }
-
- public String toString() {
- return toString(fValue);
- }
-
- public static Float valueOf(String s) throws NumberFormatException {
- return new Float(Float.parseFloat(s));
- }
-
- public byte byteValue() {
- return (byte) fValue;
- }
-
- public double doubleValue() {
- return fValue;
- }
-
- public float floatValue() {
- return fValue;
- }
-
public int intValue() {
return (int) fValue;
}
+ public boolean isInfinite() {
+ return isInfinite(fValue);
+ }
+
+ public boolean isNaN() {
+ return isNaN(fValue);
+ }
+
public long longValue() {
return (long) fValue;
}
@@ -102,39 +133,8 @@
return (short) fValue;
}
- public static int compare(float x, float y) {
- if (x < y) {
- return -1;
- } else if (x > y) {
- return 1;
- } else {
- return 0;
- }
+ public String toString() {
+ return toString(fValue);
}
- public static float parseFloat(String s) throws NumberFormatException {
- float x = __parseFloat(s);
- if (isNaN(x)) {
- throw new NumberFormatException(s);
- } else {
- return x;
- }
- }
-
- public boolean isNaN() {
- return isNaN(fValue);
- }
-
- public static native boolean isNaN(float x) /*-{
- return isNaN(x);
- }-*/;
-
- public boolean isInfinite() {
- return isInfinite(fValue);
- }
-
- public static native boolean isInfinite(float x) /*-{
- return !isFinite(x);
- }-*/;
-
}
diff --git a/user/super/com/google/gwt/emul/java/lang/Integer.java b/user/super/com/google/gwt/emul/java/lang/Integer.java
index fa465fd..915d35b 100644
--- a/user/super/com/google/gwt/emul/java/lang/Integer.java
+++ b/user/super/com/google/gwt/emul/java/lang/Integer.java
@@ -22,6 +22,49 @@
public static final int MIN_VALUE = 0x80000000;
public static final int MAX_VALUE = 0x7fffffff;
+ public static Integer decode(String s) throws NumberFormatException {
+ long x = __parseLongInfer(s);
+ if (__isLongNaN(x)) {
+ throw new NumberFormatException(s);
+ } else {
+ return new Integer((int) x);
+ }
+ }
+
+ public static int parseInt(String s) throws NumberFormatException {
+ return parseInt(s, 10);
+ }
+
+ public static int parseInt(String s, int radix) throws NumberFormatException {
+ long x = __parseLongRadix(s, radix);
+ if (__isLongNaN(x)) {
+ throw new NumberFormatException(s);
+ } else {
+ return (int) x;
+ }
+ }
+
+ public static String toBinaryString(int x) {
+ return Long.toBinaryString(x);
+ }
+
+ public static String toHexString(int x) {
+ return Long.toHexString(x);
+ }
+
+ public static String toString(int b) {
+ return String.valueOf(b);
+ }
+
+ public static Integer valueOf(String s) throws NumberFormatException {
+ return new Integer(Integer.parseInt(s));
+ }
+
+ public static Integer valueOf(String s, int radix)
+ throws NumberFormatException {
+ return new Integer(Integer.parseInt(s, radix));
+ }
+
private final int fValue;
public Integer(int value) {
@@ -32,12 +75,8 @@
fValue = parseInt(s);
}
- public int compareTo(Object o) {
- return compareTo((Integer) o);
- }
-
- public int hashCode() {
- return fValue;
+ public byte byteValue() {
+ return (byte) fValue;
}
public int compareTo(Integer b) {
@@ -50,48 +89,26 @@
}
}
- public boolean equals(Object o) {
- return (o instanceof Integer) && (((Integer) o).fValue == fValue);
- }
-
- public static String toString(int b) {
- return String.valueOf(b);
- }
-
- public String toString() {
- return toString(fValue);
- }
-
- public static Integer decode(String s) throws NumberFormatException {
- long x = __parseLongInfer(s);
- if (__isLongNaN(x)) {
- throw new NumberFormatException(s);
- } else {
- return new Integer((int) x);
- }
- }
-
- public static Integer valueOf(String s) throws NumberFormatException {
- return new Integer(Integer.parseInt(s));
- }
-
- public static Integer valueOf(String s, int radix)
- throws NumberFormatException {
- return new Integer(Integer.parseInt(s, radix));
- }
-
- public byte byteValue() {
- return (byte) fValue;
+ public int compareTo(Object o) {
+ return compareTo((Integer) o);
}
public double doubleValue() {
return fValue;
}
+ public boolean equals(Object o) {
+ return (o instanceof Integer) && (((Integer) o).fValue == fValue);
+ }
+
public float floatValue() {
return fValue;
}
+ public int hashCode() {
+ return fValue;
+ }
+
public int intValue() {
return fValue;
}
@@ -104,25 +121,8 @@
return (short) fValue;
}
- public static int parseInt(String s, int radix) throws NumberFormatException {
- long x = __parseLongRadix(s, radix);
- if (__isLongNaN(x)) {
- throw new NumberFormatException(s);
- } else {
- return (int) x;
- }
- }
-
- public static int parseInt(String s) throws NumberFormatException {
- return parseInt(s, 10);
- }
-
- public static String toHexString(int x) {
- return Long.toHexString(x);
- }
-
- public static String toBinaryString(int x) {
- return Long.toBinaryString(x);
+ public String toString() {
+ return toString(fValue);
}
}
diff --git a/user/super/com/google/gwt/emul/java/lang/Long.java b/user/super/com/google/gwt/emul/java/lang/Long.java
index 47dcc89..cd5656b 100644
--- a/user/super/com/google/gwt/emul/java/lang/Long.java
+++ b/user/super/com/google/gwt/emul/java/lang/Long.java
@@ -22,46 +22,6 @@
public static final long MIN_VALUE = 0x8000000000000000L;
public static final long MAX_VALUE = 0x7fffffffffffffffL;
- private final long fValue;
-
- public Long(long value) {
- fValue = value;
- }
-
- public Long(String s) {
- fValue = parseLong(s);
- }
-
- public int compareTo(Object o) {
- return compareTo((Long) o);
- }
-
- public int hashCode() {
- return (int) fValue;
- }
-
- public int compareTo(Long b) {
- if (fValue < b.fValue) {
- return -1;
- } else if (fValue > b.fValue) {
- return 1;
- } else {
- return 0;
- }
- }
-
- public boolean equals(Object o) {
- return (o instanceof Long) && (((Long) o).fValue == fValue);
- }
-
- public static String toString(long b) {
- return String.valueOf(b);
- }
-
- public String toString() {
- return toString(fValue);
- }
-
public static Long decode(String s) throws NumberFormatException {
long x = __parseLongInfer(s);
if (__isLongNaN(x)) {
@@ -71,36 +31,8 @@
}
}
- public static Long valueOf(String s) throws NumberFormatException {
- return new Long(Long.parseLong(s));
- }
-
- public static Long valueOf(String s, int radix) throws NumberFormatException {
- return new Long(Long.parseLong(s, radix));
- }
-
- public byte byteValue() {
- return (byte) fValue;
- }
-
- public double doubleValue() {
- return fValue;
- }
-
- public float floatValue() {
- return fValue;
- }
-
- public int intValue() {
- return (int) fValue;
- }
-
- public long longValue() {
- return fValue;
- }
-
- public short shortValue() {
- return (short) fValue;
+ public static long parseLong(String s) throws NumberFormatException {
+ return parseLong(s, 10);
}
public static long parseLong(String s, int radix)
@@ -113,8 +45,17 @@
}
}
- public static long parseLong(String s) throws NumberFormatException {
- return parseLong(s, 10);
+ public static String toBinaryString(long x) {
+ if (x == 0) {
+ return "0";
+ }
+ String binStr = "";
+ while (x != 0) {
+ int bit = (int) x & 0x1;
+ binStr = __hexDigits[bit] + binStr;
+ x = x >>> 1;
+ }
+ return binStr;
}
public static String toHexString(long x) {
@@ -130,17 +71,76 @@
return hexStr;
}
- public static String toBinaryString(long x) {
- if (x == 0) {
- return "0";
+ public static String toString(long b) {
+ return String.valueOf(b);
+ }
+
+ public static Long valueOf(String s) throws NumberFormatException {
+ return new Long(Long.parseLong(s));
+ }
+
+ public static Long valueOf(String s, int radix) throws NumberFormatException {
+ return new Long(Long.parseLong(s, radix));
+ }
+
+ private final long fValue;
+
+ public Long(long value) {
+ fValue = value;
+ }
+
+ public Long(String s) {
+ fValue = parseLong(s);
+ }
+
+ public byte byteValue() {
+ return (byte) fValue;
+ }
+
+ public int compareTo(Long b) {
+ if (fValue < b.fValue) {
+ return -1;
+ } else if (fValue > b.fValue) {
+ return 1;
+ } else {
+ return 0;
}
- String binStr = "";
- while (x != 0) {
- int bit = (int) x & 0x1;
- binStr = __hexDigits[bit] + binStr;
- x = x >>> 1;
- }
- return binStr;
+ }
+
+ public int compareTo(Object o) {
+ return compareTo((Long) o);
+ }
+
+ public double doubleValue() {
+ return fValue;
+ }
+
+ public boolean equals(Object o) {
+ return (o instanceof Long) && (((Long) o).fValue == fValue);
+ }
+
+ public float floatValue() {
+ return fValue;
+ }
+
+ public int hashCode() {
+ return (int) fValue;
+ }
+
+ public int intValue() {
+ return (int) fValue;
+ }
+
+ public long longValue() {
+ return fValue;
+ }
+
+ public short shortValue() {
+ return (short) fValue;
+ }
+
+ public String toString() {
+ return toString(fValue);
}
}
diff --git a/user/super/com/google/gwt/emul/java/lang/Math.java b/user/super/com/google/gwt/emul/java/lang/Math.java
index fa1a7cb..4d1d6fc 100644
--- a/user/super/com/google/gwt/emul/java/lang/Math.java
+++ b/user/super/com/google/gwt/emul/java/lang/Math.java
@@ -26,74 +26,10 @@
private static final double PI_OVER_180 = PI / 180.0;
private static final double PI_UNDER_180 = 180.0 / PI;
- public static native double pow(double x, double exp) /*-{
- return Math.pow(x, exp);
- }-*/;
-
- public static native double floor(double x) /*-{
- return Math.floor(x);
- }-*/;
-
- public static native double ceil(double x) /*-{
- return Math.ceil(x);
- }-*/;
-
- public static double min(double x, double y) {
- return x < y ? x : y;
- }
-
- public static double max(double x, double y) {
- return x > y ? x : y;
- }
-
- public static int min(int x, int y) {
- return x < y ? x : y;
- }
-
- public static int max(int x, int y) {
- return x > y ? x : y;
- }
-
- public static native double sin(double x) /*-{
- return Math.sin(x);
- }-*/;
-
- public static native double cos(double x) /*-{
- return Math.cos(x);
- }-*/;
-
- public static native double tan(double x) /*-{
- return Math.tan(x);
- }-*/;
-
- public static native double sqrt(double x) /*-{
- return Math.sqrt(x);
- }-*/;
-
- public static long min(long x, long y) {
- return x < y ? x : y;
- }
-
- public static long max(long x, long y) {
- return x > y ? x : y;
- }
-
- public static float min(float x, float y) {
- return x < y ? x : y;
- }
-
- public static float max(float x, float y) {
- return x > y ? x : y;
- }
-
public static double abs(double x) {
return x < 0 ? -x : x;
}
- public static long abs(long x) {
- return x < 0 ? -x : x;
- }
-
public static float abs(float x) {
return x < 0 ? -x : x;
}
@@ -102,6 +38,10 @@
return x < 0 ? -x : x;
}
+ public static long abs(long x) {
+ return x < 0 ? -x : x;
+ }
+
public static native double acos(double x) /*-{
return Math.acos(x);
}-*/;
@@ -114,24 +54,84 @@
return Math.atan(x);
}-*/;
+ public static native double ceil(double x) /*-{
+ return Math.ceil(x);
+ }-*/;
+
+ public static native double cos(double x) /*-{
+ return Math.cos(x);
+ }-*/;
+
public static native double exp(double x) /*-{
return Math.exp(x);
}-*/;
+ public static native double floor(double x) /*-{
+ return Math.floor(x);
+ }-*/;
+
public static native double log(double x) /*-{
return Math.log(x);
}-*/;
+ public static double max(double x, double y) {
+ return x > y ? x : y;
+ }
+
+ public static float max(float x, float y) {
+ return x > y ? x : y;
+ }
+
+ public static int max(int x, int y) {
+ return x > y ? x : y;
+ }
+
+ public static long max(long x, long y) {
+ return x > y ? x : y;
+ }
+
+ public static double min(double x, double y) {
+ return x < y ? x : y;
+ }
+
+ public static float min(float x, float y) {
+ return x < y ? x : y;
+ }
+
+ public static int min(int x, int y) {
+ return x < y ? x : y;
+ }
+
+ public static long min(long x, long y) {
+ return x < y ? x : y;
+ }
+
+ public static native double pow(double x, double exp) /*-{
+ return Math.pow(x, exp);
+ }-*/;
+
public static native double random() /*-{
return Math.random();
}-*/;
+ public static native long round(double x) /*-{
+ return Math.round(x);
+ }-*/;
+
public static native int round(float x) /*-{
return Math.round(x);
}-*/;
- public static native long round(double x) /*-{
- return Math.round(x);
+ public static native double sin(double x) /*-{
+ return Math.sin(x);
+ }-*/;
+
+ public static native double sqrt(double x) /*-{
+ return Math.sqrt(x);
+ }-*/;
+
+ public static native double tan(double x) /*-{
+ return Math.tan(x);
}-*/;
public static double toDegrees(double x) {
diff --git a/user/super/com/google/gwt/emul/java/lang/Object.java b/user/super/com/google/gwt/emul/java/lang/Object.java
index 2c9c910..0624089 100644
--- a/user/super/com/google/gwt/emul/java/lang/Object.java
+++ b/user/super/com/google/gwt/emul/java/lang/Object.java
@@ -36,10 +36,6 @@
*/
protected transient String typeName;
- public String toString() {
- return typeName + "@" + hashCode();
- }
-
public native boolean equals(Object other) /*-{
return this === other;
}-*/;
@@ -48,6 +44,10 @@
return System.identityHashCode(this);
}
+ public String toString() {
+ return typeName + "@" + hashCode();
+ }
+
/**
* Never called.
*
diff --git a/user/super/com/google/gwt/emul/java/lang/Short.java b/user/super/com/google/gwt/emul/java/lang/Short.java
index 1f388e3..4e528d9 100644
--- a/user/super/com/google/gwt/emul/java/lang/Short.java
+++ b/user/super/com/google/gwt/emul/java/lang/Short.java
@@ -22,6 +22,41 @@
public static final short MIN_VALUE = (short) 0x8000;
public static final short MAX_VALUE = (short) 0x7fff;
+ public static Short decode(String s) throws NumberFormatException {
+ long x = __parseLongInfer(s);
+ if (__isLongNaN(x)) {
+ throw new NumberFormatException(s);
+ } else {
+ return new Short((short) x);
+ }
+ }
+
+ public static short parseShort(String s) throws NumberFormatException {
+ return parseShort(s, 10);
+ }
+
+ public static short parseShort(String s, int radix)
+ throws NumberFormatException {
+ long x = __parseLongRadix(s, radix);
+ if (__isLongNaN(x)) {
+ throw new NumberFormatException(s);
+ } else {
+ return (short) x;
+ }
+ }
+
+ public static String toString(short b) {
+ return String.valueOf(b);
+ }
+
+ public static Short valueOf(String s) throws NumberFormatException {
+ return new Short(Short.parseShort(s));
+ }
+
+ public static Short valueOf(String s, int radix) throws NumberFormatException {
+ return new Short(Short.parseShort(s, radix));
+ }
+
private final short fValue;
public Short(short value) {
@@ -32,12 +67,12 @@
fValue = parseShort(s);
}
- public int compareTo(Object o) {
- return compareTo((Short) o);
+ public byte byteValue() {
+ return (byte) fValue;
}
- public int hashCode() {
- return fValue;
+ public int compareTo(Object o) {
+ return compareTo((Short) o);
}
public int compareTo(Short b) {
@@ -50,47 +85,22 @@
}
}
- public boolean equals(Object o) {
- return (o instanceof Short) && (((Short) o).fValue == fValue);
- }
-
- public static String toString(short b) {
- return String.valueOf(b);
- }
-
- public String toString() {
- return toString(fValue);
- }
-
- public static Short decode(String s) throws NumberFormatException {
- long x = __parseLongInfer(s);
- if (__isLongNaN(x)) {
- throw new NumberFormatException(s);
- } else {
- return new Short((short) x);
- }
- }
-
- public static Short valueOf(String s) throws NumberFormatException {
- return new Short(Short.parseShort(s));
- }
-
- public static Short valueOf(String s, int radix) throws NumberFormatException {
- return new Short(Short.parseShort(s, radix));
- }
-
- public byte byteValue() {
- return (byte) fValue;
- }
-
public double doubleValue() {
return fValue;
}
+ public boolean equals(Object o) {
+ return (o instanceof Short) && (((Short) o).fValue == fValue);
+ }
+
public float floatValue() {
return fValue;
}
+ public int hashCode() {
+ return fValue;
+ }
+
public int intValue() {
return fValue;
}
@@ -103,17 +113,7 @@
return fValue;
}
- public static short parseShort(String s, int radix)
- throws NumberFormatException {
- long x = __parseLongRadix(s, radix);
- if (__isLongNaN(x)) {
- throw new NumberFormatException(s);
- } else {
- return (short) x;
- }
- }
-
- public static short parseShort(String s) throws NumberFormatException {
- return parseShort(s, 10);
+ public String toString() {
+ return toString(fValue);
}
}
diff --git a/user/super/com/google/gwt/emul/java/lang/StackTraceElement.java b/user/super/com/google/gwt/emul/java/lang/StackTraceElement.java
index 0e6ea0a..9d11647 100644
--- a/user/super/com/google/gwt/emul/java/lang/StackTraceElement.java
+++ b/user/super/com/google/gwt/emul/java/lang/StackTraceElement.java
@@ -22,6 +22,14 @@
*/
public class StackTraceElement {
+ private String className;
+
+ private String fileName;
+
+ private int lineNumber;
+
+ private String methodName;
+
public String getClassName() {
return className;
}
@@ -37,9 +45,4 @@
public String getMethodName() {
return methodName;
}
-
- private String className;
- private String fileName;
- private int lineNumber;
- private String methodName;
}
diff --git a/user/super/com/google/gwt/emul/java/lang/System.java b/user/super/com/google/gwt/emul/java/lang/System.java
index 2a02991..d51e901 100644
--- a/user/super/com/google/gwt/emul/java/lang/System.java
+++ b/user/super/com/google/gwt/emul/java/lang/System.java
@@ -36,6 +36,10 @@
*/
public static final PrintStream out = new PrintStream(null);
+ public static native long currentTimeMillis() /*-{
+ return (new Date()).getTime();
+ }-*/;
+
/**
* Has no effect; just here for source compatibility.
*
@@ -44,10 +48,6 @@
public static native void gc() /*-{
}-*/;
- public static native long currentTimeMillis() /*-{
- return (new Date()).getTime();
- }-*/;
-
public static native int identityHashCode(Object o) /*-{
return @com.google.gwt.core.client.Impl::getHashCode(Ljava/lang/Object;)(o);
}-*/;
diff --git a/user/super/com/google/gwt/emul/java/lang/Throwable.java b/user/super/com/google/gwt/emul/java/lang/Throwable.java
index 91067a3..0461210 100644
--- a/user/super/com/google/gwt/emul/java/lang/Throwable.java
+++ b/user/super/com/google/gwt/emul/java/lang/Throwable.java
@@ -26,6 +26,10 @@
private static final StackTraceElement[] NO_STACK_TRACE = new StackTraceElement[0];
+ private Throwable cause;
+
+ private String message;
+
public Throwable() {
}
@@ -116,7 +120,4 @@
return className;
}
}
-
- private Throwable cause;
- private String message;
}
diff --git a/user/super/com/google/gwt/emul/java/util/AbstractList.java b/user/super/com/google/gwt/emul/java/util/AbstractList.java
index e1144a7..85d5166 100644
--- a/user/super/com/google/gwt/emul/java/util/AbstractList.java
+++ b/user/super/com/google/gwt/emul/java/util/AbstractList.java
@@ -22,6 +22,8 @@
private final class IteratorImpl implements Iterator {
+ int i = 0, last = -1;
+
public boolean hasNext() {
return i < size();
}
@@ -41,8 +43,6 @@
--i;
last = -1;
}
-
- int i = 0, last = -1;
}
public void add(int index, Object element) {
diff --git a/user/super/com/google/gwt/emul/java/util/ArrayList.java b/user/super/com/google/gwt/emul/java/util/ArrayList.java
index 5f17b5a..1f520bc 100644
--- a/user/super/com/google/gwt/emul/java/util/ArrayList.java
+++ b/user/super/com/google/gwt/emul/java/util/ArrayList.java
@@ -21,6 +21,8 @@
public class ArrayList extends AbstractList implements List, RandomAccess,
Cloneable {
+ private Vector fVec;
+
public ArrayList() {
fVec = new Vector();
}
@@ -97,6 +99,4 @@
protected void removeRange(int fromIndex, int endIndex) {
fVec.removeRange(fromIndex, endIndex);
}
-
- private Vector fVec;
}
diff --git a/user/super/com/google/gwt/emul/java/util/Date.java b/user/super/com/google/gwt/emul/java/util/Date.java
index b3e439f..3eb0b5e 100644
--- a/user/super/com/google/gwt/emul/java/util/Date.java
+++ b/user/super/com/google/gwt/emul/java/util/Date.java
@@ -20,18 +20,32 @@
*/
public class Date implements Cloneable, Comparable {
+ // CHECKSTYLE_OFF: The underscore prefix is an old convention that could be
+ // easily replaced.
+ public static native long __parse(String s) /*-{
+ var d = Date.parse(s);
+ return isNaN(d) ? -1 : d;
+ }-*/;
+
+ public static long parse(String s) {
+ long d = __parse(s);
+ if (d != -1) {
+ return d;
+ } else {
+ throw new IllegalArgumentException();
+ }
+ }
+
+ // CHECKSTYLE_OFF: Matching the spec.
+ public static native long UTC(int year, int month, int date, int hrs,
+ int min, int sec) /*-{
+ return Date.UTC(year + 1900, month, date, hrs, min, sec);
+ }-*/;
+
public Date() {
init();
}
- public Date(long date) {
- init(date);
- }
-
- public Date(String date) {
- init(Date.parse(date));
- }
-
public Date(int year, int month, int date) {
init(year, month, date, 0, 0, 0);
}
@@ -44,8 +58,12 @@
init(year, month, date, hrs, min, sec);
}
- public boolean equals(Object obj) {
- return ((obj instanceof Date) && (getTime() == ((Date) obj).getTime()));
+ public Date(long date) {
+ init(date);
+ }
+
+ public Date(String date) {
+ init(Date.parse(date));
}
public boolean after(Date when) {
@@ -56,6 +74,30 @@
return getTime() < when.getTime();
}
+ public Object clone() {
+ return new Date(getTime());
+ }
+
+ public int compareTo(Date other) {
+ long thisTime = getTime();
+ long otherTime = other.getTime();
+ if (thisTime < otherTime) {
+ return -1;
+ } else if (thisTime > otherTime) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+
+ public int compareTo(Object other) {
+ return compareTo((Date) other);
+ }
+
+ public boolean equals(Object obj) {
+ return ((obj instanceof Date) && (getTime() == ((Date) obj).getTime()));
+ }
+
public native int getDate() /*-{
return this.jsdate.getDate();
}-*/;
@@ -92,6 +134,10 @@
return this.jsdate.getFullYear()-1900;
}-*/;
+ public int hashCode() {
+ return (int) (this.getTime() ^ (this.getTime() >>> 32));
+ }
+
public native void setDate(int date) /*-{
this.jsdate.setDate(date);
}-*/;
@@ -108,14 +154,18 @@
this.jsdate.setMonth(month);
}-*/;
+ // CHECKSTYLE_ON
+
public native void setSeconds(int seconds) /*-{
this.jsdate.setSeconds(seconds);
- }-*/;
+ }-*/;;
public native void setTime(long time) /*-{
this.jsdate.setTime(time);
}-*/;
+ // CHECKSTYLE_ON
+
public native void setYear(int year) /*-{
this.jsdate.setFullYear(year + 1900);
}-*/;
@@ -132,40 +182,10 @@
return this.jsdate.toString();
}-*/;
- // CHECKSTYLE_OFF: Matching the spec.
- public static native long UTC(int year, int month, int date, int hrs,
- int min, int sec) /*-{
- return Date.UTC(year + 1900, month, date, hrs, min, sec);
- }-*/;
-
- // CHECKSTYLE_ON
-
- public static long parse(String s) {
- long d = __parse(s);
- if (d != -1) {
- return d;
- } else {
- throw new IllegalArgumentException();
- }
- };
-
- // CHECKSTYLE_OFF: The underscore prefix is an old convention that could be
- // easily replaced.
- public static native long __parse(String s) /*-{
- var d = Date.parse(s);
- return isNaN(d) ? -1 : d;
- }-*/;
-
- // CHECKSTYLE_ON
-
private native void init() /*-{
this.jsdate = new Date();
}-*/;
- private native void init(long date) /*-{
- this.jsdate = new Date(date);
- }-*/;
-
private native void init(int year, int month, int date, int hrs, int min,
int sec) /*-{
this.jsdate = new Date();
@@ -173,27 +193,7 @@
this.jsdate.setHours(hrs, min, sec, 0);
}-*/;
- public int hashCode() {
- return (int) (this.getTime() ^ (this.getTime() >>> 32));
- }
-
- public int compareTo(Date other) {
- long thisTime = getTime();
- long otherTime = other.getTime();
- if (thisTime < otherTime) {
- return -1;
- } else if (thisTime > otherTime) {
- return 1;
- } else {
- return 0;
- }
- }
-
- public int compareTo(Object other) {
- return compareTo((Date) other);
- }
-
- public Object clone() {
- return new Date(getTime());
- }
+ private native void init(long date) /*-{
+ this.jsdate = new Date(date);
+ }-*/;
}
\ No newline at end of file
diff --git a/user/super/com/google/gwt/emul/java/util/HashSet.java b/user/super/com/google/gwt/emul/java/util/HashSet.java
index a74e849..c7690da 100644
--- a/user/super/com/google/gwt/emul/java/util/HashSet.java
+++ b/user/super/com/google/gwt/emul/java/util/HashSet.java
@@ -20,6 +20,8 @@
*/
public class HashSet extends AbstractSet implements Set, Cloneable {
+ private HashMap fMap;
+
public HashSet() {
fMap = new HashMap();
}
@@ -74,6 +76,4 @@
return fMap.keySet().toString();
}
- private HashMap fMap;
-
}
diff --git a/user/super/com/google/gwt/emul/java/util/List.java b/user/super/com/google/gwt/emul/java/util/List.java
index be039bf..7435136 100644
--- a/user/super/com/google/gwt/emul/java/util/List.java
+++ b/user/super/com/google/gwt/emul/java/util/List.java
@@ -20,46 +20,46 @@
*/
public interface List extends Collection {
- int size();
-
- boolean isEmpty();
-
- boolean contains(Object o);
-
- Iterator iterator();
-
- Object[] toArray();
+ void add(int index, Object element);
boolean add(Object o);
- boolean remove(Object o);
-
- boolean containsAll(Collection c);
-
boolean addAll(Collection c);
boolean addAll(int index, Collection c);
+ void clear();
+
+ boolean contains(Object o);
+
+ boolean containsAll(Collection c);
+
+ boolean equals(Object o);
+
+ Object get(int index);
+
+ int hashCode();
+
+ int indexOf(Object o);
+
+ boolean isEmpty();
+
+ Iterator iterator();
+
+ int lastIndexOf(Object o);
+
+ Object remove(int index);
+
+ boolean remove(Object o);
+
boolean removeAll(Collection c);
boolean retainAll(Collection c);
- void clear();
-
- boolean equals(Object o);
-
- int hashCode();
-
- Object get(int index);
-
Object set(int index, Object element);
- void add(int index, Object element);
+ int size();
- Object remove(int index);
-
- int indexOf(Object o);
-
- int lastIndexOf(Object o);
+ Object[] toArray();
}
diff --git a/user/super/com/google/gwt/emul/java/util/MissingResourceException.java b/user/super/com/google/gwt/emul/java/util/MissingResourceException.java
index 18e407c..76b3b76 100644
--- a/user/super/com/google/gwt/emul/java/util/MissingResourceException.java
+++ b/user/super/com/google/gwt/emul/java/util/MissingResourceException.java
@@ -21,6 +21,10 @@
* official Java API doc</a> for details.
*/
public class MissingResourceException extends RuntimeException {
+ private String className;
+
+ private String key;
+
public MissingResourceException(String s, String className, String key) {
super(s);
this.key = key;
@@ -34,7 +38,4 @@
public String getKey() {
return key;
}
-
- private String className;
- private String key;
}
diff --git a/user/super/com/google/gwt/emul/java/util/Set.java b/user/super/com/google/gwt/emul/java/util/Set.java
index 10cf849..58807e5 100644
--- a/user/super/com/google/gwt/emul/java/util/Set.java
+++ b/user/super/com/google/gwt/emul/java/util/Set.java
@@ -20,32 +20,32 @@
*/
public interface Set extends Collection {
- int size();
-
- boolean isEmpty();
-
- boolean contains(Object o);
-
- Iterator iterator();
-
- Object[] toArray();
-
boolean add(Object o);
- boolean remove(Object o);
-
- boolean containsAll(Collection c);
-
boolean addAll(Collection c);
- boolean retainAll(Collection c);
-
- boolean removeAll(Collection c);
-
void clear();
+ boolean contains(Object o);
+
+ boolean containsAll(Collection c);
+
boolean equals(Object o);
int hashCode();
+ boolean isEmpty();
+
+ Iterator iterator();
+
+ boolean remove(Object o);
+
+ boolean removeAll(Collection c);
+
+ boolean retainAll(Collection c);
+
+ int size();
+
+ Object[] toArray();
+
}
diff --git a/user/super/com/google/gwt/emul/java/util/Stack.java b/user/super/com/google/gwt/emul/java/util/Stack.java
index 949c941..e05fa60 100644
--- a/user/super/com/google/gwt/emul/java/util/Stack.java
+++ b/user/super/com/google/gwt/emul/java/util/Stack.java
@@ -20,26 +20,12 @@
*/
public class Stack extends Vector {
- public Object pop() {
- int sz = size();
- if (sz > 0) {
- return remove(sz - 1);
- } else {
- throw new EmptyStackException();
- }
- }
-
public Object clone() {
Stack s = new Stack();
s.addAll(this);
return s;
}
- public Object push(Object o) {
- add(o);
- return o;
- }
-
public boolean empty() {
return isEmpty();
}
@@ -53,6 +39,20 @@
}
}
+ public Object pop() {
+ int sz = size();
+ if (sz > 0) {
+ return remove(sz - 1);
+ } else {
+ throw new EmptyStackException();
+ }
+ }
+
+ public Object push(Object o) {
+ add(o);
+ return o;
+ }
+
public int search(Object o) {
for (int i = 0, n = size(); i < n; ++i) {
Object other = get(i);