mirror of
https://github.com/cincheo/jsweet.git
synced 2025-12-14 23:09:22 +00:00
more core Java support
- numbers (Float.intBitsToFloat, ...) - Class.isInstance
This commit is contained in:
parent
a91bd7ec8f
commit
bac62d04b9
@ -4,11 +4,11 @@ import jsweet.util.function.Function4;
|
||||
* A typed array of 32-bit float values. The contents are initialized to 0. If the requested number
|
||||
* of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
public class Float32Array extends def.js.Object implements Iterable<java.lang.Double> {
|
||||
public class Float32Array extends def.js.Object implements Iterable<java.lang.Float> {
|
||||
/**
|
||||
* The size in bytes of each element in the array.
|
||||
*/
|
||||
public final double BYTES_PER_ELEMENT=0;
|
||||
public final int BYTES_PER_ELEMENT=0;
|
||||
/**
|
||||
* The ArrayBuffer instance referenced by the array.
|
||||
*/
|
||||
@ -16,11 +16,11 @@ public class Float32Array extends def.js.Object implements Iterable<java.lang.Do
|
||||
/**
|
||||
* The length in bytes of the array.
|
||||
*/
|
||||
public final double byteLength=0;
|
||||
public final int byteLength=0;
|
||||
/**
|
||||
* The offset in bytes of the array.
|
||||
*/
|
||||
public final double byteOffset=0;
|
||||
public final int byteOffset=0;
|
||||
/**
|
||||
* Returns the this object after copying a section of the array identified by start and end
|
||||
* to the same array starting at position target
|
||||
@ -30,7 +30,7 @@ public class Float32Array extends def.js.Object implements Iterable<java.lang.Do
|
||||
* is treated as length+end.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
*/
|
||||
native public Float32Array copyWithin(double target, double start, double end);
|
||||
native public Float32Array copyWithin(double target, int start, int end);
|
||||
/**
|
||||
* Determines whether all the members of an array satisfy the specified test.
|
||||
* @param callbackfn A function that accepts up to three arguments. The every method calls
|
||||
@ -48,7 +48,7 @@ public class Float32Array extends def.js.Object implements Iterable<java.lang.Do
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* length+end.
|
||||
*/
|
||||
native public Float32Array fill(double value, double start, double end);
|
||||
native public Float32Array fill(double value, int start, int end);
|
||||
/**
|
||||
* Returns the elements of an array that meet the condition specified in a callback function.
|
||||
* @param callbackfn A function that accepts up to three arguments. The filter method calls
|
||||
@ -91,7 +91,7 @@ public class Float32Array extends def.js.Object implements Iterable<java.lang.Do
|
||||
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
|
||||
* search starts at index 0.
|
||||
*/
|
||||
native public double indexOf(double searchElement, double fromIndex);
|
||||
native public int indexOf(double searchElement, int fromIndex);
|
||||
/**
|
||||
* Adds all the elements of an array separated by the specified separator string.
|
||||
* @param separator A string used to separate one element of an array from the next in the
|
||||
@ -104,11 +104,11 @@ public class Float32Array extends def.js.Object implements Iterable<java.lang.Do
|
||||
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
|
||||
* search starts at index 0.
|
||||
*/
|
||||
native public double lastIndexOf(double searchElement, double fromIndex);
|
||||
native public int lastIndexOf(double searchElement, int fromIndex);
|
||||
/**
|
||||
* The length of the array.
|
||||
*/
|
||||
public final double length=0;
|
||||
public final int length=0;
|
||||
/**
|
||||
* Calls a defined callback function on each element of an array, and returns an array that
|
||||
* contains the results.
|
||||
@ -171,19 +171,19 @@ public class Float32Array extends def.js.Object implements Iterable<java.lang.Do
|
||||
* @param index The index of the location to set.
|
||||
* @param value The value to set.
|
||||
*/
|
||||
native public void set(double index, double value);
|
||||
native public void set(int index, double value);
|
||||
/**
|
||||
* Sets a value or an array of values.
|
||||
* @param array A typed or untyped array of values to set.
|
||||
* @param offset The index in the current array at which the values are to be written.
|
||||
*/
|
||||
native public void set(ArrayLike<Double> array, double offset);
|
||||
native public void set(ArrayLike<Double> array, int offset);
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
* @param start The beginning of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array.
|
||||
*/
|
||||
native public Float32Array slice(double start, double end);
|
||||
native public Float32Array slice(int start, int end);
|
||||
/**
|
||||
* Determines whether the specified callback function returns true for any element of an array.
|
||||
* @param callbackfn A function that accepts up to three arguments. The some method calls the
|
||||
@ -205,7 +205,7 @@ public class Float32Array extends def.js.Object implements Iterable<java.lang.Do
|
||||
* @param begin The index of the beginning of the array.
|
||||
* @param end The index of the end of the array.
|
||||
*/
|
||||
native public Float32Array subarray(double begin, double end);
|
||||
native public Float32Array subarray(int begin, int end);
|
||||
/**
|
||||
* Converts a number to a string by using the current locale.
|
||||
*/
|
||||
@ -214,11 +214,12 @@ public class Float32Array extends def.js.Object implements Iterable<java.lang.Do
|
||||
* Returns a string representation of an array.
|
||||
*/
|
||||
native public java.lang.String toString();
|
||||
native public java.lang.Double $get(double index);
|
||||
native public java.lang.Float $get(int index);
|
||||
native public void $set(int index, java.lang.Float value);
|
||||
public static final Float32Array prototype=null;
|
||||
public Float32Array(double length){}
|
||||
public Float32Array(int length){}
|
||||
public Float32Array(ArrayLike<Double> array){}
|
||||
public Float32Array(ArrayBuffer buffer, double byteOffset, double length){}
|
||||
public Float32Array(ArrayBuffer buffer, int byteOffset, int length){}
|
||||
/**
|
||||
* Returns a new array from a set of elements.
|
||||
* @param items A set of elements to include in the new array object.
|
||||
@ -240,7 +241,7 @@ public class Float32Array extends def.js.Object implements Iterable<java.lang.Do
|
||||
* is treated as length+end.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
*/
|
||||
native public Float32Array copyWithin(double target, double start);
|
||||
native public Float32Array copyWithin(double target, int start);
|
||||
/**
|
||||
* Determines whether all the members of an array satisfy the specified test.
|
||||
* @param callbackfn A function that accepts up to three arguments. The every method calls
|
||||
@ -258,7 +259,7 @@ public class Float32Array extends def.js.Object implements Iterable<java.lang.Do
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* length+end.
|
||||
*/
|
||||
native public Float32Array fill(double value, double start);
|
||||
native public Float32Array fill(double value, int start);
|
||||
/**
|
||||
* Returns the this object after filling the section identified by start and end with value
|
||||
* @param value value to fill array section with
|
||||
@ -394,8 +395,8 @@ public class Float32Array extends def.js.Object implements Iterable<java.lang.Do
|
||||
* @param begin The index of the beginning of the array.
|
||||
* @param end The index of the end of the array.
|
||||
*/
|
||||
native public Float32Array subarray(double begin);
|
||||
public Float32Array(ArrayBuffer buffer, double byteOffset){}
|
||||
native public Float32Array subarray(int begin);
|
||||
public Float32Array(ArrayBuffer buffer, int byteOffset){}
|
||||
public Float32Array(ArrayBuffer buffer){}
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
@ -416,7 +417,7 @@ public class Float32Array extends def.js.Object implements Iterable<java.lang.Do
|
||||
* @param array A typed or untyped array of values to set.
|
||||
* @param offset The index in the current array at which the values are to be written.
|
||||
*/
|
||||
native public void set(Double[] array, double offset);
|
||||
native public void set(Double[] array, int offset);
|
||||
public Float32Array(Double[] array){}
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
@ -447,7 +448,7 @@ public class Float32Array extends def.js.Object implements Iterable<java.lang.Do
|
||||
native public static Float32Array from(Double[] arrayLike);
|
||||
/** From Iterable, to allow foreach loop (do not use directly). */
|
||||
@jsweet.lang.Erased
|
||||
native public java.util.Iterator<java.lang.Double> iterator();
|
||||
native public java.util.Iterator<java.lang.Float> iterator();
|
||||
protected Float32Array(){}
|
||||
}
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ public class Float64Array extends def.js.Object implements Iterable<java.lang.Do
|
||||
/**
|
||||
* The size in bytes of each element in the array.
|
||||
*/
|
||||
public final double BYTES_PER_ELEMENT=0;
|
||||
public final int BYTES_PER_ELEMENT=0;
|
||||
/**
|
||||
* The ArrayBuffer instance referenced by the array.
|
||||
*/
|
||||
@ -16,11 +16,11 @@ public class Float64Array extends def.js.Object implements Iterable<java.lang.Do
|
||||
/**
|
||||
* The length in bytes of the array.
|
||||
*/
|
||||
public final double byteLength=0;
|
||||
public final int byteLength=0;
|
||||
/**
|
||||
* The offset in bytes of the array.
|
||||
*/
|
||||
public final double byteOffset=0;
|
||||
public final int byteOffset=0;
|
||||
/**
|
||||
* Returns the this object after copying a section of the array identified by start and end
|
||||
* to the same array starting at position target
|
||||
@ -30,7 +30,7 @@ public class Float64Array extends def.js.Object implements Iterable<java.lang.Do
|
||||
* is treated as length+end.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
*/
|
||||
native public Float64Array copyWithin(double target, double start, double end);
|
||||
native public Float64Array copyWithin(double target, int start, int end);
|
||||
/**
|
||||
* Determines whether all the members of an array satisfy the specified test.
|
||||
* @param callbackfn A function that accepts up to three arguments. The every method calls
|
||||
@ -48,7 +48,7 @@ public class Float64Array extends def.js.Object implements Iterable<java.lang.Do
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* length+end.
|
||||
*/
|
||||
native public Float64Array fill(double value, double start, double end);
|
||||
native public Float64Array fill(double value, int start, int end);
|
||||
/**
|
||||
* Returns the elements of an array that meet the condition specified in a callback function.
|
||||
* @param callbackfn A function that accepts up to three arguments. The filter method calls
|
||||
@ -91,7 +91,7 @@ public class Float64Array extends def.js.Object implements Iterable<java.lang.Do
|
||||
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
|
||||
* search starts at index 0.
|
||||
*/
|
||||
native public double indexOf(double searchElement, double fromIndex);
|
||||
native public double indexOf(double searchElement, int fromIndex);
|
||||
/**
|
||||
* Adds all the elements of an array separated by the specified separator string.
|
||||
* @param separator A string used to separate one element of an array from the next in the
|
||||
@ -104,11 +104,11 @@ public class Float64Array extends def.js.Object implements Iterable<java.lang.Do
|
||||
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
|
||||
* search starts at index 0.
|
||||
*/
|
||||
native public double lastIndexOf(double searchElement, double fromIndex);
|
||||
native public double lastIndexOf(double searchElement, int fromIndex);
|
||||
/**
|
||||
* The length of the array.
|
||||
*/
|
||||
public final double length=0;
|
||||
public final int length=0;
|
||||
/**
|
||||
* Calls a defined callback function on each element of an array, and returns an array that
|
||||
* contains the results.
|
||||
@ -171,19 +171,19 @@ public class Float64Array extends def.js.Object implements Iterable<java.lang.Do
|
||||
* @param index The index of the location to set.
|
||||
* @param value The value to set.
|
||||
*/
|
||||
native public void set(double index, double value);
|
||||
native public void set(int index, double value);
|
||||
/**
|
||||
* Sets a value or an array of values.
|
||||
* @param array A typed or untyped array of values to set.
|
||||
* @param offset The index in the current array at which the values are to be written.
|
||||
*/
|
||||
native public void set(ArrayLike<Double> array, double offset);
|
||||
native public void set(ArrayLike<Double> array, int offset);
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
* @param start The beginning of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array.
|
||||
*/
|
||||
native public Float64Array slice(double start, double end);
|
||||
native public Float64Array slice(int start, int end);
|
||||
/**
|
||||
* Determines whether the specified callback function returns true for any element of an array.
|
||||
* @param callbackfn A function that accepts up to three arguments. The some method calls the
|
||||
@ -205,7 +205,7 @@ public class Float64Array extends def.js.Object implements Iterable<java.lang.Do
|
||||
* @param begin The index of the beginning of the array.
|
||||
* @param end The index of the end of the array.
|
||||
*/
|
||||
native public Float64Array subarray(double begin, double end);
|
||||
native public Float64Array subarray(int begin, int end);
|
||||
/**
|
||||
* Converts a number to a string by using the current locale.
|
||||
*/
|
||||
@ -214,11 +214,12 @@ public class Float64Array extends def.js.Object implements Iterable<java.lang.Do
|
||||
* Returns a string representation of an array.
|
||||
*/
|
||||
native public java.lang.String toString();
|
||||
native public java.lang.Double $get(double index);
|
||||
native public java.lang.Double $get(int index);
|
||||
native public void $set(int index, java.lang.Double value);
|
||||
public static final Float64Array prototype=null;
|
||||
public Float64Array(double length){}
|
||||
public Float64Array(int length){}
|
||||
public Float64Array(ArrayLike<Double> array){}
|
||||
public Float64Array(ArrayBuffer buffer, double byteOffset, double length){}
|
||||
public Float64Array(ArrayBuffer buffer, int byteOffset, int length){}
|
||||
/**
|
||||
* Returns a new array from a set of elements.
|
||||
* @param items A set of elements to include in the new array object.
|
||||
@ -240,7 +241,7 @@ public class Float64Array extends def.js.Object implements Iterable<java.lang.Do
|
||||
* is treated as length+end.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
*/
|
||||
native public Float64Array copyWithin(double target, double start);
|
||||
native public Float64Array copyWithin(double target, int start);
|
||||
/**
|
||||
* Determines whether all the members of an array satisfy the specified test.
|
||||
* @param callbackfn A function that accepts up to three arguments. The every method calls
|
||||
@ -258,7 +259,7 @@ public class Float64Array extends def.js.Object implements Iterable<java.lang.Do
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* length+end.
|
||||
*/
|
||||
native public Float64Array fill(double value, double start);
|
||||
native public Float64Array fill(double value, int start);
|
||||
/**
|
||||
* Returns the this object after filling the section identified by start and end with value
|
||||
* @param value value to fill array section with
|
||||
@ -366,7 +367,7 @@ public class Float64Array extends def.js.Object implements Iterable<java.lang.Do
|
||||
* @param start The beginning of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array.
|
||||
*/
|
||||
native public Float64Array slice(double start);
|
||||
native public Float64Array slice(int start);
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
* @param start The beginning of the specified portion of the array.
|
||||
@ -394,8 +395,8 @@ public class Float64Array extends def.js.Object implements Iterable<java.lang.Do
|
||||
* @param begin The index of the beginning of the array.
|
||||
* @param end The index of the end of the array.
|
||||
*/
|
||||
native public Float64Array subarray(double begin);
|
||||
public Float64Array(ArrayBuffer buffer, double byteOffset){}
|
||||
native public Float64Array subarray(int begin);
|
||||
public Float64Array(ArrayBuffer buffer, int byteOffset){}
|
||||
public Float64Array(ArrayBuffer buffer){}
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
@ -416,7 +417,7 @@ public class Float64Array extends def.js.Object implements Iterable<java.lang.Do
|
||||
* @param array A typed or untyped array of values to set.
|
||||
* @param offset The index in the current array at which the values are to be written.
|
||||
*/
|
||||
native public void set(Double[] array, double offset);
|
||||
native public void set(Double[] array, int offset);
|
||||
public Float64Array(Double[] array){}
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
|
||||
@ -4,11 +4,11 @@ import jsweet.util.function.Function4;
|
||||
* A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the
|
||||
* requested number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
public class Uint32Array extends def.js.Object implements Iterable<java.lang.Double> {
|
||||
public class Uint32Array extends def.js.Object implements Iterable<java.lang.Integer> {
|
||||
/**
|
||||
* The size in bytes of each element in the array.
|
||||
*/
|
||||
public final double BYTES_PER_ELEMENT=0;
|
||||
public final int BYTES_PER_ELEMENT=0;
|
||||
/**
|
||||
* The ArrayBuffer instance referenced by the array.
|
||||
*/
|
||||
@ -16,11 +16,11 @@ public class Uint32Array extends def.js.Object implements Iterable<java.lang.Dou
|
||||
/**
|
||||
* The length in bytes of the array.
|
||||
*/
|
||||
public final double byteLength=0;
|
||||
public final int byteLength=0;
|
||||
/**
|
||||
* The offset in bytes of the array.
|
||||
*/
|
||||
public final double byteOffset=0;
|
||||
public final int byteOffset=0;
|
||||
/**
|
||||
* Returns the this object after copying a section of the array identified by start and end
|
||||
* to the same array starting at position target
|
||||
@ -30,7 +30,7 @@ public class Uint32Array extends def.js.Object implements Iterable<java.lang.Dou
|
||||
* is treated as length+end.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
*/
|
||||
native public Uint32Array copyWithin(double target, double start, double end);
|
||||
native public Uint32Array copyWithin(double target, int start, int end);
|
||||
/**
|
||||
* Determines whether all the members of an array satisfy the specified test.
|
||||
* @param callbackfn A function that accepts up to three arguments. The every method calls
|
||||
@ -48,7 +48,7 @@ public class Uint32Array extends def.js.Object implements Iterable<java.lang.Dou
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* length+end.
|
||||
*/
|
||||
native public Uint32Array fill(double value, double start, double end);
|
||||
native public Uint32Array fill(int value, int start, int end);
|
||||
/**
|
||||
* Returns the elements of an array that meet the condition specified in a callback function.
|
||||
* @param callbackfn A function that accepts up to three arguments. The filter method calls
|
||||
@ -91,7 +91,7 @@ public class Uint32Array extends def.js.Object implements Iterable<java.lang.Dou
|
||||
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
|
||||
* search starts at index 0.
|
||||
*/
|
||||
native public double indexOf(double searchElement, double fromIndex);
|
||||
native public double indexOf(int searchElement, int fromIndex);
|
||||
/**
|
||||
* Adds all the elements of an array separated by the specified separator string.
|
||||
* @param separator A string used to separate one element of an array from the next in the
|
||||
@ -104,11 +104,11 @@ public class Uint32Array extends def.js.Object implements Iterable<java.lang.Dou
|
||||
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
|
||||
* search starts at index 0.
|
||||
*/
|
||||
native public double lastIndexOf(double searchElement, double fromIndex);
|
||||
native public double lastIndexOf(int searchElement, int fromIndex);
|
||||
/**
|
||||
* The length of the array.
|
||||
*/
|
||||
public final double length=0;
|
||||
public final int length=0;
|
||||
/**
|
||||
* Calls a defined callback function on each element of an array, and returns an array that
|
||||
* contains the results.
|
||||
@ -128,7 +128,7 @@ public class Uint32Array extends def.js.Object implements Iterable<java.lang.Dou
|
||||
* the accumulation. The first call to the callbackfn function provides this value as an argument
|
||||
* instead of an array value.
|
||||
*/
|
||||
native public double reduce(Function4<Double,Double,Double,Uint32Array,Double> callbackfn, double initialValue);
|
||||
native public double reduce(Function4<Double,Double,Double,Uint32Array,Double> callbackfn, int initialValue);
|
||||
/**
|
||||
* Calls the specified callback function for all the elements in an array. The return value of
|
||||
* the callback function is the accumulated result, and is provided as an argument in the next
|
||||
@ -150,7 +150,7 @@ public class Uint32Array extends def.js.Object implements Iterable<java.lang.Dou
|
||||
* the accumulation. The first call to the callbackfn function provides this value as an
|
||||
* argument instead of an array value.
|
||||
*/
|
||||
native public double reduceRight(Function4<Double,Double,Double,Uint32Array,Double> callbackfn, double initialValue);
|
||||
native public double reduceRight(Function4<Double,Double,Double,Uint32Array,Double> callbackfn, int initialValue);
|
||||
/**
|
||||
* Calls the specified callback function for all the elements in an array, in descending order.
|
||||
* The return value of the callback function is the accumulated result, and is provided as an
|
||||
@ -171,19 +171,19 @@ public class Uint32Array extends def.js.Object implements Iterable<java.lang.Dou
|
||||
* @param index The index of the location to set.
|
||||
* @param value The value to set.
|
||||
*/
|
||||
native public void set(double index, double value);
|
||||
native public void set(int index, int value);
|
||||
/**
|
||||
* Sets a value or an array of values.
|
||||
* @param array A typed or untyped array of values to set.
|
||||
* @param offset The index in the current array at which the values are to be written.
|
||||
*/
|
||||
native public void set(ArrayLike<Double> array, double offset);
|
||||
native public void set(ArrayLike<Double> array, int offset);
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
* @param start The beginning of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array.
|
||||
*/
|
||||
native public Uint32Array slice(double start, double end);
|
||||
native public Uint32Array slice(int start, int end);
|
||||
/**
|
||||
* Determines whether the specified callback function returns true for any element of an array.
|
||||
* @param callbackfn A function that accepts up to three arguments. The some method calls the
|
||||
@ -205,7 +205,7 @@ public class Uint32Array extends def.js.Object implements Iterable<java.lang.Dou
|
||||
* @param begin The index of the beginning of the array.
|
||||
* @param end The index of the end of the array.
|
||||
*/
|
||||
native public Uint32Array subarray(double begin, double end);
|
||||
native public Uint32Array subarray(int begin, int end);
|
||||
/**
|
||||
* Converts a number to a string by using the current locale.
|
||||
*/
|
||||
@ -214,11 +214,12 @@ public class Uint32Array extends def.js.Object implements Iterable<java.lang.Dou
|
||||
* Returns a string representation of an array.
|
||||
*/
|
||||
native public java.lang.String toString();
|
||||
native public java.lang.Double $get(double index);
|
||||
native public java.lang.Integer $get(int index);
|
||||
native public void $set(int index, java.lang.Integer value);
|
||||
public static final Uint32Array prototype=null;
|
||||
public Uint32Array(double length){}
|
||||
public Uint32Array(int length){}
|
||||
public Uint32Array(ArrayLike<Double> array){}
|
||||
public Uint32Array(ArrayBuffer buffer, double byteOffset, double length){}
|
||||
public Uint32Array(ArrayBuffer buffer, int byteOffset, int length){}
|
||||
/**
|
||||
* Returns a new array from a set of elements.
|
||||
* @param items A set of elements to include in the new array object.
|
||||
@ -240,7 +241,7 @@ public class Uint32Array extends def.js.Object implements Iterable<java.lang.Dou
|
||||
* is treated as length+end.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
*/
|
||||
native public Uint32Array copyWithin(double target, double start);
|
||||
native public Uint32Array copyWithin(double target, int start);
|
||||
/**
|
||||
* Determines whether all the members of an array satisfy the specified test.
|
||||
* @param callbackfn A function that accepts up to three arguments. The every method calls
|
||||
@ -258,7 +259,7 @@ public class Uint32Array extends def.js.Object implements Iterable<java.lang.Dou
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* length+end.
|
||||
*/
|
||||
native public Uint32Array fill(double value, double start);
|
||||
native public Uint32Array fill(int value, int start);
|
||||
/**
|
||||
* Returns the this object after filling the section identified by start and end with value
|
||||
* @param value value to fill array section with
|
||||
@ -267,7 +268,7 @@ public class Uint32Array extends def.js.Object implements Iterable<java.lang.Dou
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* length+end.
|
||||
*/
|
||||
native public Uint32Array fill(double value);
|
||||
native public Uint32Array fill(int value);
|
||||
/**
|
||||
* Returns the elements of an array that meet the condition specified in a callback function.
|
||||
* @param callbackfn A function that accepts up to three arguments. The filter method calls
|
||||
@ -310,7 +311,7 @@ public class Uint32Array extends def.js.Object implements Iterable<java.lang.Dou
|
||||
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
|
||||
* search starts at index 0.
|
||||
*/
|
||||
native public double indexOf(double searchElement);
|
||||
native public int indexOf(int searchElement);
|
||||
/**
|
||||
* Adds all the elements of an array separated by the specified separator string.
|
||||
* @param separator A string used to separate one element of an array from the next in the
|
||||
@ -323,7 +324,7 @@ public class Uint32Array extends def.js.Object implements Iterable<java.lang.Dou
|
||||
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
|
||||
* search starts at index 0.
|
||||
*/
|
||||
native public double lastIndexOf(double searchElement);
|
||||
native public int lastIndexOf(int searchElement);
|
||||
/**
|
||||
* Calls a defined callback function on each element of an array, and returns an array that
|
||||
* contains the results.
|
||||
@ -366,7 +367,7 @@ public class Uint32Array extends def.js.Object implements Iterable<java.lang.Dou
|
||||
* @param start The beginning of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array.
|
||||
*/
|
||||
native public Uint32Array slice(double start);
|
||||
native public Uint32Array slice(int start);
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
* @param start The beginning of the specified portion of the array.
|
||||
@ -394,8 +395,8 @@ public class Uint32Array extends def.js.Object implements Iterable<java.lang.Dou
|
||||
* @param begin The index of the beginning of the array.
|
||||
* @param end The index of the end of the array.
|
||||
*/
|
||||
native public Uint32Array subarray(double begin);
|
||||
public Uint32Array(ArrayBuffer buffer, double byteOffset){}
|
||||
native public Uint32Array subarray(int begin);
|
||||
public Uint32Array(ArrayBuffer buffer, int byteOffset){}
|
||||
public Uint32Array(ArrayBuffer buffer){}
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
@ -416,7 +417,7 @@ public class Uint32Array extends def.js.Object implements Iterable<java.lang.Dou
|
||||
* @param array A typed or untyped array of values to set.
|
||||
* @param offset The index in the current array at which the values are to be written.
|
||||
*/
|
||||
native public void set(Double[] array, double offset);
|
||||
native public void set(Double[] array, int offset);
|
||||
public Uint32Array(Double[] array){}
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
@ -447,7 +448,7 @@ public class Uint32Array extends def.js.Object implements Iterable<java.lang.Dou
|
||||
native public static Uint32Array from(Double[] arrayLike);
|
||||
/** From Iterable, to allow foreach loop (do not use directly). */
|
||||
@jsweet.lang.Erased
|
||||
native public java.util.Iterator<java.lang.Double> iterator();
|
||||
native public java.util.Iterator<java.lang.Integer> iterator();
|
||||
protected Uint32Array(){}
|
||||
}
|
||||
|
||||
|
||||
@ -382,7 +382,7 @@ public final class Lang {
|
||||
native public static Integer integer(def.js.Number number);
|
||||
|
||||
/**
|
||||
* Casts back a JavaScript number to a Java integer.
|
||||
* Casts a JavaScript number to a Java double.
|
||||
*/
|
||||
native public static Double number(def.js.Number number);
|
||||
|
||||
@ -702,6 +702,6 @@ public final class Lang {
|
||||
*
|
||||
* @see def.js.Globals#eval(String)
|
||||
*/
|
||||
public static native String $insert(String typescriptString);
|
||||
public static native <T> T $insert(String typescriptString);
|
||||
|
||||
}
|
||||
|
||||
@ -5,11 +5,11 @@ import jsweet.util.function.Function4;
|
||||
* of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
@jsweet.lang.SyntacticIterable
|
||||
public class Float32Array extends Iterable<java.lang.Double> {
|
||||
public class Float32Array extends Iterable<java.lang.Float> {
|
||||
/**
|
||||
* The size in bytes of each element in the array.
|
||||
*/
|
||||
public double BYTES_PER_ELEMENT;
|
||||
public int BYTES_PER_ELEMENT;
|
||||
/**
|
||||
* The ArrayBuffer instance referenced by the array.
|
||||
*/
|
||||
@ -17,11 +17,11 @@ public class Float32Array extends Iterable<java.lang.Double> {
|
||||
/**
|
||||
* The length in bytes of the array.
|
||||
*/
|
||||
public double byteLength;
|
||||
public int byteLength;
|
||||
/**
|
||||
* The offset in bytes of the array.
|
||||
*/
|
||||
public double byteOffset;
|
||||
public int byteOffset;
|
||||
/**
|
||||
* Returns the this object after copying a section of the array identified by start and end
|
||||
* to the same array starting at position target
|
||||
@ -31,7 +31,7 @@ public class Float32Array extends Iterable<java.lang.Double> {
|
||||
* is treated as length+end.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
*/
|
||||
native public Float32Array copyWithin(double target, double start, double end);
|
||||
native public Float32Array copyWithin(double target, int start, int end);
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
@ -53,7 +53,7 @@ public class Float32Array extends Iterable<java.lang.Double> {
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* length+end.
|
||||
*/
|
||||
native public Float32Array fill(double value, double start, double end);
|
||||
native public Float32Array fill(double value, int start, int end);
|
||||
/**
|
||||
* Returns the elements of an array that meet the condition specified in a callback function.
|
||||
* @param callbackfn A function that accepts up to three arguments. The filter method calls
|
||||
@ -96,7 +96,7 @@ public class Float32Array extends Iterable<java.lang.Double> {
|
||||
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
|
||||
* search starts at index 0.
|
||||
*/
|
||||
native public double indexOf(double searchElement, double fromIndex);
|
||||
native public int indexOf(double searchElement, int fromIndex);
|
||||
/**
|
||||
* Adds all the elements of an array separated by the specified separator string.
|
||||
* @param separator A string used to separate one element of an array from the next in the
|
||||
@ -113,11 +113,11 @@ public class Float32Array extends Iterable<java.lang.Double> {
|
||||
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
|
||||
* search starts at index 0.
|
||||
*/
|
||||
native public double lastIndexOf(double searchElement, double fromIndex);
|
||||
native public int lastIndexOf(double searchElement, int fromIndex);
|
||||
/**
|
||||
* The length of the array.
|
||||
*/
|
||||
public double length;
|
||||
public int length;
|
||||
/**
|
||||
* Calls a defined callback function on each element of an array, and returns an array that
|
||||
* contains the results.
|
||||
@ -180,19 +180,19 @@ public class Float32Array extends Iterable<java.lang.Double> {
|
||||
* @param index The index of the location to set.
|
||||
* @param value The value to set.
|
||||
*/
|
||||
native public void set(double index, double value);
|
||||
native public void set(int index, double value);
|
||||
/**
|
||||
* Sets a value or an array of values.
|
||||
* @param array A typed or untyped array of values to set.
|
||||
* @param offset The index in the current array at which the values are to be written.
|
||||
*/
|
||||
native public void set(Float32Array array, double offset);
|
||||
native public void set(Float32Array array, int offset);
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
* @param start The beginning of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array.
|
||||
*/
|
||||
native public Float32Array slice(double start, double end);
|
||||
native public Float32Array slice(int start, int end);
|
||||
/**
|
||||
* Determines whether the specified callback function returns true for any element of an array.
|
||||
* @param callbackfn A function that accepts up to three arguments. The some method calls the
|
||||
@ -214,17 +214,18 @@ public class Float32Array extends Iterable<java.lang.Double> {
|
||||
* @param begin The index of the beginning of the array.
|
||||
* @param end The index of the end of the array.
|
||||
*/
|
||||
native public Float32Array subarray(double begin, double end);
|
||||
native public Float32Array subarray(int begin, int end);
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
native public IterableIterator<Double> values();
|
||||
native public java.lang.Double $get(double index);
|
||||
native public java.lang.Float $get(int index);
|
||||
native public void $set(int index, java.lang.Float value);
|
||||
public static Float32Array prototype;
|
||||
public Float32Array(double length){}
|
||||
public Float32Array(int length){}
|
||||
public Float32Array(Float32Array array){}
|
||||
public Float32Array(double[] array){}
|
||||
public Float32Array(ArrayBuffer buffer, double byteOffset, double length){}
|
||||
public Float32Array(ArrayBuffer buffer, int byteOffset, int length){}
|
||||
/**
|
||||
* Returns a new array from a set of elements.
|
||||
* @param items A set of elements to include in the new array object.
|
||||
@ -246,7 +247,7 @@ public class Float32Array extends Iterable<java.lang.Double> {
|
||||
* is treated as length+end.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
*/
|
||||
native public Float32Array copyWithin(double target, double start);
|
||||
native public Float32Array copyWithin(double target, int start);
|
||||
/**
|
||||
* Determines whether all the members of an array satisfy the specified test.
|
||||
* @param callbackfn A function that accepts up to three arguments. The every method calls
|
||||
@ -264,7 +265,7 @@ public class Float32Array extends Iterable<java.lang.Double> {
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* length+end.
|
||||
*/
|
||||
native public Float32Array fill(double value, double start);
|
||||
native public Float32Array fill(double value, int start);
|
||||
/**
|
||||
* Returns the this object after filling the section identified by start and end with value
|
||||
* @param value value to fill array section with
|
||||
@ -372,7 +373,7 @@ public class Float32Array extends Iterable<java.lang.Double> {
|
||||
* @param start The beginning of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array.
|
||||
*/
|
||||
native public Float32Array slice(double start);
|
||||
native public Float32Array slice(int start);
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
* @param start The beginning of the specified portion of the array.
|
||||
@ -400,8 +401,8 @@ public class Float32Array extends Iterable<java.lang.Double> {
|
||||
* @param begin The index of the beginning of the array.
|
||||
* @param end The index of the end of the array.
|
||||
*/
|
||||
native public Float32Array subarray(double begin);
|
||||
public Float32Array(ArrayBuffer buffer, double byteOffset){}
|
||||
native public Float32Array subarray(int begin);
|
||||
public Float32Array(ArrayBuffer buffer, int byteOffset){}
|
||||
public Float32Array(ArrayBuffer buffer){}
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
@ -461,7 +462,7 @@ public class Float32Array extends Iterable<java.lang.Double> {
|
||||
native public static Float32Array from(Double[] arrayLike);
|
||||
/** From Iterable, to allow foreach loop (do not use directly). */
|
||||
@jsweet.lang.Erased
|
||||
native public java.util.Iterator<java.lang.Double> iterator();
|
||||
native public java.util.Iterator<java.lang.Float> iterator();
|
||||
protected Float32Array(){}
|
||||
}
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ public class Float64Array extends Iterable<java.lang.Double> {
|
||||
/**
|
||||
* The size in bytes of each element in the array.
|
||||
*/
|
||||
public double BYTES_PER_ELEMENT;
|
||||
public int BYTES_PER_ELEMENT;
|
||||
/**
|
||||
* The ArrayBuffer instance referenced by the array.
|
||||
*/
|
||||
@ -17,11 +17,11 @@ public class Float64Array extends Iterable<java.lang.Double> {
|
||||
/**
|
||||
* The length in bytes of the array.
|
||||
*/
|
||||
public double byteLength;
|
||||
public int byteLength;
|
||||
/**
|
||||
* The offset in bytes of the array.
|
||||
*/
|
||||
public double byteOffset;
|
||||
public int byteOffset;
|
||||
/**
|
||||
* Returns the this object after copying a section of the array identified by start and end
|
||||
* to the same array starting at position target
|
||||
@ -31,7 +31,7 @@ public class Float64Array extends Iterable<java.lang.Double> {
|
||||
* is treated as length+end.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
*/
|
||||
native public Float64Array copyWithin(double target, double start, double end);
|
||||
native public Float64Array copyWithin(double target, int start, int end);
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
@ -53,7 +53,7 @@ public class Float64Array extends Iterable<java.lang.Double> {
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* length+end.
|
||||
*/
|
||||
native public Float64Array fill(double value, double start, double end);
|
||||
native public Float64Array fill(double value, int start, int end);
|
||||
/**
|
||||
* Returns the elements of an array that meet the condition specified in a callback function.
|
||||
* @param callbackfn A function that accepts up to three arguments. The filter method calls
|
||||
@ -96,7 +96,7 @@ public class Float64Array extends Iterable<java.lang.Double> {
|
||||
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
|
||||
* search starts at index 0.
|
||||
*/
|
||||
native public double indexOf(double searchElement, double fromIndex);
|
||||
native public double indexOf(double searchElement, int fromIndex);
|
||||
/**
|
||||
* Adds all the elements of an array separated by the specified separator string.
|
||||
* @param separator A string used to separate one element of an array from the next in the
|
||||
@ -113,11 +113,11 @@ public class Float64Array extends Iterable<java.lang.Double> {
|
||||
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
|
||||
* search starts at index 0.
|
||||
*/
|
||||
native public double lastIndexOf(double searchElement, double fromIndex);
|
||||
native public double lastIndexOf(double searchElement, int fromIndex);
|
||||
/**
|
||||
* The length of the array.
|
||||
*/
|
||||
public double length;
|
||||
public int length;
|
||||
/**
|
||||
* Calls a defined callback function on each element of an array, and returns an array that
|
||||
* contains the results.
|
||||
@ -180,19 +180,19 @@ public class Float64Array extends Iterable<java.lang.Double> {
|
||||
* @param index The index of the location to set.
|
||||
* @param value The value to set.
|
||||
*/
|
||||
native public void set(double index, double value);
|
||||
native public void set(int index, double value);
|
||||
/**
|
||||
* Sets a value or an array of values.
|
||||
* @param array A typed or untyped array of values to set.
|
||||
* @param offset The index in the current array at which the values are to be written.
|
||||
*/
|
||||
native public void set(Float64Array array, double offset);
|
||||
native public void set(Float64Array array, int offset);
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
* @param start The beginning of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array.
|
||||
*/
|
||||
native public Float64Array slice(double start, double end);
|
||||
native public Float64Array slice(double start, int end);
|
||||
/**
|
||||
* Determines whether the specified callback function returns true for any element of an array.
|
||||
* @param callbackfn A function that accepts up to three arguments. The some method calls the
|
||||
@ -214,17 +214,18 @@ public class Float64Array extends Iterable<java.lang.Double> {
|
||||
* @param begin The index of the beginning of the array.
|
||||
* @param end The index of the end of the array.
|
||||
*/
|
||||
native public Float64Array subarray(double begin, double end);
|
||||
native public Float64Array subarray(int begin, int end);
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
native public IterableIterator<Double> values();
|
||||
native public java.lang.Double $get(double index);
|
||||
native public java.lang.Double $get(int index);
|
||||
native public void $set(int index, java.lang.Double value);
|
||||
public static Float64Array prototype;
|
||||
public Float64Array(double length){}
|
||||
public Float64Array(int length){}
|
||||
public Float64Array(Float64Array array){}
|
||||
public Float64Array(double[] array){}
|
||||
public Float64Array(ArrayBuffer buffer, double byteOffset, double length){}
|
||||
public Float64Array(ArrayBuffer buffer, int byteOffset, int length){}
|
||||
/**
|
||||
* Returns a new array from a set of elements.
|
||||
* @param items A set of elements to include in the new array object.
|
||||
@ -246,7 +247,7 @@ public class Float64Array extends Iterable<java.lang.Double> {
|
||||
* is treated as length+end.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
*/
|
||||
native public Float64Array copyWithin(double target, double start);
|
||||
native public Float64Array copyWithin(double target, int start);
|
||||
/**
|
||||
* Determines whether all the members of an array satisfy the specified test.
|
||||
* @param callbackfn A function that accepts up to three arguments. The every method calls
|
||||
@ -264,7 +265,7 @@ public class Float64Array extends Iterable<java.lang.Double> {
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* length+end.
|
||||
*/
|
||||
native public Float64Array fill(double value, double start);
|
||||
native public Float64Array fill(double value, int start);
|
||||
/**
|
||||
* Returns the this object after filling the section identified by start and end with value
|
||||
* @param value value to fill array section with
|
||||
@ -400,8 +401,8 @@ public class Float64Array extends Iterable<java.lang.Double> {
|
||||
* @param begin The index of the beginning of the array.
|
||||
* @param end The index of the end of the array.
|
||||
*/
|
||||
native public Float64Array subarray(double begin);
|
||||
public Float64Array(ArrayBuffer buffer, double byteOffset){}
|
||||
native public Float64Array subarray(int begin);
|
||||
public Float64Array(ArrayBuffer buffer, int byteOffset){}
|
||||
public Float64Array(ArrayBuffer buffer){}
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
package def.js;
|
||||
@jsweet.lang.Interface
|
||||
public abstract class Iterable<T> extends def.js.Object {
|
||||
public abstract class Iterable<T> extends def.js.Object implements java.lang.Iterable<T> {
|
||||
}
|
||||
|
||||
|
||||
@ -5,11 +5,11 @@ import jsweet.util.function.Function4;
|
||||
* requested number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
@jsweet.lang.SyntacticIterable
|
||||
public class Uint32Array extends Iterable<java.lang.Double> {
|
||||
public class Uint32Array extends Iterable<java.lang.Integer> {
|
||||
/**
|
||||
* The size in bytes of each element in the array.
|
||||
*/
|
||||
public double BYTES_PER_ELEMENT;
|
||||
public int BYTES_PER_ELEMENT;
|
||||
/**
|
||||
* The ArrayBuffer instance referenced by the array.
|
||||
*/
|
||||
@ -17,11 +17,11 @@ public class Uint32Array extends Iterable<java.lang.Double> {
|
||||
/**
|
||||
* The length in bytes of the array.
|
||||
*/
|
||||
public double byteLength;
|
||||
public int byteLength;
|
||||
/**
|
||||
* The offset in bytes of the array.
|
||||
*/
|
||||
public double byteOffset;
|
||||
public int byteOffset;
|
||||
/**
|
||||
* Returns the this object after copying a section of the array identified by start and end
|
||||
* to the same array starting at position target
|
||||
@ -31,7 +31,7 @@ public class Uint32Array extends Iterable<java.lang.Double> {
|
||||
* is treated as length+end.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
*/
|
||||
native public Uint32Array copyWithin(double target, double start, double end);
|
||||
native public Uint32Array copyWithin(double target, int start, int end);
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
@ -53,7 +53,7 @@ public class Uint32Array extends Iterable<java.lang.Double> {
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* length+end.
|
||||
*/
|
||||
native public Uint32Array fill(double value, double start, double end);
|
||||
native public Uint32Array fill(int value, int start, int end);
|
||||
/**
|
||||
* Returns the elements of an array that meet the condition specified in a callback function.
|
||||
* @param callbackfn A function that accepts up to three arguments. The filter method calls
|
||||
@ -96,7 +96,7 @@ public class Uint32Array extends Iterable<java.lang.Double> {
|
||||
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
|
||||
* search starts at index 0.
|
||||
*/
|
||||
native public double indexOf(double searchElement, double fromIndex);
|
||||
native public double indexOf(int searchElement, int fromIndex);
|
||||
/**
|
||||
* Adds all the elements of an array separated by the specified separator string.
|
||||
* @param separator A string used to separate one element of an array from the next in the
|
||||
@ -113,11 +113,11 @@ public class Uint32Array extends Iterable<java.lang.Double> {
|
||||
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
|
||||
* search starts at index 0.
|
||||
*/
|
||||
native public double lastIndexOf(double searchElement, double fromIndex);
|
||||
native public double lastIndexOf(int searchElement, int fromIndex);
|
||||
/**
|
||||
* The length of the array.
|
||||
*/
|
||||
public double length;
|
||||
public int length;
|
||||
/**
|
||||
* Calls a defined callback function on each element of an array, and returns an array that
|
||||
* contains the results.
|
||||
@ -180,19 +180,19 @@ public class Uint32Array extends Iterable<java.lang.Double> {
|
||||
* @param index The index of the location to set.
|
||||
* @param value The value to set.
|
||||
*/
|
||||
native public void set(double index, double value);
|
||||
native public void set(int index, int value);
|
||||
/**
|
||||
* Sets a value or an array of values.
|
||||
* @param array A typed or untyped array of values to set.
|
||||
* @param offset The index in the current array at which the values are to be written.
|
||||
*/
|
||||
native public void set(Uint32Array array, double offset);
|
||||
native public void set(Uint32Array array, int offset);
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
* @param start The beginning of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array.
|
||||
*/
|
||||
native public Uint32Array slice(double start, double end);
|
||||
native public Uint32Array slice(int start, int end);
|
||||
/**
|
||||
* Determines whether the specified callback function returns true for any element of an array.
|
||||
* @param callbackfn A function that accepts up to three arguments. The some method calls the
|
||||
@ -214,17 +214,18 @@ public class Uint32Array extends Iterable<java.lang.Double> {
|
||||
* @param begin The index of the beginning of the array.
|
||||
* @param end The index of the end of the array.
|
||||
*/
|
||||
native public Uint32Array subarray(double begin, double end);
|
||||
native public Uint32Array subarray(int begin, int end);
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
native public IterableIterator<Double> values();
|
||||
native public java.lang.Double $get(double index);
|
||||
native public java.lang.Double $get(int index);
|
||||
native public void $set(int index, java.lang.Integer value);
|
||||
public static Uint32Array prototype;
|
||||
public Uint32Array(double length){}
|
||||
public Uint32Array(int length){}
|
||||
public Uint32Array(Uint32Array array){}
|
||||
public Uint32Array(double[] array){}
|
||||
public Uint32Array(ArrayBuffer buffer, double byteOffset, double length){}
|
||||
public Uint32Array(ArrayBuffer buffer, int byteOffset, int length){}
|
||||
/**
|
||||
* Returns a new array from a set of elements.
|
||||
* @param items A set of elements to include in the new array object.
|
||||
@ -246,7 +247,7 @@ public class Uint32Array extends Iterable<java.lang.Double> {
|
||||
* is treated as length+end.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
*/
|
||||
native public Uint32Array copyWithin(double target, double start);
|
||||
native public Uint32Array copyWithin(double target, int start);
|
||||
/**
|
||||
* Determines whether all the members of an array satisfy the specified test.
|
||||
* @param callbackfn A function that accepts up to three arguments. The every method calls
|
||||
@ -264,7 +265,7 @@ public class Uint32Array extends Iterable<java.lang.Double> {
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* length+end.
|
||||
*/
|
||||
native public Uint32Array fill(double value, double start);
|
||||
native public Uint32Array fill(int value, int start);
|
||||
/**
|
||||
* Returns the this object after filling the section identified by start and end with value
|
||||
* @param value value to fill array section with
|
||||
@ -273,7 +274,7 @@ public class Uint32Array extends Iterable<java.lang.Double> {
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* length+end.
|
||||
*/
|
||||
native public Uint32Array fill(double value);
|
||||
native public Uint32Array fill(int value);
|
||||
/**
|
||||
* Returns the elements of an array that meet the condition specified in a callback function.
|
||||
* @param callbackfn A function that accepts up to three arguments. The filter method calls
|
||||
@ -316,7 +317,7 @@ public class Uint32Array extends Iterable<java.lang.Double> {
|
||||
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
|
||||
* search starts at index 0.
|
||||
*/
|
||||
native public double indexOf(double searchElement);
|
||||
native public int indexOf(int searchElement);
|
||||
/**
|
||||
* Adds all the elements of an array separated by the specified separator string.
|
||||
* @param separator A string used to separate one element of an array from the next in the
|
||||
@ -329,7 +330,7 @@ public class Uint32Array extends Iterable<java.lang.Double> {
|
||||
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
|
||||
* search starts at index 0.
|
||||
*/
|
||||
native public double lastIndexOf(double searchElement);
|
||||
native public int lastIndexOf(int searchElement);
|
||||
/**
|
||||
* Calls a defined callback function on each element of an array, and returns an array that
|
||||
* contains the results.
|
||||
@ -372,7 +373,7 @@ public class Uint32Array extends Iterable<java.lang.Double> {
|
||||
* @param start The beginning of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array.
|
||||
*/
|
||||
native public Uint32Array slice(double start);
|
||||
native public Uint32Array slice(int start);
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
* @param start The beginning of the specified portion of the array.
|
||||
@ -400,8 +401,8 @@ public class Uint32Array extends Iterable<java.lang.Double> {
|
||||
* @param begin The index of the beginning of the array.
|
||||
* @param end The index of the end of the array.
|
||||
*/
|
||||
native public Uint32Array subarray(double begin);
|
||||
public Uint32Array(ArrayBuffer buffer, double byteOffset){}
|
||||
native public Uint32Array subarray(int begin);
|
||||
public Uint32Array(ArrayBuffer buffer, int byteOffset){}
|
||||
public Uint32Array(ArrayBuffer buffer){}
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
@ -461,7 +462,7 @@ public class Uint32Array extends Iterable<java.lang.Double> {
|
||||
native public static Uint32Array from(Double[] arrayLike);
|
||||
/** From Iterable, to allow foreach loop (do not use directly). */
|
||||
@jsweet.lang.Erased
|
||||
native public java.util.Iterator<java.lang.Double> iterator();
|
||||
native public java.util.Iterator<java.lang.Integer> iterator();
|
||||
protected Uint32Array(){}
|
||||
}
|
||||
|
||||
|
||||
@ -382,7 +382,7 @@ public final class Lang {
|
||||
native public static Integer integer(def.js.Number number);
|
||||
|
||||
/**
|
||||
* Casts back a JavaScript number to a Java integer.
|
||||
* Casts a JavaScript number to a Java double.
|
||||
*/
|
||||
native public static Double number(def.js.Number number);
|
||||
|
||||
@ -702,6 +702,6 @@ public final class Lang {
|
||||
*
|
||||
* @see def.js.Globals#eval(String)
|
||||
*/
|
||||
public static native String $insert(String typescriptString);
|
||||
public static native <T> T $insert(String typescriptString);
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -58,10 +58,10 @@ import javax.lang.model.element.Modifier;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
import javax.lang.model.type.ArrayType;
|
||||
import javax.lang.model.type.DeclaredType;
|
||||
import javax.lang.model.type.TypeKind;
|
||||
import javax.lang.model.type.TypeMirror;
|
||||
|
||||
import org.jsweet.transpiler.JSweetContext;
|
||||
import org.jsweet.transpiler.Java2TypeScriptTranslator;
|
||||
import org.jsweet.transpiler.ModuleKind;
|
||||
import org.jsweet.transpiler.model.BinaryOperatorElement;
|
||||
import org.jsweet.transpiler.model.ExtendedElement;
|
||||
@ -218,12 +218,30 @@ public class RemoveJavaDependenciesAdapter extends Java2TypeScriptAdapter {
|
||||
case "parseLong":
|
||||
case "parseShort":
|
||||
case "parseByte":
|
||||
printMacroName(targetMethodName);
|
||||
print("parseInt").print("(").printArgList(invocation.getArguments()).print(")");
|
||||
return true;
|
||||
case "parseFloat":
|
||||
case "parseDouble":
|
||||
printMacroName(targetMethodName);
|
||||
print("parseFloat").print("(").printArgList(invocation.getArguments()).print(")");
|
||||
return true;
|
||||
case "floatToIntBits":
|
||||
case "floatToRawIntBits":
|
||||
printMacroName(targetMethodName);
|
||||
print("((f) => { let buf = new ArrayBuffer(4); (new Float32Array(buf))[0]=f; return (new Uint32Array(buf))[0]; })(").printArgList(invocation.getArguments()).print(")");
|
||||
return true;
|
||||
case "intBitsToFloat":
|
||||
print("((v) => { let buf = new ArrayBuffer(4); (new Uint32Array(buf))[0]=v; return (new Float32Array(buf))[0]; })(").printArgList(invocation.getArguments()).print(")");
|
||||
return true;
|
||||
case "doubleToLongBits":
|
||||
case "doubleToRawLongBits":
|
||||
printMacroName(targetMethodName);
|
||||
print("((f) => { let buf = new ArrayBuffer(4); (new Float32Array(buf))[0]=f; return (new Uint32Array(buf))[0]; })((<any>Math).fround(").printArgList(invocation.getArguments()).print("))");
|
||||
return true;
|
||||
case "longBitsToDouble":
|
||||
print("((v) => { let buf = new ArrayBuffer(4); (new Uint32Array(buf))[0]=v; return (new Float32Array(buf))[0]; })(").printArgList(invocation.getArguments()).print(")");
|
||||
return true;
|
||||
case "valueOf":
|
||||
if (util().isNumber(invocation.getArgument(0).getType())) {
|
||||
print(invocation.getArgument(0));
|
||||
@ -935,8 +953,29 @@ public class RemoveJavaDependenciesAdapter extends Java2TypeScriptAdapter {
|
||||
print(invocation.getTargetExpression(), delegate).print("(").printArgList(invocation.getArguments())
|
||||
.print(")");
|
||||
return true;
|
||||
case "isInstance":
|
||||
printMacroName(targetMethodName);
|
||||
print("((c:any,o:any) => { if(typeof c === 'string') return (o.constructor && o.constructor")
|
||||
.print("[\"" + Java2TypeScriptTranslator.INTERFACES_FIELD_NAME + "\"] && o.constructor")
|
||||
.print("[\"" + Java2TypeScriptTranslator.INTERFACES_FIELD_NAME
|
||||
+ "\"].indexOf(c) >= 0) || (o")
|
||||
.print("[\"" + Java2TypeScriptTranslator.INTERFACES_FIELD_NAME + "\"] && o")
|
||||
.print("[\"" + Java2TypeScriptTranslator.INTERFACES_FIELD_NAME
|
||||
+ "\"].indexOf(c) >= 0); else if(typeof c === 'function') return (o instanceof c) || (o.constructor && o.constructor === c); })(");
|
||||
print(invocation.getTargetExpression(), delegate).print(", ")
|
||||
.printArgList(invocation.getArguments()).print(")");
|
||||
return true;
|
||||
}
|
||||
|
||||
case "java.lang.reflect.Array":
|
||||
switch (targetMethodName) {
|
||||
case "newInstance":
|
||||
printMacroName(targetMethodName);
|
||||
if (invocation.getArgumentCount() == 2) {
|
||||
print("new Array<any>(").print(invocation.getArgument(1)).print(")");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch (targetMethodName) {
|
||||
|
||||
@ -55,3 +55,28 @@ class MyObject2 {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class MyObject3 {
|
||||
|
||||
MyInterface data;
|
||||
|
||||
public MyObject3(MyInterface data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof MyObject3)) {
|
||||
return false;
|
||||
}
|
||||
return data.equals(((MyObject3) obj).data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
interface MyInterface {
|
||||
|
||||
void m();
|
||||
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package source.api;
|
||||
|
||||
import static jsweet.util.Lang.$export;
|
||||
import static jsweet.util.Lang.number;
|
||||
import static jsweet.util.Lang.string;
|
||||
|
||||
import def.js.Array;
|
||||
|
||||
@ -13,6 +15,14 @@ public class Numbers {
|
||||
Integer i = parseDuration("1:20");
|
||||
assert i == 80;
|
||||
|
||||
float f = Float.intBitsToFloat(Float.floatToIntBits(3.14f));
|
||||
assert f!=3.14f;
|
||||
assert number(f).toFixed(2) == string("3.14");
|
||||
|
||||
double d = Double.longBitsToDouble(Double.doubleToLongBits(3.14));
|
||||
assert d!=3.14;
|
||||
assert ((double)Math.round(d*100))/100 == 3.14;
|
||||
|
||||
$export("trace", trace.join(","));
|
||||
}
|
||||
|
||||
|
||||
@ -1,29 +1,51 @@
|
||||
package source.nativestructures;
|
||||
|
||||
import static jsweet.util.Lang.any;
|
||||
|
||||
import def.js.Array;
|
||||
import jsweet.util.Lang;
|
||||
|
||||
public class Reflect {
|
||||
|
||||
static Array<String> trace = new Array<>();
|
||||
|
||||
public static void main(String[] args) {
|
||||
String className = "source.nativestructures.MyAccessedClass";
|
||||
|
||||
try {
|
||||
Class<?> c = Class.forName(className);
|
||||
c.newInstance();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
Lang.$export("trace", trace.join(","));
|
||||
static Array<String> trace = new Array<>();
|
||||
|
||||
public static void main(String[] args) {
|
||||
String className = "source.nativestructures.MyAccessedClass";
|
||||
Class<?> c = null;
|
||||
Object o = null;
|
||||
try {
|
||||
c = Class.forName(className);
|
||||
o = c.newInstance();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
MyAccessedClass[] array = (MyAccessedClass[]) java.lang.reflect.Array.newInstance(c, 3);
|
||||
assert array.length == 3;
|
||||
assert c.isInstance(o);
|
||||
assert MyAccessedClass.class.isInstance(o);
|
||||
assert MyAccessedInterface.class.isInstance(o);
|
||||
assert char.class.isInstance('c');
|
||||
assert "c".getClass() == String.class;
|
||||
// this works with JSweet (because chars are mapped to strings)
|
||||
assert "c".getClass() == any(char.class);
|
||||
assert "c".getClass() == any(Character.class);
|
||||
Object oo = 'c';
|
||||
assert oo.getClass().isInstance(oo);
|
||||
assert !StringBuffer.class.isInstance(o);
|
||||
//assert MyAccessedInterface.class.isAssignableFrom(MyAccessedClass.class);
|
||||
//assert c.isAssignableFrom(MyAccessedClass.class);
|
||||
Lang.$export("trace", trace.join(","));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class MyAccessedClass {
|
||||
class MyAccessedClass implements MyAccessedInterface {
|
||||
|
||||
public MyAccessedClass() {
|
||||
Reflect.trace.push("constructor");
|
||||
}
|
||||
public MyAccessedClass() {
|
||||
Reflect.trace.push("constructor");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
interface MyAccessedInterface {
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user