/** * Set a set of consecutive elements. * * @param index index of first element to be set. * @param v vector containing the values to set. * @throws OutOfRangeException if the index is inconsistent with vector size */ public void set(int index, ArrayFieldVector<T> v) { try { System.arraycopy(v.data, 0, data, index, v.data.length); } catch (IndexOutOfBoundsException e) { checkIndex(index); checkIndex(index + v.data.length - 1); } }
/** {@inheritDoc} */ public FieldVector<T> getSubVector(int index, int n) { ArrayFieldVector<T> out = new ArrayFieldVector<T>(field, n); try { System.arraycopy(data, index, out.data, 0, n); } catch (IndexOutOfBoundsException e) { checkIndex(index); checkIndex(index + n - 1); } return out; }
/** {@inheritDoc} */ public void setSubVector(int index, FieldVector<T> v) { try { try { set(index, (ArrayFieldVector<T>) v); } catch (ClassCastException cce) { for (int i = index; i < index + v.getDimension(); ++i) { data[i] = v.getEntry(i - index); } } } catch (IndexOutOfBoundsException e) { checkIndex(index); checkIndex(index + v.getDimension() - 1); } }
/** {@inheritDoc} */ public void setEntry(int index, T value) { try { data[index] = value; } catch (IndexOutOfBoundsException e) { checkIndex(index); } }