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