/** Returns a clone of this parameter. */ @Override public Parameter clone() { return (Parameter) super.clone(); } }
/** * Constructs a parameter value from the specified descriptor. * * @param descriptor The abstract definition of this parameter or group of parameters. */ protected AbstractParameter(final GeneralParameterDescriptor descriptor) { this.descriptor = descriptor; ensureNonNull("descriptor", descriptor); }
/** Returns the abstract definition of this group of parameters. */ @Override public ParameterDescriptorGroup getDescriptor() { return (ParameterDescriptorGroup) super.getDescriptor(); }
/** * Returns a hash value for this parameter. * * @return The hash code value. This value doesn't need to be the same in past or future * versions of this class. */ @Override public int hashCode() { return super.hashCode() ^ values.hashCode(); }
/** * Compares the specified object with this parameter for equality. * * @param object The object to compare to {@code this}. * @return {@code true} if both objects are equal. */ @Override public boolean equals(final Object object) { if (super.equals(object)) { final FloatParameter that = (FloatParameter) object; return Double.doubleToLongBits(this.value) == Double.doubleToLongBits(that.value); } return false; }
/** * Returns an exception initialized with a "Unitless parameter" error message for the specified * descriptor. */ static IllegalStateException unitlessParameter(final GeneralParameterDescriptor descriptor) { return new IllegalStateException( Errors.format(ErrorKeys.UNITLESS_PARAMETER_$1, getName(descriptor))); }
buffer.write(", "); append(buffer, Array.get(value, i));
/** * Returns a string representation of this parameter. The default implementation delegates the * work to {@link #write}, which should be overridden by subclasses. */ @Override public final String toString() { final TableWriter table = new TableWriter(null, 1); table.setMultiLinesCells(true); try { write(table); } catch (IOException exception) { // Should never happen, since we write to a StringWriter. throw new AssertionError(exception); } return table.toString(); }
this.unit = unit; ensureNonNull("valueClass", valueClass); AbstractParameter.ensureValidClass(valueClass, defaultValue); AbstractParameter.ensureValidClass(valueClass, minimum); AbstractParameter.ensureValidClass(valueClass, maximum); if (minimum != null && maximum != null) { if (minimum.compareTo(valueClass.cast(maximum)) > 0) { for (int i = 0; i < validValues.length; i++) { final T value = validValues[i]; AbstractParameter.ensureValidClass(valueClass, value); valids.add(value);
/** * Returns a hash value for this parameter group. This value doesn't need to be the same in past * or future versions of this class. */ @Override public int hashCode() { return super.hashCode() * 37 + parameters.hashCode(); }
/** Compares the specified object with this parameter group for equality. */ @Override public boolean equals(final Object object) { if (object == this) { // Slight optimization return true; } if (super.equals(object)) { final ImagingParameters that = (ImagingParameters) object; return Utilities.equals(this.parameters, that.parameters); } return false; }
/** * Returns a hash value for this parameter. * * @return The hash code value. This value doesn't need to be the same in past or future * versions of this class. */ @Override public int hashCode() { final long code = Double.doubleToLongBits(value); return (int) code ^ (int) (code >>> 32) + super.hashCode() * 37; }
/** Returns the abstract definition of this parameter. */ @Override @SuppressWarnings("unchecked") // Type should has been checked by the constructor. public ParameterDescriptor<Double> getDescriptor() { return (ParameterDescriptor) super.getDescriptor(); }
/** * Compares the specified object with this parameter for equality. * * @param object The object to compare to {@code this}. * @return {@code true} if both objects are equal. */ @Override public boolean equals(final Object object) { if (object == this) { return true; } if (super.equals(object)) { final ParameterGroup that = (ParameterGroup) object; return Utilities.equals(this.values, that.values); } return false; }
/** Returns a clone of this parameter. */ @Override public FloatParameter clone() { return (FloatParameter) super.clone(); } }
/** * Returns a hash value for this parameter. * * @return The hash code value. This value doesn't need to be the same in past or future * versions of this class. */ @Override public int hashCode() { int code = super.hashCode() * 37; if (value != null) code += value.hashCode(); if (unit != null) code += 37 * unit.hashCode(); return code ^ (int) serialVersionUID; }
/** Returns the abstract definition of this parameter. */ @Override @SuppressWarnings("unchecked") public ParameterDescriptor<T> getDescriptor() { return (ParameterDescriptor) super.getDescriptor(); }
/** * Compares the specified object with this parameter for equality. * * @param object The object to compare to {@code this}. * @return {@code true} if both objects are equal. */ @Override public boolean equals(final Object object) { if (object == this) { // Slight optimization return true; } if (super.equals(object)) { final Parameter that = (Parameter) object; return Utilities.equals(this.value, that.value) && Utilities.equals(this.unit, that.unit); } return false; }
/** * Returns a deep copy of this group of parameter values. Included parameter values and * subgroups are cloned recursively. * * @return A copy of this group of parameter values. */ @Override public ParameterGroup clone() { final ParameterGroup copy = (ParameterGroup) super.clone(); copy.values = (ArrayList<GeneralParameterValue>) copy.values.clone(); for (int i = copy.values.size(); --i >= 0; ) { // TODO: remove cast with J2SE 1.5 copy.values.set(i, copy.values.get(i).clone()); } copy.asList = null; return copy; } }