@Test public void testNonCanonicalOrder() { int[] shape = new int[] {1, 2, 3}; Storage<Integer> store = new ArrayInteger.StorageS(new int[] {1, 2, 3, 4, 5, 6}); Array<Integer> array = new ArrayInteger(DataType.INT, shape, store); array = Arrays.flip(array, 1); int[] expected = new int[] {4, 5, 6, 1, 2, 3}; int count = 0; for (int val : array) { assertThat(val).isEqualTo(expected[count]); count++; } int[] result = new int[3]; array.arraycopy(1, result, 0, 3); assertThat(result).isEqualTo(new int[] {5, 6, 1}); }
@Override void arraycopy(int srcPos, Object dest, int destPos, long length) { if (indexFn.isCanonicalOrder()) { storage.arraycopy(srcPos, dest, destPos, length); } else { int[] ddest = (int[]) dest; int destIndex = destPos; Iterator<Integer> iter = indexFn.iterator(srcPos, length); while (iter.hasNext()) { ddest[destIndex++] = storage.get(iter.next()); } } }
ArrayInteger extends Array<Integer> { @Override void arraycopy(int srcPos, Object dest, int destPos, long length) { if (indexFn.isCanonicalOrder()) { storage.arraycopy(srcPos, dest, destPos, length); } else { int[] ddest = (int[]) dest; int destIndex = destPos; Iterator<Integer> iter = indexFn.iterator(srcPos, length); while (iter.hasNext()) { ddest[destIndex++] = storage.get(iter.next()); } } } }
ArrayInteger extends Array<Integer> { @Override void arraycopy(int srcPos, Object dest, int destPos, long length) { if (indexFn.isCanonicalOrder()) { storage.arraycopy(srcPos, dest, destPos, length); } else { int[] ddest = (int[]) dest; int destIndex = destPos; Iterator<Integer> iter = indexFn.iterator(srcPos, length); while (iter.hasNext()) { ddest[destIndex++] = storage.get(iter.next()); } } } ArrayInteger(DataType dtype, int[] shape);  ArrayInteger(DataType dtype, int[] shape, Storage<Integer> storage); private  ArrayInteger(DataType dtype, IndexFn indexFn, Storage<Integer> storageD); }
ArrayInteger extends Array<Integer> { @Override void arraycopy(int srcPos, Object dest, int destPos, long length) { if (indexFn.isCanonicalOrder()) { storage.arraycopy(srcPos, dest, destPos, length); } else { int[] ddest = (int[]) dest; int destIndex = destPos; Iterator<Integer> iter = indexFn.iterator(srcPos, length); while (iter.hasNext()) { ddest[destIndex++] = storage.get(iter.next()); } } } ArrayInteger(DataType dtype, int[] shape);  ArrayInteger(DataType dtype, int[] shape, Storage<Integer> storage); private  ArrayInteger(DataType dtype, IndexFn indexFn, Storage<Integer> storageD); @Override Iterator<Integer> fastIterator(); @Override Iterator<Integer> iterator(); @Override Integer get(int... index); @Override Integer get(Index index); }
ArrayInteger extends Array<Integer> { @Override void arraycopy(int srcPos, Object dest, int destPos, long length) { if (indexFn.isCanonicalOrder()) { storage.arraycopy(srcPos, dest, destPos, length); } else { int[] ddest = (int[]) dest; int destIndex = destPos; Iterator<Integer> iter = indexFn.iterator(srcPos, length); while (iter.hasNext()) { ddest[destIndex++] = storage.get(iter.next()); } } } ArrayInteger(DataType dtype, int[] shape);  ArrayInteger(DataType dtype, int[] shape, Storage<Integer> storage); private  ArrayInteger(DataType dtype, IndexFn indexFn, Storage<Integer> storageD); @Override Iterator<Integer> fastIterator(); @Override Iterator<Integer> iterator(); @Override Integer get(int... index); @Override Integer get(Index index);  }