/*
* Geotoolkit - An Open Source Java GIS Toolkit
* http://www.geotoolkit.org
*
* (C) 2008 - 2009, Geomatys
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/
package org.geotoolkit.wcs.xml.v100;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlType;
import org.geotoolkit.gml.xml.v311.TimePositionType;
import org.geotoolkit.wcs.xml.TimeSequence;
/**
* List of time positions and periods. The time positions and periods should be ordered from the oldest to the newest, but this is not required.
*
* <p>Java class for TimeSequenceType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="TimeSequenceType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <choice maxOccurs="unbounded">
* <element ref="{http://www.opengis.net/gml}timePosition"/>
* <element name="TimePeriod" type="{http://www.opengis.net/wcs}TimePeriodType"/>
* </choice>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
* @author Guilhem Legal
* @module
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "TimeSequenceType", propOrder = {
"timePositionOrTimePeriod"
})
public class TimeSequenceType implements TimeSequence {
@XmlElements({
@XmlElement(name = "TimePeriod", type = TimePeriodType.class),
@XmlElement(name = "timePosition", namespace = "http://www.opengis.net/gml", type = TimePositionType.class)
})
private List<Object> timePositionOrTimePeriod = new ArrayList<Object>();
/**
* An empty constructor used by JAXB.
*/
TimeSequenceType() {
}
/**
* build a new time sequence.
*
* @param timePositionOrTimePeriod a list of timePosition and timePeriod
*/
public TimeSequenceType(final List<Object> timePositionOrTimePeriod) {
this.timePositionOrTimePeriod = timePositionOrTimePeriod;
}
/**
* build a new time sequence with a simple timePosition.
*
* @param timePosition a simple timePosition
*/
public TimeSequenceType(final TimePositionType timePosition) {
timePositionOrTimePeriod = new ArrayList<Object>();
timePositionOrTimePeriod.add(timePosition);
}
public TimeSequenceType(final String timePosition) {
timePositionOrTimePeriod = new ArrayList<Object>();
if (timePosition != null) {
final TimePositionType tp = new TimePositionType(timePosition);
timePositionOrTimePeriod.add(tp);
}
}
/**
* Gets the value of the timePositionOrTimePeriod property.
* (unmodifable)
*/
public List<Object> getTimePositionOrTimePeriod() {
if (timePositionOrTimePeriod == null) {
timePositionOrTimePeriod = new ArrayList<Object>();
}
return Collections.unmodifiableList(timePositionOrTimePeriod);
}
}