/*
* Geotoolkit - An Open Source Java GIS Toolkit
* http://www.geotoolkit.org
*
* (C) 2008 - 2011, 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.ogc.xml.v200;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlType;
import org.opengis.filter.Filter;
import org.opengis.filter.FilterVisitor;
/**
* <p>Java class for UnaryLogicOpType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="UnaryLogicOpType">
* <complexContent>
* <extension base="{http://www.opengis.net/fes/2.0}LogicOpsType">
* <sequence>
* <choice>
* <group ref="{http://www.opengis.net/fes/2.0}FilterPredicates"/>
* </choice>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "UnaryLogicOpType", propOrder = {
"comparisonOps",
"spatialOps",
"temporalOps",
"logicOps",
"extensionOps",
"function",
"id"
})
public class UnaryLogicOpType extends LogicOpsType {
@XmlElementRef(name = "comparisonOps", namespace = "http://www.opengis.net/fes/2.0", type = JAXBElement.class)
private JAXBElement<? extends ComparisonOpsType> comparisonOps;
@XmlElementRef(name = "spatialOps", namespace = "http://www.opengis.net/fes/2.0", type = JAXBElement.class)
private JAXBElement<? extends SpatialOpsType> spatialOps;
@XmlElementRef(name = "temporalOps", namespace = "http://www.opengis.net/fes/2.0", type = JAXBElement.class)
private JAXBElement<? extends TemporalOpsType> temporalOps;
@XmlElementRef(name = "logicOps", namespace = "http://www.opengis.net/fes/2.0", type = JAXBElement.class)
private JAXBElement<? extends LogicOpsType> logicOps;
private ExtensionOpsType extensionOps;
@XmlElement(name = "Function")
private FunctionType function;
@XmlElementRef(name = "_Id", namespace = "http://www.opengis.net/fes/2.0", type = JAXBElement.class)
private List<JAXBElement<? extends AbstractIdType>> id;
/**
* An empty constructor used by JAXB
*/
public UnaryLogicOpType() {
}
/**
* Build a new Binary logic operator
*/
public UnaryLogicOpType(final Object obj) {
// comparison operator
if (obj instanceof ComparisonOpsType) {
this.comparisonOps = FilterType.createComparisonOps((ComparisonOpsType) obj);
// logical operator
} else if (obj instanceof LogicOpsType) {
this.logicOps = FilterType.createLogicOps((LogicOpsType) obj);
// spatial operator
} else if (obj instanceof SpatialOpsType) {
this.spatialOps = FilterType.createSpatialOps((SpatialOpsType) obj);
// temporal operator
} else if (obj instanceof TemporalOpsType) {
this.temporalOps = FilterType.createTemporalOps((TemporalOpsType) obj);
// clone
} else if (obj instanceof UnaryLogicOpType) {
final UnaryLogicOpType that = (UnaryLogicOpType) obj;
final ObjectFactory factory = new ObjectFactory();
if (that.comparisonOps != null) {
final ComparisonOpsType comp = that.comparisonOps.getValue().getClone();
this.comparisonOps = FilterType.createComparisonOps(comp);
}
if (that.extensionOps != null) {
this.extensionOps = that.extensionOps.getClone();
}
if (that.function != null) {
this.function = new FunctionType(that.function);
}
if (that.id != null) {
this.id = new ArrayList<JAXBElement<? extends AbstractIdType>>();
for (JAXBElement<? extends AbstractIdType> jb : that.id) {
AbstractIdType aid = jb.getValue();
if (aid instanceof ResourceIdType) {
final ResourceIdType raid = (ResourceIdType) aid;
this.id.add(factory.createResourceId(new ResourceIdType(raid)));
} else {
throw new IllegalArgumentException("exexpected ID type in filter:" + aid.getClass().getName());
}
}
}
if (that.logicOps != null) {
final LogicOpsType log = that.logicOps.getValue().getClone();
this.logicOps = FilterType.createLogicOps(log);
}
if (that.spatialOps != null) {
final SpatialOpsType spa = that.spatialOps.getValue().getClone();
this.spatialOps = FilterType.createSpatialOps(spa);
}
if (that.temporalOps != null) {
final TemporalOpsType temp = that.temporalOps.getValue().getClone();
this.temporalOps = FilterType.createTemporalOps(temp);
}
} else {
throw new IllegalArgumentException("This kind of object is not allowed:" + obj.getClass().getSimpleName());
}
}
/**
* Gets the value of the comparisonOps property.
*
* @return
* possible object is
* {@link JAXBElement }{@code <}{@link PropertyIsBetweenType }{@code >}
* {@link JAXBElement }{@code <}{@link ComparisonOpsType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryComparisonOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryComparisonOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryComparisonOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryComparisonOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryComparisonOpType }{@code >}
* {@link JAXBElement }{@code <}{@link PropertyIsLikeType }{@code >}
* {@link JAXBElement }{@code <}{@link PropertyIsNilType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryComparisonOpType }{@code >}
* {@link JAXBElement }{@code <}{@link PropertyIsNullType }{@code >}
*
*/
public JAXBElement<? extends ComparisonOpsType> getComparisonOps() {
return comparisonOps;
}
/**
* Sets the value of the comparisonOps property.
*
* @param value
* allowed object is
* {@link JAXBElement }{@code <}{@link PropertyIsBetweenType }{@code >}
* {@link JAXBElement }{@code <}{@link ComparisonOpsType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryComparisonOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryComparisonOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryComparisonOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryComparisonOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryComparisonOpType }{@code >}
* {@link JAXBElement }{@code <}{@link PropertyIsLikeType }{@code >}
* {@link JAXBElement }{@code <}{@link PropertyIsNilType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryComparisonOpType }{@code >}
* {@link JAXBElement }{@code <}{@link PropertyIsNullType }{@code >}
*
*/
public void setComparisonOps(JAXBElement<? extends ComparisonOpsType> value) {
this.comparisonOps = ((JAXBElement<? extends ComparisonOpsType> ) value);
}
/**
* Gets the value of the spatialOps property.
*
* @return
* possible object is
* {@link JAXBElement }{@code <}{@link BinarySpatialOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinarySpatialOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BBOXType }{@code >}
* {@link JAXBElement }{@code <}{@link SpatialOpsType }{@code >}
* {@link JAXBElement }{@code <}{@link BinarySpatialOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinarySpatialOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinarySpatialOpType }{@code >}
* {@link JAXBElement }{@code <}{@link DistanceBufferType }{@code >}
* {@link JAXBElement }{@code <}{@link BinarySpatialOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinarySpatialOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinarySpatialOpType }{@code >}
* {@link JAXBElement }{@code <}{@link DistanceBufferType }{@code >}
*
*/
public JAXBElement<? extends SpatialOpsType> getSpatialOps() {
return spatialOps;
}
/**
* Sets the value of the spatialOps property.
*
* @param value
* allowed object is
* {@link JAXBElement }{@code <}{@link BinarySpatialOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinarySpatialOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BBOXType }{@code >}
* {@link JAXBElement }{@code <}{@link SpatialOpsType }{@code >}
* {@link JAXBElement }{@code <}{@link BinarySpatialOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinarySpatialOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinarySpatialOpType }{@code >}
* {@link JAXBElement }{@code <}{@link DistanceBufferType }{@code >}
* {@link JAXBElement }{@code <}{@link BinarySpatialOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinarySpatialOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinarySpatialOpType }{@code >}
* {@link JAXBElement }{@code <}{@link DistanceBufferType }{@code >}
*
*/
public void setSpatialOps(JAXBElement<? extends SpatialOpsType> value) {
this.spatialOps = ((JAXBElement<? extends SpatialOpsType> ) value);
}
/**
* Gets the value of the temporalOps property.
*
* @return
* possible object is
* {@link JAXBElement }{@code <}{@link BinaryTemporalOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryTemporalOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryTemporalOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryTemporalOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryTemporalOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryTemporalOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryTemporalOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryTemporalOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryTemporalOpType }{@code >}
* {@link JAXBElement }{@code <}{@link TemporalOpsType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryTemporalOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryTemporalOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryTemporalOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryTemporalOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryTemporalOpType }{@code >}
*
*/
public JAXBElement<? extends TemporalOpsType> getTemporalOps() {
return temporalOps;
}
/**
* Sets the value of the temporalOps property.
*
* @param value
* allowed object is
* {@link JAXBElement }{@code <}{@link BinaryTemporalOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryTemporalOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryTemporalOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryTemporalOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryTemporalOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryTemporalOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryTemporalOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryTemporalOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryTemporalOpType }{@code >}
* {@link JAXBElement }{@code <}{@link TemporalOpsType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryTemporalOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryTemporalOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryTemporalOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryTemporalOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryTemporalOpType }{@code >}
*
*/
public void setTemporalOps(JAXBElement<? extends TemporalOpsType> value) {
this.temporalOps = ((JAXBElement<? extends TemporalOpsType> ) value);
}
/**
* Gets the value of the logicOps property.
*
* @return
* possible object is
* {@link JAXBElement }{@code <}{@link BinaryLogicOpType }{@code >}
* {@link JAXBElement }{@code <}{@link LogicOpsType }{@code >}
* {@link JAXBElement }{@code <}{@link UnaryLogicOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryLogicOpType }{@code >}
*
*/
public JAXBElement<? extends LogicOpsType> getLogicOps() {
return logicOps;
}
/**
* Sets the value of the logicOps property.
*
* @param value
* allowed object is
* {@link JAXBElement }{@code <}{@link BinaryLogicOpType }{@code >}
* {@link JAXBElement }{@code <}{@link LogicOpsType }{@code >}
* {@link JAXBElement }{@code <}{@link UnaryLogicOpType }{@code >}
* {@link JAXBElement }{@code <}{@link BinaryLogicOpType }{@code >}
*
*/
public void setLogicOps(JAXBElement<? extends LogicOpsType> value) {
this.logicOps = ((JAXBElement<? extends LogicOpsType> ) value);
}
/**
* Gets the value of the extensionOps property.
*
* @return
* possible object is
* {@link ExtensionOpsType }
*
*/
public ExtensionOpsType getExtensionOps() {
return extensionOps;
}
/**
* Sets the value of the extensionOps property.
*
* @param value
* allowed object is
* {@link ExtensionOpsType }
*
*/
public void setExtensionOps(ExtensionOpsType value) {
this.extensionOps = value;
}
/**
* Gets the value of the function property.
*
* @return
* possible object is
* {@link FunctionType }
*
*/
public FunctionType getFunction() {
return function;
}
/**
* Sets the value of the function property.
*
* @param value
* allowed object is
* {@link FunctionType }
*
*/
public void setFunction(FunctionType value) {
this.function = value;
}
/**
* Gets the value of the id property.
*
* Objects of the following type(s) are allowed in the list
* {@link JAXBElement }{@code <}{@link ResourceIdType }{@code >}
* {@link JAXBElement }{@code <}{@link AbstractIdType }{@code >}
*
*
*/
public List<JAXBElement<? extends AbstractIdType>> getId() {
if (id == null) {
id = new ArrayList<JAXBElement<? extends AbstractIdType>>();
}
return this.id;
}
/**
* implements geoAPI interface
*
* @return
*/
public Filter getFilter() {
if (comparisonOps != null) {
return comparisonOps.getValue();
} else if (logicOps != null) {
return logicOps.getValue();
} else if (spatialOps != null) {
return spatialOps.getValue();
} else if (spatialOps != null) {
return temporalOps.getValue();
} else {
return null;
}
}
@Override
public boolean evaluate(final Object object) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Object accept(final FilterVisitor visitor, final Object extraData) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public LogicOpsType getClone() {
throw new UnsupportedOperationException("Must be overriden in sub-class.");
}
}