/**
* Copyright (c) Codice Foundation
* <p>
* This 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 3 of the
* License, or any later version.
* <p>
* This program 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. A copy of the GNU Lesser General Public License
* is distributed along with this program and can be found at
* <http://www.gnu.org/licenses/lgpl.html>.
*/
package ddf.catalog.metrics;
import ddf.catalog.filter.impl.SimpleFilterDelegate;
/**
* Filter delegate to determine the types of filter features being used.
*
* @author Phillip Klinefelter
* @author ddf.isgs@lmco.com
*/
public class QueryTypeFilterDelegate extends SimpleFilterDelegate<Boolean> {
private boolean isSpatial = false;
private boolean isTemporal = false;
private boolean isXpath = false;
private boolean isLogical = false;
private boolean isFuzzy = false;
private boolean isCaseSensitive = false;
private boolean isComparison = false;
@Override
public <S> Boolean spatialOperation(String propertyName, S literal, Class<S> wktClass,
SpatialPropertyOperation spatialPropertyOperation) {
return isSpatial = true;
}
@Override
public <S> Boolean xpathOperation(String xpath, S literal, Class<S> literalClass,
XPathPropertyOperation xpathPropertyOperation) {
return isXpath = true;
}
@Override
public <S> Boolean temporalOperation(String propertyName, S literal, Class<S> literalClass,
TemporalPropertyOperation temporalPropertyOperation) {
return isTemporal = true;
}
@Override
public Boolean logicalOperation(Object operand,
LogicalPropertyOperation logicalPropertyOperation) {
return isLogical = true;
}
@Override
public <S> Boolean comparisonOperation(String propertyName, S literal, Class<S> literalClass,
ComparisonPropertyOperation comparisonPropertyOperation) {
return isComparison = true;
}
@Override
public Boolean propertyIsEqualTo(String propertyName, String literal, boolean isCaseSensitive) {
if (isCaseSensitive) {
this.isCaseSensitive = true;
}
return isComparison = true;
}
@Override
public Boolean propertyIsNotEqualTo(String propertyName, String literal,
boolean isCaseSensitive) {
if (isCaseSensitive) {
this.isCaseSensitive = true;
}
return isComparison = true;
}
@Override
public Boolean propertyIsLike(String propertyName, String pattern, boolean isCaseSensitive) {
if (isCaseSensitive) {
this.isCaseSensitive = true;
}
return isComparison = true;
}
@Override
public Boolean propertyIsFuzzy(String propertyName, String literal) {
isFuzzy = true;
return isComparison = true;
}
public boolean isSpatial() {
return isSpatial;
}
public boolean isTemporal() {
return isTemporal;
}
public boolean isXpath() {
return isXpath;
}
public boolean isLogical() {
return isLogical;
}
public boolean isFuzzy() {
return isFuzzy;
}
public boolean isCaseSensitive() {
return isCaseSensitive;
}
public boolean isComparison() {
return isComparison;
}
}