org.vertexium.query.GeoCompare Maven / Gradle / Ivy
package org.vertexium.query;
import org.vertexium.Property;
import org.vertexium.PropertyDefinition;
import org.vertexium.type.GeoShape;
import java.util.Collection;
public enum GeoCompare implements Predicate {
WITHIN;
@Override
public boolean evaluate(Iterable properties, Object second, Collection propertyDefinitions) {
for (Property property : properties) {
if (evaluate(property, second)) {
return true;
}
}
return false;
}
private boolean evaluate(Property property, Object second) {
switch (this) {
case WITHIN:
return ((GeoShape) second).within((GeoShape) property.getValue());
default:
throw new IllegalArgumentException("Invalid compare: " + this);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy