Java Code Examples for org.opengis.parameter.ParameterDescriptor#getMinimumOccurs()
The following examples show how to use
org.opengis.parameter.ParameterDescriptor#getMinimumOccurs() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ServiceParameter.java From sis with Apache License 2.0 | 6 votes |
/** * Compares this object with the given one for equality. * * @param object the object to compare with this reference system. * @param mode the strictness level of the comparison. * @return {@code true} if both objects are equal. */ @Override public boolean equals(final Object object, final ComparisonMode mode) { if (object == this) { return true; } if (super.equals(object, mode) && object instanceof ParameterDescriptor<?>) { final ParameterDescriptor<?> that = (ParameterDescriptor<?>) object; if (that.getUnit() == null && that.getDefaultValue() == null && that.getValueClass() == getValueClass()) { if (mode.isIgnoringMetadata()) { return Objects.equals(toString(getName()), toString(that.getName())); // super.equals(…) already compared 'getName()' in others mode. } return that.getMinimumOccurs() == getMinimumOccurs() && that.getMaximumOccurs() == getMaximumOccurs() && that.getValidValues() == null && that.getMinimumValue() == null && that.getMaximumValue() == null; } } return false; }
Example 2
Source File: CC_GeneralOperationParameter.java From sis with Apache License 2.0 | 6 votes |
/** * Creates a new descriptor with the same properties than the {@code provided} one, but completed with * information not found in GML. Those extra information are given by the {@code complete} descriptor. * * <p>It is the caller's responsibility to construct the {@code merged} properties as a merge of the properties * of the two given descriptors. This can be done with the help of {@link #mergeArrays(String, Class, Collection, * Map, Identifier)} among others.</p> */ private static <T> ParameterDescriptor<T> create(final Map<String,?> merged, final ParameterDescriptor<?> provided, final ParameterDescriptor<T> complete) { final Class<T> valueClass = complete.getValueClass(); return new DefaultParameterDescriptor<>(merged, provided.getMinimumOccurs(), provided.getMaximumOccurs(), // Values below this point are not provided in GML documents, // so they must be inferred from the pre-defined descriptor. valueClass, Parameters.getValueDomain(complete), CollectionsExt.toArray(complete.getValidValues(), valueClass), complete.getDefaultValue()); }
Example 3
Source File: ServiceParameter.java From sis with Apache License 2.0 | 5 votes |
/** * Creates a parameter initialized to the values of the given one. */ private ServiceParameter(final ParameterDescriptor<?> parameter) { super(parameter); memberName = getMemberName(parameter); optionality = parameter.getMinimumOccurs() > 0; repeatability = parameter.getMaximumOccurs() > 1; }
Example 4
Source File: TensorValues.java From sis with Apache License 2.0 | 5 votes |
/** * Returns {@code true} if the given parameter can be omitted. A parameter can be omitted * if it is not mandatory and has a value equals to the default value. */ private static boolean isOmitted(final ParameterValue<?> parameter) { final Object value = parameter.getValue(); if (value == null) { // Implies that the default value is also null. return true; } final ParameterDescriptor<?> descriptor = parameter.getDescriptor(); return descriptor.getMinimumOccurs() == 0 && value.equals(descriptor.getDefaultValue()); }