/** Returns the string value of an operation parameter. */ public String stringValue() throws InvalidParameterTypeException { final String name = getName(); try { // Really cast to CharSequence (even if not needed for toString()) // because we want the ClassCastException if the type mismatch. return ((CharSequence) parameters.getObjectParameter(name)).toString(); } catch (ClassCastException exception) { throw invalidType(exception); } }
/** Returns an ordered sequence of two or more integer values of an operation parameter list. */ public int[] intValueList() throws InvalidParameterTypeException { final String name = getName(); try { return (int[]) parameters.getObjectParameter(name); } catch (ClassCastException exception) { throw invalidType(exception); } }
/** Returns an ordered sequence of two or more numeric values of an operation parameter list. */ public double[] doubleValueList() throws InvalidParameterTypeException { final String name = getName(); try { return (double[]) parameters.getObjectParameter(name); } catch (ClassCastException exception) { throw invalidType(exception); } }
/** * Returns a reference to a file or a part of a file containing one or more parameter value. * * @todo Add automatic conversions, if it appears usefull for JAI parameters. */ public URI valueFile() throws InvalidParameterTypeException { final String name = getName(); try { return (URI) parameters.getObjectParameter(name); } catch (ClassCastException exception) { throw invalidType(exception); } }
/** * Returns the parameter value as an object. The object type is typically a {@link Double}, * {@link Integer}, {@link Boolean}, {@link String}, {@link URI}, {@code double[]} or {@code * int[]}. */ public T getValue() { final String name = getName(); final Object value; try { value = parameters.getObjectParameter(name); } catch (IllegalStateException ignore) { /* * Thrown when the value still ParameterListDescriptor.NO_PARAMETER_DEFAULT. * In this framework, the desired behavior in this case is to returns null. */ return null; } return getType().cast(value); }
Arrays.equals( values.parameter("constants").doubleValueList(), (double[]) values.parameters.getObjectParameter("constants"))); assertSame(before, values.parameter("constants"));
KernelJAI mask1 = (KernelJAI) block.getObjectParameter("Mask1"); KernelJAI mask2 = (KernelJAI) block.getObjectParameter("Mask2");
KernelJAI mask1 = (KernelJAI) block.getObjectParameter("Mask1"); KernelJAI mask2 = (KernelJAI) block.getObjectParameter("Mask2");
final KernelJAI mask1 = (KernelJAI) block.getObjectParameter("Mask1"); final KernelJAI mask2 = (KernelJAI) block.getObjectParameter("Mask2"); final double size = (mask1.getWidth() + mask1.getHeight() + mask2.getWidth() + mask2.getHeight()) / 4.0;
final KernelJAI mask1 = (KernelJAI) block.getObjectParameter("Mask1"); final KernelJAI mask2 = (KernelJAI) block.getObjectParameter("Mask2"); final double size = (mask1.getWidth() + mask1.getHeight() + mask2.getWidth() + mask2.getHeight()) / 4.0;