/** * Returns a SIS metadata implementation with the values of the given arbitrary implementation. * This method performs the first applicable action in the following choices: * * <ul> * <li>If the given object is {@code null}, then this method returns {@code null}.</li> * <li>Otherwise if the given object is already an instance of * {@code DefaultRangeElementDescription}, then it is returned unchanged.</li> * <li>Otherwise a new {@code DefaultRangeElementDescription} instance is created using the * {@linkplain #DefaultRangeElementDescription(RangeElementDescription) copy constructor} * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other * metadata contained in the given object are not recursively copied.</li> * </ul> * * @param object the object to get as a SIS implementation, or {@code null} if none. * @return a SIS implementation containing the values of the given object (may be the * given object itself), or {@code null} if the argument was null. */ public static DefaultRangeElementDescription castOrCopy(final RangeElementDescription object) { if (object == null || object instanceof DefaultRangeElementDescription) { return (DefaultRangeElementDescription) object; } return new DefaultRangeElementDescription(object); }
/** * Returns a SIS metadata implementation with the values of the given arbitrary implementation. * This method performs the first applicable action in the following choices: * * <ul> * <li>If the given object is {@code null}, then this method returns {@code null}.</li> * <li>Otherwise if the given object is already an instance of * {@code DefaultRangeElementDescription}, then it is returned unchanged.</li> * <li>Otherwise a new {@code DefaultRangeElementDescription} instance is created using the * {@linkplain #DefaultRangeElementDescription(RangeElementDescription) copy constructor} * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other * metadata contained in the given object are not recursively copied.</li> * </ul> * * @param object the object to get as a SIS implementation, or {@code null} if none. * @return a SIS implementation containing the values of the given object (may be the * given object itself), or {@code null} if the argument was null. */ public static DefaultRangeElementDescription castOrCopy(final RangeElementDescription object) { if (object == null || object instanceof DefaultRangeElementDescription) { return (DefaultRangeElementDescription) object; } return new DefaultRangeElementDescription(object); }
/** * Adds a description of a particular sample value. * Storage location is: * * <ul> * <li>{@code metadata/contentInfo/rangeElementDescription}</li> * </ul> * * <div class="note"><b>Note:</b> * ISO 19115 range elements are approximatively equivalent to * {@code org.apache.sis.coverage.Category} in the {@code sis-coverage} module.</div> * * @param name designation associated with a set of range elements, or {@code null} if none. * @param definition description of a set of specific range elements, or {@code null} if none. */ public void addSampleValueDescription(final CharSequence name, final CharSequence definition) { final InternationalString i18n = trim(name); final InternationalString def = trim(definition); if (i18n != null && def != null) { final DefaultRangeElementDescription element = new DefaultRangeElementDescription(); element.setName(i18n); element.setDefinition(def); addIfNotPresent(coverageDescription().getRangeElementDescriptions(), element); } }
/** * Adds a description of a particular sample value. * Storage location is: * * <ul> * <li>{@code metadata/contentInfo/rangeElementDescription}</li> * </ul> * * <div class="note"><b>Note:</b> * ISO 19115 range elements are approximately equivalent to * {@code org.apache.sis.coverage.Category} in the {@code sis-coverage} module.</div> * * @param name designation associated with a set of range elements, or {@code null} if none. * @param definition description of a set of specific range elements, or {@code null} if none. */ public void addSampleValueDescription(final CharSequence name, final CharSequence definition) { final InternationalString i18n = trim(name); final InternationalString def = trim(definition); if (i18n != null && def != null) { final DefaultRangeElementDescription element = new DefaultRangeElementDescription(); element.setName(i18n); element.setDefinition(def); addIfNotPresent(coverageDescription().getRangeElementDescriptions(), element); } }