@Override public void setElements(AbstractDataset source, int element) { if (element < 0) element += isize; if (element < 0 || element > isize) { throw new IllegalArgumentException( String.format("Invalid choice of element: %d/%d", element, isize)); } if (elementClass() != source.elementClass()) { throw new IllegalArgumentException( "Element class of destination does not match this dataset"); } final IndexIterator it = getIterator(element); final int[] elements = ((IntegerDataset) source).data; // CLASS_TYPE // PRIM_TYPE if (source.isContiguous()) { int n = 0; while (it.hasNext()) { data[it.index] = elements[n]; n++; } } else { final IndexIterator sit = source.getIterator(); while (it.hasNext() && sit.hasNext()) { data[it.index] = elements[sit.index]; } } }
@Override public void copyElements(AbstractDataset destination, int element) { if (element < 0) element += isize; if (element < 0 || element > isize) { throw new IllegalArgumentException( String.format("Invalid choice of element: %d/%d", element, isize)); } if (elementClass() != destination.elementClass()) { throw new IllegalArgumentException( "Element class of destination does not match this dataset"); } final IndexIterator it = getIterator(element); final int[] elements = ((IntegerDataset) destination).data; // CLASS_TYPE // PRIM_TYPE int n = 0; while (it.hasNext()) { elements[n] = data[it.index]; n++; } }