for (int i = 0; i < cloned.length; i++) { if (!(cloned[i] instanceof ImagingParameter)) { cloned[i] = ((ParameterValue) values.get(i)).clone();
/** Returns a clone of this parameter group. */ @Override @SuppressWarnings("unchecked") public MatrixParameters clone() { final MatrixParameters copy = (MatrixParameters) super.clone(); if (copy.matrixValues != null) { copy.numRow = (ParameterValue) copy.parameter(0); copy.numCol = (ParameterValue) copy.parameter(1); copy.matrixValues = copy.matrixValues.clone(); for (int j = 0; j < copy.matrixValues.length; j++) { ParameterValue[] array = copy.matrixValues[j]; if (array != null) { copy.matrixValues[j] = array = array.clone(); for (int i = 0; i < array.length; i++) { if (array[i] != null) { array[i] = array[i].clone(); } } } } } return copy; }
/** * Returns a modifiable clone of this parameter value group. * * @return a clone of this parameter value group. */ @Override public synchronized ContextualParameters clone() { /* * Creates a new parameter array with enough room for adding new parameters. * Then replace each element by a modifiable clone. */ final ParameterValue<?>[] param = Arrays.copyOf(values, descriptor.descriptors().size()); for (int i=0; i<param.length; i++) { final ParameterValue<?> p = param[i]; if (p == null) { break; } param[i] = param[i].clone(); } /* * Now proceed to the clone of this ContextualParameters instance. * We do not clone inverseFoo fields since they shall be null for modifiable instances. */ final ContextualParameters clone = (ContextualParameters) super.clone(); clone.values = param; clone.normalize = normalize.clone(); clone.denormalize = denormalize.clone(); return clone; }
/** * Returns a modifiable clone of this parameter value group. * * @return a clone of this parameter value group. */ @Override public synchronized ContextualParameters clone() { /* * Creates a new parameter array with enough room for adding new parameters. * Then replace each element by a modifiable clone. */ final ParameterValue<?>[] param = Arrays.copyOf(values, descriptor.descriptors().size()); for (int i=0; i<param.length; i++) { final ParameterValue<?> p = param[i]; if (p == null) { break; } param[i] = param[i].clone(); } /* * Now proceed to the clone of this ContextualParameters instance. * We do not clone inverseFoo fields since they shall be null for modifiable instances. */ final ContextualParameters clone = (ContextualParameters) super.clone(); clone.values = param; clone.normalize = normalize.clone(); clone.denormalize = denormalize.clone(); return clone; }
/** * Constructs a copy of the given matrix parameters. * If {@code clone} is true, the new group will be a clone of the given group. * If {@code clone} is false, the new group will be initialized to default values. */ TensorValues(final TensorValues<E> other, final boolean clone) { super(other); descriptors = other.descriptors; dimensions = other.dimensions.clone(); for (int i=0; i<dimensions.length; i++) { final ParameterValue<Integer> dim = dimensions[i]; dimensions[i] = clone ? dim.clone() : dim.getDescriptor().createValue(); } if (clone) { values = clone(other.values); } }
/** * Constructs a copy of the given matrix parameters. * If {@code clone} is true, the new group will be a clone of the given group. * If {@code clone} is false, the new group will be initialized to default values. */ TensorValues(final TensorValues<E> other, final boolean clone) { super(other); descriptors = other.descriptors; dimensions = other.dimensions.clone(); for (int i=0; i<dimensions.length; i++) { final ParameterValue<Integer> dim = dimensions[i]; dimensions[i] = clone ? dim.clone() : dim.getDescriptor().createValue(); } if (clone) { values = clone(other.values); } }