|
|
@@ -8,8 +8,10 @@ package net.ranides.assira.collection.arrays;
|
|
|
|
|
|
import java.io.Serializable;
|
|
|
import java.lang.reflect.Array;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.Comparator;
|
|
|
+import java.util.List;
|
|
|
import java.util.function.IntPredicate;
|
|
|
import net.ranides.assira.collection.IntComparator;
|
|
|
import net.ranides.assira.collection.Swapper;
|
|
|
@@ -18,43 +20,142 @@ import net.ranides.assira.reflection.util.ClassTraits;
|
|
|
import net.ranides.assira.reflection.util.ClassUtils;
|
|
|
|
|
|
/**
|
|
|
+ * NativeArray is a class which wraps any array (especially primitive array) and gives possibility to
|
|
|
+ * work with array in generic way (all boxing operations are done internally).
|
|
|
+ *
|
|
|
+ * It defines a bunch of methods for optimized comparing elements.
|
|
|
+ * For example, you can create IntPredicate for value "x" which checks if item at some index equals "x".
|
|
|
+ * Those predicate won't do unboxing over and over again. It will select optimized primitive operation.
|
|
|
+ *
|
|
|
+ * You can create those kind of comparators for
|
|
|
+ * equality: value == array[index]
|
|
|
+ * left comparison: compareTo(value, array[index])
|
|
|
+ * right comparison: compareTo(array[index], value)
|
|
|
+ *
|
|
|
+ * You can create optimized comparator between array elements:
|
|
|
+ * comparator(array) will return IntComparator which takes array indexes and compares elements inside array.
|
|
|
+ *
|
|
|
+ * You can create optimized function for moving elements from one array to another:
|
|
|
+ * moveTo(target) will represent operation target[index] = source[index]
|
|
|
+ * moveFrom(source) will represent operation source[index] = target[index]
|
|
|
*
|
|
|
* @author Ranides Atterwim {@literal <ranides@gmail.com>}
|
|
|
*/
|
|
|
public abstract class NativeArray implements Swapper, Comparable<NativeArray>, Cloneable, Serializable {
|
|
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Creates new array of the same type but different size.
|
|
|
+ * It is not copy or clone operation, it takes only component type from current array.
|
|
|
+ *
|
|
|
+ * @param size size
|
|
|
+ * @return NativeArray
|
|
|
+ */
|
|
|
public abstract NativeArray allocate(int size);
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Returns array wrapped inside this object.
|
|
|
+ *
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
public abstract Object array();
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Returns array wrapped inside this object.
|
|
|
+ * It infers array type.
|
|
|
+ *
|
|
|
+ * @param <Auto> array
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
@SuppressWarnings("unchecked")
|
|
|
public <Auto> Auto $array() {
|
|
|
return (Auto)array();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Returns length of array
|
|
|
+ * @return int
|
|
|
+ */
|
|
|
public abstract int size();
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Returns component type of array
|
|
|
+ * @return type
|
|
|
+ */
|
|
|
public Class<?> component() {
|
|
|
return array().getClass().getComponentType();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Sets value at specified index.
|
|
|
+ * Unboxes value if target array is primitive.
|
|
|
+ *
|
|
|
+ * @param index index
|
|
|
+ * @param value value
|
|
|
+ */
|
|
|
public abstract void set(int index, Object value);
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Sets value for all elements in provided range.
|
|
|
+ * Unboxes value (but only once) if target array is primitive.
|
|
|
+ *
|
|
|
+ * @param begin begin
|
|
|
+ * @param end end
|
|
|
+ * @param value value
|
|
|
+ */
|
|
|
public abstract void set(int begin, int end, Object value);
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Returns value stored in array at specified index
|
|
|
+ * Boxes value if target array is primitive.
|
|
|
+ *
|
|
|
+ * @param index index
|
|
|
+ * @return value
|
|
|
+ */
|
|
|
public abstract Object get(int index);
|
|
|
-
|
|
|
- public abstract NativeMove move(NativeArray source);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Returns operator, which represents assignment: target[index] = source[index]
|
|
|
+ *
|
|
|
+ * Returned operators avoid unecessary boxing/unboxing operations
|
|
|
+ *
|
|
|
+ * @param source source
|
|
|
+ * @return operator
|
|
|
+ */
|
|
|
+ public abstract NativeMove moveFrom(NativeArray source);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Returns operator, which represents assignment: source[index] = target[index]
|
|
|
+ *
|
|
|
+ * Returned operators avoid unecessary boxing/unboxing operations
|
|
|
+ *
|
|
|
+ * @param source source
|
|
|
+ * @return operator
|
|
|
+ */
|
|
|
+ public NativeMove moveTo(NativeArray source) {
|
|
|
+ return source.moveTo(this);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* Overwrites value at [index] with value from position [source].
|
|
|
+ * Avoid unecessary boxing/unboxing operations
|
|
|
+ *
|
|
|
* @param index index
|
|
|
* @param source source
|
|
|
*/
|
|
|
public abstract void move(int index, int source);
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Sets value at specified index.
|
|
|
+ * Returns previous value stored in array.
|
|
|
+ *
|
|
|
+ * Unboxes value and boxes result if target array is primitive.
|
|
|
+ *
|
|
|
+ * @param index index
|
|
|
+ * @param value value
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public Object replace(int index, Object value) {
|
|
|
Object prv = get(index);
|
|
|
set(index, value);
|
|
|
@@ -73,7 +174,13 @@ public abstract class NativeArray implements Swapper, Comparable<NativeArray>, C
|
|
|
System.arraycopy(array(), 0, ret.array(), 0, size());
|
|
|
return ret;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Allocates new array with boxed component and copies all elements into it.
|
|
|
+ * If array contains already boxed values, returns this object.
|
|
|
+ *
|
|
|
+ * @return array with boxed values
|
|
|
+ */
|
|
|
public NativeArray box() {
|
|
|
if(ClassTraits.isBoxed(component())) {
|
|
|
return this;
|
|
|
@@ -84,7 +191,13 @@ public abstract class NativeArray implements Swapper, Comparable<NativeArray>, C
|
|
|
}
|
|
|
return ret;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Allocates new array with primitive component and copies all elements into it.
|
|
|
+ * If array contains primitive boxed values, returns this object.
|
|
|
+ *
|
|
|
+ * @return array with primitive values
|
|
|
+ */
|
|
|
public NativeArray unbox() {
|
|
|
if(!ClassTraits.isBoxed(component())) {
|
|
|
return this;
|
|
|
@@ -95,29 +208,116 @@ public abstract class NativeArray implements Swapper, Comparable<NativeArray>, C
|
|
|
}
|
|
|
return ret;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Returns operator, which represents comparison: {@code value equals array[index]}
|
|
|
+ * In other words: checks if element at some "index" equals to "value"
|
|
|
+ *
|
|
|
+ * Returned operators avoid unecessary boxing/unboxing operations
|
|
|
+ *
|
|
|
+ * @param value
|
|
|
+ * @return operator
|
|
|
+ */
|
|
|
public abstract IntPredicate cmp(Object value);
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Returns operator, which represents comparison: {@code value.compareTo(array[index])}
|
|
|
+ * In other words: checks if element at some "index" is lower or greater than "value"
|
|
|
+ *
|
|
|
+ * Returned operators avoid unecessary boxing/unboxing operations
|
|
|
+ *
|
|
|
+ * @param value
|
|
|
+ * @return operator
|
|
|
+ */
|
|
|
public abstract NativeComparator lcmp(Object value);
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Returns operator, which represents comparison: {@code cmp.compareTo(value, array[index]) }
|
|
|
+ * In other words: checks if element at some "index" is lower or greater than "value" using provided comparator
|
|
|
+ *
|
|
|
+ * Because we pass values into generic comparator, all values will be boxed.
|
|
|
+ * There is optimization if you provide IntComparator for int[] arrays
|
|
|
+ *
|
|
|
+ * @param value
|
|
|
+ * @param cmp
|
|
|
+ * @return operator
|
|
|
+ */
|
|
|
@SuppressWarnings("unchecked")
|
|
|
public NativeComparator lcmp(Object value, Comparator cmp) {
|
|
|
return index -> cmp.compare(value, get(index));
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Returns operator, which represents comparison: {@code array[index].compareTo(value)}
|
|
|
+ * In other words: checks if "value" is lower or greater than element at some "index"
|
|
|
+ *
|
|
|
+ * Returned operators avoid unecessary boxing/unboxing operations
|
|
|
+ *
|
|
|
+ * @param value
|
|
|
+ * @return operator
|
|
|
+ */
|
|
|
public abstract NativeComparator rcmp(Object value);
|
|
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
|
+ /**
|
|
|
+ * Returns operator, which represents comparison: {@code cmp.compareTo(array[index], value) }
|
|
|
+ * In other words: checks if "value" is lower or greater than element at some "index" using provided comparator
|
|
|
+ *
|
|
|
+ * Because we pass values into generic comparator, all values will be boxed.
|
|
|
+ * There is optimization if you provide IntComparator for int[] arrays
|
|
|
+ *
|
|
|
+ * @param value
|
|
|
+ * @param cmp
|
|
|
+ * @return operator
|
|
|
+ */
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
public NativeComparator rcmp(Object value, Comparator cmp) {
|
|
|
return index -> cmp.compare(get(index), value);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Returns operator, which represents comparison: {@code array[index].compareTo(values[index])}
|
|
|
+ * In other words: compares elements of arrays at "index"
|
|
|
+ *
|
|
|
+ * Returned operators avoid unecessary boxing/unboxing operations
|
|
|
+ *
|
|
|
+ * @param values values
|
|
|
+ * @return operator
|
|
|
+ */
|
|
|
public abstract IntComparator comparator(NativeArray values);
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Returns operator, which represents comparison: {@code cmp.compareTo(array[index], values[index])}
|
|
|
+ * In other words: compares elements of arrays at "index" using provided comparator
|
|
|
+ *
|
|
|
+ * Because we pass values into generic comparator, all values will be boxed.
|
|
|
+ * There is optimization if you provide IntComparator for int[] arrays
|
|
|
+ *
|
|
|
+ * @param values values
|
|
|
+ * @param cmp cmp
|
|
|
+ * @return operator
|
|
|
+ */
|
|
|
public abstract IntComparator comparator(NativeArray values, Comparator cmp);
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Returns operator, which represents comparison: {@code array[index1].compareTo(array[index2])}
|
|
|
+ * In other words: compares two elements of this array
|
|
|
+ *
|
|
|
+ * Returned operators avoid unecessary boxing/unboxing operations
|
|
|
+ *
|
|
|
+ * @return operator
|
|
|
+ */
|
|
|
public abstract IntComparator comparator();
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Returns operator, which represents comparison: {@code cmp.compareTo(array[index1], array[index2])}
|
|
|
+ * In other words: compares two elements of this array using provided comparator
|
|
|
+ *
|
|
|
+ * Because we pass values into generic comparator, all values will be boxed.
|
|
|
+ * There is optimization if you provide IntComparator for int[] arrays
|
|
|
+ *
|
|
|
+ * @param cmp
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@SuppressWarnings("unchecked")
|
|
|
public IntComparator comparator(Comparator cmp) {
|
|
|
return (a,b) -> cmp.compare(get(a), get(b));
|
|
|
@@ -127,9 +327,23 @@ public abstract class NativeArray implements Swapper, Comparable<NativeArray>, C
|
|
|
public int hashCode() {
|
|
|
return NativeArray.this.hashCode(0, size());
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Calculates hashCode of element at "index"
|
|
|
+ *
|
|
|
+ * @param index index
|
|
|
+ * @return int
|
|
|
+ */
|
|
|
public abstract int hashCode(int index);
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Calculates hashCode for elements from specified range.
|
|
|
+ * It uses the same algorithm as {@link List#hashCode}
|
|
|
+ *
|
|
|
+ * @param begin begin
|
|
|
+ * @param end end
|
|
|
+ * @return int
|
|
|
+ */
|
|
|
public int hashCode(int begin, int end) {
|
|
|
int result = 1;
|
|
|
for(int i=begin; i<end; i++) {
|
|
|
@@ -137,7 +351,13 @@ public abstract class NativeArray implements Swapper, Comparable<NativeArray>, C
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Checks for equality comparing all corresponding elements.
|
|
|
+ *
|
|
|
+ * @param object object
|
|
|
+ * @return bool
|
|
|
+ */
|
|
|
@Override
|
|
|
public boolean equals(Object object) {
|
|
|
if(!(object instanceof NativeArray)) {
|
|
|
@@ -146,11 +366,26 @@ public abstract class NativeArray implements Swapper, Comparable<NativeArray>, C
|
|
|
NativeArray na = (NativeArray)object;
|
|
|
return na.size()==size() && equals(na, 0, 0, size());
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Checks for equality comparing all corresponding elements in specified range.
|
|
|
+ *
|
|
|
+ * @param object other array
|
|
|
+ * @param src start index of this array
|
|
|
+ * @param dst start index of another array
|
|
|
+ * @param size number of elements to compare
|
|
|
+ * @return bool
|
|
|
+ */
|
|
|
public boolean equals(NativeArray object, int src, int dst, int size) {
|
|
|
return 0 == compareTo(object, src, dst, size);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Compares all corresponding elements.
|
|
|
+ *
|
|
|
+ * @param object object
|
|
|
+ * @return int
|
|
|
+ */
|
|
|
@Override
|
|
|
public int compareTo(NativeArray object) {
|
|
|
int a = size();
|
|
|
@@ -158,14 +393,30 @@ public abstract class NativeArray implements Swapper, Comparable<NativeArray>, C
|
|
|
int c = compareTo(object, 0, 0, Math.min(a,b));
|
|
|
return 0 != c ? c : Integer.compare(a, b);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Compares all corresponding elements using provided comparator.
|
|
|
+ *
|
|
|
+ * @param object object
|
|
|
+ * @param comp comp
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public int compareTo(NativeArray object, Comparator comp) {
|
|
|
int a = size();
|
|
|
int b = object.size();
|
|
|
int c = compareTo(object, 0, 0, Math.min(a,b), comp);
|
|
|
return 0 != c ? c : Integer.compare(a, b);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Compares all corresponding elements in specified range.
|
|
|
+ *
|
|
|
+ * @param object other array
|
|
|
+ * @param src start index of this array
|
|
|
+ * @param dst start index of other array
|
|
|
+ * @param size number of elements to compare
|
|
|
+ * @return int
|
|
|
+ */
|
|
|
public int compareTo(NativeArray object, int src, int dst, int size) {
|
|
|
if(size == 0) {
|
|
|
return 0;
|
|
|
@@ -182,7 +433,17 @@ public abstract class NativeArray implements Swapper, Comparable<NativeArray>, C
|
|
|
}
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Compares all corresponding elements in specified range using provided comparator.
|
|
|
+ *
|
|
|
+ * @param object other array
|
|
|
+ * @param src start index of this array
|
|
|
+ * @param dst start index of other array
|
|
|
+ * @param size number of elements to compare
|
|
|
+ * @param comp comp
|
|
|
+ * @return int
|
|
|
+ */
|
|
|
public int compareTo(NativeArray object, int src, int dst, int size, Comparator comp) {
|
|
|
if(size == 0) {
|
|
|
return 0;
|
|
|
@@ -199,20 +460,54 @@ public abstract class NativeArray implements Swapper, Comparable<NativeArray>, C
|
|
|
}
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operator: it compares array element at "index" with some other value.
|
|
|
+ * For example:
|
|
|
+ * this comparator can contain binded value, which we want to find.
|
|
|
+ * this comparator can compare array[index] with another list[index]
|
|
|
+ *
|
|
|
+ * The whole idea is to provide optimized comparators which avoid boxing everything to Object
|
|
|
+ */
|
|
|
public interface NativeComparator {
|
|
|
|
|
|
+ /**
|
|
|
+ * Compare array element at "index" with some other value
|
|
|
+ * @param index index
|
|
|
+ * @return int
|
|
|
+ */
|
|
|
int compare(int index);
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operator: represent assignment operation: array1[target] = array2[source]
|
|
|
+ * Used for moving elements between arrays.
|
|
|
+ *
|
|
|
+ * The whole idea is to provide optimized operators which avoid boxing everything to Object and then unboxing again
|
|
|
+ */
|
|
|
public interface NativeMove {
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Moves value from one place to another.
|
|
|
+ * "source" and "target" index can point to the different arrays.
|
|
|
+ *
|
|
|
+ * @param target target
|
|
|
+ * @param source source
|
|
|
+ */
|
|
|
void move(int target, int source);
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Allocates new array of provided component type and wraps it into NativeArray.
|
|
|
+ * Primitive component types are supported.
|
|
|
+ *
|
|
|
+ * @param component component
|
|
|
+ * @param size size
|
|
|
+ * @return NativeArray
|
|
|
+ */
|
|
|
@SuppressWarnings({
|
|
|
"PMD.NPathComplexity",
|
|
|
"PMD.CyclomaticComplexity"
|
|
|
@@ -247,7 +542,14 @@ public abstract class NativeArray implements Swapper, Comparable<NativeArray>, C
|
|
|
}
|
|
|
throw new UnsupportedOperationException("Not supported type: " + component.getName());
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Creates NativeArray backed by provided array.
|
|
|
+ * Primitive arrays are supported.
|
|
|
+ *
|
|
|
+ * @param array array
|
|
|
+ * @return NativeArray
|
|
|
+ */
|
|
|
@SuppressWarnings({
|
|
|
"PMD.NPathComplexity",
|
|
|
"PMD.CyclomaticComplexity"
|
|
|
@@ -286,23 +588,58 @@ public abstract class NativeArray implements Swapper, Comparable<NativeArray>, C
|
|
|
}
|
|
|
throw new UnsupportedOperationException("Not supported type: " + c.getName());
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Creates NativeArray backed by provided array.
|
|
|
+ * This override is declared to avoid unecessary branching at runtime.
|
|
|
+ *
|
|
|
+ * @param array array
|
|
|
+ * @return NativeArray
|
|
|
+ */
|
|
|
public static NativeArray wrap(Object[] array) {
|
|
|
return new ObjectArray(array);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Creates NativeArray backed by provided array.
|
|
|
+ * This override is declared to avoid unecessary branching at runtime.
|
|
|
+ *
|
|
|
+ * @param array array
|
|
|
+ * @return NativeArray
|
|
|
+ */
|
|
|
public static NativeArray wrap(int[] array) {
|
|
|
return new IntegerArray(array);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Creates NativeArray backed by provided array.
|
|
|
+ * This override is declared to avoid unecessary branching at runtime.
|
|
|
+ *
|
|
|
+ * @param array array
|
|
|
+ * @return NativeArray
|
|
|
+ */
|
|
|
public static NativeArray wrap(char[] array) {
|
|
|
return new CharacterArray(array);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Creates NativeArray backed by provided array.
|
|
|
+ * This override is declared to avoid unecessary branching at runtime.
|
|
|
+ *
|
|
|
+ * @param array array
|
|
|
+ * @return NativeArray
|
|
|
+ */
|
|
|
public static NativeArray wrap(byte[] array) {
|
|
|
return new ByteArray(array);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Creates NativeArray backed by provided array.
|
|
|
+ * This override is declared to avoid unecessary branching at runtime.
|
|
|
+ *
|
|
|
+ * @param array array
|
|
|
+ * @return NativeArray
|
|
|
+ */
|
|
|
public static NativeArray wrap(boolean[] array) {
|
|
|
return new BooleanArray(array);
|
|
|
}
|
|
|
@@ -355,7 +692,7 @@ public abstract class NativeArray implements Swapper, Comparable<NativeArray>, C
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public NativeMove move(NativeArray source) {
|
|
|
+ public NativeMove moveFrom(NativeArray source) {
|
|
|
byte[] s = source.$array();
|
|
|
return (a,b) -> array[a]=s[b];
|
|
|
}
|
|
|
@@ -468,7 +805,7 @@ public abstract class NativeArray implements Swapper, Comparable<NativeArray>, C
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public NativeMove move(NativeArray source) {
|
|
|
+ public NativeMove moveFrom(NativeArray source) {
|
|
|
short[] s = source.$array();
|
|
|
return (a,b) -> array[a]=s[b];
|
|
|
}
|
|
|
@@ -581,7 +918,7 @@ public abstract class NativeArray implements Swapper, Comparable<NativeArray>, C
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public NativeMove move(NativeArray source) {
|
|
|
+ public NativeMove moveFrom(NativeArray source) {
|
|
|
int[] s = source.$array();
|
|
|
return (a,b) -> array[a]=s[b];
|
|
|
}
|
|
|
@@ -734,7 +1071,7 @@ public abstract class NativeArray implements Swapper, Comparable<NativeArray>, C
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public NativeMove move(NativeArray source) {
|
|
|
+ public NativeMove moveFrom(NativeArray source) {
|
|
|
long[] s = source.$array();
|
|
|
return (a,b) -> array[a]=s[b];
|
|
|
}
|
|
|
@@ -847,7 +1184,7 @@ public abstract class NativeArray implements Swapper, Comparable<NativeArray>, C
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public NativeMove move(NativeArray source) {
|
|
|
+ public NativeMove moveFrom(NativeArray source) {
|
|
|
float[] s = source.$array();
|
|
|
return (a,b)->{ array[a]=s[b]; };
|
|
|
}
|
|
|
@@ -960,7 +1297,7 @@ public abstract class NativeArray implements Swapper, Comparable<NativeArray>, C
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public NativeMove move(NativeArray source) {
|
|
|
+ public NativeMove moveFrom(NativeArray source) {
|
|
|
double[] s = source.$array();
|
|
|
return (a,b)->{ array[a]=s[b]; };
|
|
|
}
|
|
|
@@ -1074,7 +1411,7 @@ public abstract class NativeArray implements Swapper, Comparable<NativeArray>, C
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public NativeMove move(NativeArray source) {
|
|
|
+ public NativeMove moveFrom(NativeArray source) {
|
|
|
char[] s = source.$array();
|
|
|
return (a,b)->{ array[a]=s[b]; };
|
|
|
}
|
|
|
@@ -1187,7 +1524,7 @@ public abstract class NativeArray implements Swapper, Comparable<NativeArray>, C
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public NativeMove move(NativeArray source) {
|
|
|
+ public NativeMove moveFrom(NativeArray source) {
|
|
|
boolean[] s = source.$array();
|
|
|
return (a,b) -> array[a]=s[b];
|
|
|
}
|
|
|
@@ -1300,7 +1637,7 @@ public abstract class NativeArray implements Swapper, Comparable<NativeArray>, C
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public NativeMove move(NativeArray source) {
|
|
|
+ public NativeMove moveFrom(NativeArray source) {
|
|
|
Object[] s = source.$array();
|
|
|
return (a,b)->{ array[a]=s[b]; };
|
|
|
}
|