mirror of
https://github.com/corda/corda.git
synced 2025-06-18 23:28:21 +00:00
Merge branch 'master' of oss:/var/local/git/avian
This commit is contained in:
@ -31,6 +31,10 @@ public final class Double extends Number {
|
||||
return new Double(value);
|
||||
}
|
||||
|
||||
public static Double valueOf(String s) {
|
||||
return new Double(s);
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
return o instanceof Double && ((Double) o).value == value;
|
||||
}
|
||||
@ -74,9 +78,22 @@ public final class Double extends Number {
|
||||
return value;
|
||||
}
|
||||
|
||||
public boolean isInfinite() {
|
||||
return isInfinite(value);
|
||||
}
|
||||
|
||||
public boolean isNaN() {
|
||||
return isNaN(value);
|
||||
}
|
||||
|
||||
public static double parseDouble(String s) {
|
||||
// todo
|
||||
throw new NumberFormatException(s);
|
||||
int[] numRead = new int[1];
|
||||
double d = doubleFromString(s, numRead);
|
||||
if (numRead[0] == 1) {
|
||||
return d;
|
||||
} else {
|
||||
throw new NumberFormatException(s);
|
||||
}
|
||||
}
|
||||
|
||||
public static native int fillBufferWithDouble(double value, byte[] buffer,
|
||||
@ -85,4 +102,10 @@ public final class Double extends Number {
|
||||
public static native long doubleToRawLongBits(double value);
|
||||
|
||||
public static native double longBitsToDouble(long bits);
|
||||
|
||||
public static native boolean isInfinite(double value);
|
||||
|
||||
public static native boolean isNaN(double value);
|
||||
|
||||
public static native double doubleFromString(String s, int[] numRead);
|
||||
}
|
||||
|
@ -15,6 +15,10 @@ public final class Float extends Number {
|
||||
|
||||
private final float value;
|
||||
|
||||
public Float(String value) {
|
||||
this.value = parseFloat(value);
|
||||
}
|
||||
|
||||
public Float(float value) {
|
||||
this.value = value;
|
||||
}
|
||||
@ -23,6 +27,10 @@ public final class Float extends Number {
|
||||
return new Float(value);
|
||||
}
|
||||
|
||||
public static Float valueOf(String s) {
|
||||
return new Float(s);
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
return o instanceof Float && ((Float) o).value == value;
|
||||
}
|
||||
@ -63,12 +71,31 @@ public final class Float extends Number {
|
||||
return (double) value;
|
||||
}
|
||||
|
||||
public boolean isInfinite() {
|
||||
return isInfinite(value);
|
||||
}
|
||||
|
||||
public boolean isNaN() {
|
||||
return isNaN(value);
|
||||
}
|
||||
|
||||
public static float parseFloat(String s) {
|
||||
// todo
|
||||
throw new NumberFormatException(s);
|
||||
int[] numRead = new int[1];
|
||||
float f = floatFromString(s, numRead);
|
||||
if (numRead[0] == 1) {
|
||||
return f;
|
||||
} else {
|
||||
throw new NumberFormatException(s);
|
||||
}
|
||||
}
|
||||
|
||||
public static native int floatToRawIntBits(float value);
|
||||
|
||||
public static native float intBitsToFloat(int bits);
|
||||
|
||||
public static native boolean isInfinite(float value);
|
||||
|
||||
public static native boolean isNaN(float value);
|
||||
|
||||
public static native float floatFromString(String s, int[] numRead);
|
||||
}
|
||||
|
@ -32,6 +32,13 @@ public class HashMap<K, V> implements Map<K, V> {
|
||||
this(0);
|
||||
}
|
||||
|
||||
public HashMap(Map<K, V> map) {
|
||||
this(map.size());
|
||||
for (Map.Entry<K, V> entry : map.entrySet()) {
|
||||
put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("{");
|
||||
|
@ -18,4 +18,8 @@ public class Random {
|
||||
public int nextInt() {
|
||||
return (int)(Math.random()*Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
public double nextDouble() {
|
||||
return Math.random();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user