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