001/*
002 *    GeoAPI - Java interfaces for OGC/ISO standards
003 *    Copyright © 2003-2023 Open Geospatial Consortium, Inc.
004 *    http://www.geoapi.org
005 *
006 *    Licensed under the Apache License, Version 2.0 (the "License");
007 *    you may not use this file except in compliance with the License.
008 *    You may obtain a copy of the License at
009 *
010 *        http://www.apache.org/licenses/LICENSE-2.0
011 *
012 *    Unless required by applicable law or agreed to in writing, software
013 *    distributed under the License is distributed on an "AS IS" BASIS,
014 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 *    See the License for the specific language governing permissions and
016 *    limitations under the License.
017 */
018package org.opengis.metadata.extent;
019
020import java.util.Collection;
021import java.util.Collections;
022import org.opengis.util.InternationalString;
023import org.opengis.annotation.UML;
024import org.opengis.annotation.Profile;
025import org.opengis.annotation.Classifier;
026import org.opengis.annotation.Stereotype;
027
028import static org.opengis.annotation.Obligation.*;
029import static org.opengis.annotation.Specification.*;
030import static org.opengis.annotation.ComplianceLevel.*;
031
032
033/**
034 * Information about spatial, vertical, and temporal extent of the resource.
035 * This interface has four optional attributes:
036 * {@linkplain #getGeographicElements() geographic elements},
037 * {@linkplain #getVerticalElements() vertical elements},
038 * {@linkplain #getTemporalElements() temporal elements} and an element called
039 * {@linkplain #getDescription() description}.
040 * At least one of the four shall be used.
041 *
042 * @author  Martin Desruisseaux (IRD)
043 * @version 3.1
044 * @since   1.0
045 */
046@Classifier(Stereotype.DATATYPE)
047@UML(identifier="EX_Extent", specification=ISO_19115)
048public interface Extent {
049    /**
050     * The spatial and temporal extent for the referring object.
051     *
052     * @return the spatial and temporal extent, or {@code null} in none.
053     *
054     * @condition Mandatory if {@linkplain #getGeographicElements() geographic element},
055     *            {@linkplain #getVerticalElements() vertical element} and
056     *            {@linkplain #getTemporalElements() temporal element} are not provided.
057     */
058    @UML(identifier="description", obligation=CONDITIONAL, specification=ISO_19115)
059    default InternationalString getDescription() {
060        return null;
061    }
062
063    /**
064     * Provides geographic component of the extent of the referring object.
065     *
066     * @return the geographic extent, or an empty list if none.
067     *
068     * @condition Mandatory if {@linkplain #getDescription() description},
069     *            {@linkplain #getVerticalElements() vertical element} and
070     *            {@linkplain #getTemporalElements() temporal element} are not provided.
071     */
072    @Profile(level=CORE)
073    @UML(identifier="geographicElement", obligation=CONDITIONAL, specification=ISO_19115)
074    default Collection<? extends GeographicExtent> getGeographicElements() {
075        return Collections.emptyList();
076    }
077
078    /**
079     * Provides vertical component of the extent of the referring object.
080     *
081     * @return the vertical extent, or an empty list if none.
082     *
083     * @condition Mandatory if {@linkplain #getDescription() description},
084     *            {@linkplain #getGeographicElements() geographic element} and
085     *            {@linkplain #getTemporalElements() temporal element} are not provided.
086     */
087    @Profile(level=CORE)
088    @UML(identifier="verticalElement", obligation=CONDITIONAL, specification=ISO_19115)
089    default Collection<? extends VerticalExtent> getVerticalElements() {
090        return Collections.emptyList();
091    }
092
093    /**
094     * Provides temporal component of the extent of the referring object.
095     *
096     * @return the temporal extent, or an empty list if none.
097     *
098     * @condition Mandatory if {@linkplain #getDescription() description},
099     *            {@linkplain #getGeographicElements() geographic element} and
100     *            {@linkplain #getVerticalElements() vertical element} are not provided.
101     */
102    @Profile(level=CORE)
103    @UML(identifier="temporalElement", obligation=CONDITIONAL, specification=ISO_19115)
104    default Collection<? extends TemporalExtent> getTemporalElements() {
105        return Collections.emptyList();
106    }
107}