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