/** * Throws an exception for mismatched descriptor if a condition is false. * This is used for verifying that a descriptors has the expected properties. */ private static void verifyEquivalence(final String name, final boolean condition) { if (!condition) { throw new IllegalArgumentException(Resources.format(Resources.Keys.MismatchedParameterDescriptor_1, name)); } } }
/** * Unsupported operation, since this matrix is unmodifiable. */ @Override public final void setElement(final int row, final int column, final double value) { throw new UnsupportedOperationException(Resources.format(Resources.Keys.UnmodifiableAffineTransform)); }
/** * Throws an exception for mismatched descriptor if a condition is false. * This is used for verifying that a descriptors has the expected properties. */ private static void verifyEquivalence(final String name, final boolean condition) { if (!condition) { throw new IllegalArgumentException(Resources.format(Resources.Keys.MismatchedParameterDescriptor_1, name)); } } }
/** * Formats an error message for illegal method call for the current value type. */ private String getClassTypeError() { return Resources.format(Resources.Keys.IllegalOperationForValueClass_1, (descriptor != null) ? ((ParameterDescriptor<?>) descriptor).getValueClass() : "?"); }
/** * Returns the exception for a non-invertible transform. */ private NoninvertibleMatrixException nonInvertible() { return new NoninvertibleMatrixException(Resources.format(Resources.Keys.NonInvertibleMatrix_2, numRow, numCol)); }
/** * Helper method for verifying transform dimension consistency. * * @param type 0 if verifying source dimension, or 1 if verifying target dimension. */ private static void ensureDimensionMatches(final int type, final int expected, final int actual) { if (expected != actual) { throw new MismatchedDimensionException(Resources.format( Resources.Keys.MismatchedTransformDimension_3, type, expected, actual)); } }
/** * Formats an error message for illegal method call for the current value type. */ private String getClassTypeError() { return Resources.format(Resources.Keys.IllegalOperationForValueClass_1, (descriptor != null) ? ((ParameterDescriptor<?>) descriptor).getValueClass() : "?"); }
/** * Implementation of {@link #derivative(DirectPosition)} shared by the inverse transform. */ static Matrix derivative(final AbstractMathTransform tr, final Point2D point) throws TransformException { final double[] coordinate = new double[] {point.getX(), point.getY()}; final Matrix derivative = tr.transform(coordinate, 0, null, 0, true); if (derivative == null) { throw new TransformException(Resources.format(Resources.Keys.CanNotComputeDerivative)); } return derivative; }
/** * Unsupported operation, since this matrix is unmodifiable. */ @Override public final void setElement(final int row, final int column, final double value) { throw new UnsupportedOperationException(isAffine() ? Resources.format(Resources.Keys.UnmodifiableAffineTransform) : Errors.format(Errors.Keys.UnmodifiableObject_1, AbstractLinearTransform.class)); }
/** * Unsupported operation, since this matrix is unmodifiable. */ @Override public final void setElement(final int row, final int column, final double value) { throw new UnsupportedOperationException(isAffine() ? Resources.format(Resources.Keys.UnmodifiableAffineTransform) : Errors.format(Errors.Keys.UnmodifiableObject_1, AbstractLinearTransform.class)); }
/** * Returns an error message for "No path found from sourceCRS to targetCRS". * This is used for the construction of {@link OperationNotFoundException}. * * @param source the source CRS. * @param target the target CRS. * @return a default error message. */ private static String notFoundMessage(final IdentifiedObject source, final IdentifiedObject target) { return Resources.format(Resources.Keys.CoordinateOperationNotFound_2, CRSPair.label(source), CRSPair.label(target)); }
/** * Creates an exception message for a spatial, vertical or temporal dimension not found. * The given key must be one of {@code Resources.Keys} constants. */ private static String dimensionNotFound(final short resourceKey, final CoordinateReferenceSystem crs) { if (crs == null) { return Errors.format(Errors.Keys.UnspecifiedCRS); } else { return Resources.format(resourceKey, crs.getName()); } }
/** * Returns the exception to thrown when the parameter of the given name has not been found. */ private ParameterNotFoundException parameterNotFound(final String name) { return new ParameterNotFoundException(Resources.format( Resources.Keys.ParameterNotFound_2, descriptor.getName(), name), name); }
/** * Returns the exception to thrown when the parameter of the given name has not been found. */ private ParameterNotFoundException parameterNotFound(final String name) { return new ParameterNotFoundException(Resources.format( Resources.Keys.ParameterNotFound_2, descriptor.getName(), name), name); }
/** * Always throws an exception since this group does not contain subgroups. */ @Override public List<ParameterValueGroup> groups(final String name) throws ParameterNotFoundException { throw new ParameterNotFoundException(Resources.format(Resources.Keys.ParameterNotFound_2, getName(), name), name); }
/** * Always throws an exception since this group does not contain subgroups. */ @Override public ParameterValueGroup addGroup(String name) throws ParameterNotFoundException, IllegalStateException { throw new ParameterNotFoundException(Resources.format(Resources.Keys.ParameterNotFound_2, getName(), name), name); }
/** * Returns the exception to throw when an incompatible method is invoked for the value type. */ private IllegalStateException missingOrIncompatibleValue(final Object newValue) { final String name = Verifier.getDisplayName(descriptor); if (newValue != null) { return new InvalidParameterTypeException(getClassTypeError(), name); } return new IllegalStateException(Resources.format(Resources.Keys.MissingValueForParameter_1, name)); }
/** * Returns the exception to throw when an incompatible method is invoked for the value type. */ private IllegalStateException missingOrIncompatibleValue(final Object newValue) { final String name = Verifier.getDisplayName(descriptor); if (newValue != null) { return new InvalidParameterTypeException(getClassTypeError(), name); } return new IllegalStateException(Resources.format(Resources.Keys.MissingValueForParameter_1, name)); }
/** * Returns an error message for "Can not invert operation XYZ.". * This is used for the construction of {@link OperationNotFoundException}. * * @param crs the CRS having a conversion that can not be inverted. * @return a default error message. */ private static String canNotInvert(final GeneralDerivedCRS crs) { return Resources.format(Resources.Keys.NonInvertibleOperation_1, crs.getConversionFromBase().getName().getCode()); } }
/** * Returns an error message for "Can not invert operation XYZ.". * This is used for the construction of {@link OperationNotFoundException}. * * @param crs the CRS having a conversion that can not be inverted. * @return a default error message. */ private static String canNotInvert(final GeneralDerivedCRS crs) { return Resources.format(Resources.Keys.NonInvertibleOperation_1, crs.getConversionFromBase().getName().getCode()); } }