/
Platform.java
57 lines (49 loc) · 1.44 KB
/
Platform.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//
// Pythagoras - a collection of geometry classes
// http://github.com/samskivert/pythagoras
package pythagoras.util;
import java.util.Arrays;
/**
* A platform instance that's used when running in GWT. Note that this is copied over top of the
* JDK implementation in the pythagoras.jar file, so this is never actually compiled to bytecode.
* Thus be careful when making changes to this file.
*/
public class Platform
{
/**
* Returns a hash code for the supplied float value.
*/
public static int hashCode (float f1) {
return (int)f1; // alas nothing better can be done in JavaScript
}
/**
* Returns a hash code for the supplied double value.
*/
public static int hashCode (double d1) {
return (int)d1; // alas nothing better can be done in JavaScript
}
/**
* Clones the supplied array of bytes.
*/
public static native byte[] clone (byte[] values) /*-{
return values.slice(0);
}-*/;
/**
* Clones the supplied array of ints.
*/
public static native int[] clone (int[] values) /*-{
return values.slice(0);
}-*/;
/**
* Clones the supplied array of floats.
*/
public static native float[] clone (float[] values) /*-{
return values.slice(0);
}-*/;
/**
* Clones the supplied array of doubles.
*/
public static native double[] clone (double[] values) /*-{
return values.slice(0);
}-*/;
}