/** * Set values at given position * * @param d * @param pos */ public void setItem(final int[] d, final int... pos) { // PRIM_TYPE try { // is pos valid? // N calc new shape // is new shape valid in reserved space? // Y set new shape // N allocate new space // move data to new space // set value if (!isPositionInShape(pos)) { int[] nshape = shape.clone(); for (int i = 0; i < pos.length; i++) if (pos[i] >= nshape[i]) nshape[i] = pos[i] + 1; allocateArray(nshape); } if (d.length > isize) { throw new IllegalArgumentException("Array is larger than compound"); } setAbs(isize * get1DIndex(pos), d); } catch (ArrayIndexOutOfBoundsException e) { throw new ArrayIndexOutOfBoundsException( "Index out of bounds - need to make dataset extendible"); } }
@Override public void setObjectAbs(final int index, final Object obj) { int[] oa = toIntegerArray(obj, isize); // PRIM_TYPE // CLASS_TYPE setAbs(index, oa); }