/** * Take a Java array, and produce a JS array that is only used for reading. As * this is actually a reference to the original array in prod mode, the source * must not be modified while this copy is in use or you will get different * behavior between DevMode and prod mode. * * @param array source array * @return JS array, which may be a copy or an alias of the input array */ public static JsArrayNumber readOnlyJsArray(float[] array) { if (GWT.isScript()) { return arrayAsJsArrayForProdMode(array).cast(); } JsArrayNumber dest = JsArrayNumber.createArray().cast(); for (int i = 0; i < array.length; ++i) { dest.push(array[i]); } return dest; }
/** * Take a Java array, and produce a JS array that is only used for reading. As * this is actually a reference to the original array in prod mode, the source * must not be modified while this copy is in use or you will get different * behavior between DevMode and prod mode. * <p> * <b>NOTE: long values are not supported in JS, so long emulation is slow * and this method assumes that all the values can be safely stored in a * double.</b> * * @param array source array - its values are assumed to be in the valid range * for doubles -- if the values exceed 2^53, low-order bits will be lost * @return JS array, which may be a copy or an alias of the input array */ public static JsArrayNumber readOnlyJsArray(long[] array) { if (GWT.isScript()) { return arrayAsJsArrayForProdMode(array).cast(); } JsArrayNumber dest = JsArrayNumber.createArray().cast(); for (int i = 0; i < array.length; ++i) { dest.push(array[i]); } return dest; }
/** * Take a Java array, and produce a JS array that is only used for reading. As * this is actually a reference to the original array in prod mode, the source * must not be modified while this copy is in use or you will get different * behavior between DevMode and prod mode. * * @param array source array * @return JS array, which may be a copy or an alias of the input array */ public static JsArrayNumber readOnlyJsArray(double[] array) { if (GWT.isScript()) { return arrayAsJsArrayForProdMode(array).cast(); } JsArrayNumber dest = JsArrayNumber.createArray().cast(); for (int i = 0; i < array.length; ++i) { dest.push(array[i]); } return dest; }
public static JsArrayNumber toJsArray(float[] data) { JsArrayNumber jsan = (JsArrayNumber) JsArrayNumber.createArray(); int len = data.length; for (int i = len - 1; i >= 0; i--) { jsan.set(i, data[i]); } return jsan; }
public static JsArrayNumber toJsArray(double[] data) { JsArrayNumber jsan = (JsArrayNumber) JsArrayNumber.createArray(); int len = data.length; for (int i = len - 1; i >= 0; i--) { jsan.set(i, data[i]); } return jsan; }
public static JsArrayNumber toJsArray(float[] data) { JsArrayNumber jsan = (JsArrayNumber) JsArrayNumber.createArray(); int len = data.length; for (int i = len - 1; i >= 0; i--) { jsan.set(i, data[i]); } return jsan; }
public static JsArrayNumber toJsArray(double[] data) { JsArrayNumber jsan = (JsArrayNumber) JsArrayNumber.createArray(); int len = data.length; for (int i = len - 1; i >= 0; i--) { jsan.set(i, data[i]); } return jsan; }
public static JsArrayNumber toJsArray(double[] data) { JsArrayNumber jsan = (JsArrayNumber) JsArrayNumber.createArray(); int len = data.length; for (int i = len - 1; i >= 0; i--) { jsan.set(i, data[i]); } return jsan; }
public static JsArrayNumber toJsArray(float[] data) { JsArrayNumber jsan = (JsArrayNumber) JsArrayNumber.createArray(); int len = data.length; for (int i = len - 1; i >= 0; i--) { jsan.set(i, data[i]); } return jsan; }
private static native void addWellKnownGraphic(JsArrayNumber wellKnownPoints, String name) /*-{ $wnd.OpenLayers.Renderer.symbol[name] = wellKnownPoints; }-*/;
public FastArrayNumber() { if(GWT.isScript()) { stackNative = JsArrayNumber.createArray().cast(); } else { stackJava = new JsList<Double>(); } }
/** * Converts a Java array of doubles to a JavaScript number array. * * @param numbers array of doubles to convert. */ public static JsArrayNumber toJsArrayNumber(double... numbers) { JsArrayNumber result = JsArrayNumber.createArray().cast(); for (int i = 0; i < numbers.length; i++) { result.set(i, numbers[i]); } nativePatchConstructorForSafari(result); return result; }
private final native void setData(JsArrayNumber data) /*-{ this.data = data; }-*/; }
/** * Take a Java array, and produce a JS array that is only used for reading. As * this is actually a reference to the original array in prod mode, the source * must not be modified while this copy is in use or you will get different * behavior between DevMode and prod mode. * * @param array source array * @return JS array, which may be a copy or an alias of the input array */ public static JsArrayNumber readOnlyJsArray(float[] array) { if (GWT.isScript()) { return arrayAsJsArrayForProdMode(array).cast(); } JsArrayNumber dest = JsArrayNumber.createArray().cast(); for (int i = 0; i < array.length; ++i) { dest.push(array[i]); } return dest; }
/** * Take a Java array, and produce a JS array that is only used for reading. As * this is actually a reference to the original array in prod mode, the source * must not be modified while this copy is in use or you will get different * behavior between DevMode and prod mode. * * @param array source array * @return JS array, which may be a copy or an alias of the input array */ public static JsArrayNumber readOnlyJsArray(double[] array) { if (GWT.isScript()) { return arrayAsJsArrayForProdMode(array).cast(); } JsArrayNumber dest = JsArrayNumber.createArray().cast(); for (int i = 0; i < array.length; ++i) { dest.push(array[i]); } return dest; }
/** * Take a Java array, and produce a JS array that is only used for reading. As * this is actually a reference to the original array in prod mode, the source * must not be modified while this copy is in use or you will get different * behavior between DevMode and prod mode. * * @param array source array * @return JS array, which may be a copy or an alias of the input array */ public static JsArrayNumber readOnlyJsArray(double[] array) { if (GWT.isScript()) { return arrayAsJsArrayForProdMode(array).cast(); } JsArrayNumber dest = JsArrayNumber.createArray().cast(); for (int i = 0; i < array.length; ++i) { dest.push(array[i]); } return dest; }
/** * Take a Java array, and produce a JS array that is only used for reading. As * this is actually a reference to the original array in prod mode, the source * must not be modified while this copy is in use or you will get different * behavior between DevMode and prod mode. * * @param array source array * @return JS array, which may be a copy or an alias of the input array */ public static JsArrayNumber readOnlyJsArray(float[] array) { if (GWT.isScript()) { return arrayAsJsArrayForProdMode(array).cast(); } JsArrayNumber dest = JsArrayNumber.createArray().cast(); for (int i = 0; i < array.length; ++i) { dest.push(array[i]); } return dest; }
/** * Take a Java array, and produce a JS array that is only used for reading. As * this is actually a reference to the original array in prod mode, the source * must not be modified while this copy is in use or you will get different * behavior between DevMode and prod mode. * * @param array source array * @return JS array, which may be a copy or an alias of the input array */ public static JsArrayNumber readOnlyJsArray(float[] array) { if (GWT.isScript()) { return arrayAsJsArrayForProdMode(array).cast(); } JsArrayNumber dest = JsArrayNumber.createArray().cast(); for (int i = 0; i < array.length; ++i) { dest.push(array[i]); } return dest; }
/** * Take a Java array, and produce a JS array that is only used for reading. As * this is actually a reference to the original array in prod mode, the source * must not be modified while this copy is in use or you will get different * behavior between DevMode and prod mode. * * @param array source array * @return JS array, which may be a copy or an alias of the input array */ public static JsArrayNumber readOnlyJsArray(double[] array) { if (GWT.isScript()) { return arrayAsJsArrayForProdMode(array).cast(); } JsArrayNumber dest = JsArrayNumber.createArray().cast(); for (int i = 0; i < array.length; ++i) { dest.push(array[i]); } return dest; }
/** * Take a Java array, and produce a JS array that is only used for reading. As * this is actually a reference to the original array in prod mode, the source * must not be modified while this copy is in use or you will get different * behavior between DevMode and prod mode. * <p> * <b>NOTE: long values are not supported in JS, so long emulation is slow * and this method assumes that all the values can be safely stored in a * double.</b> * * @param array source array - its values are assumed to be in the valid range * for doubles -- if the values exceed 2^53, low-order bits will be lost * @return JS array, which may be a copy or an alias of the input array */ public static JsArrayNumber readOnlyJsArray(long[] array) { if (GWT.isScript()) { return arrayAsJsArrayForProdMode(array).cast(); } JsArrayNumber dest = JsArrayNumber.createArray().cast(); for (int i = 0; i < array.length; ++i) { dest.push(array[i]); } return dest; }