All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.securegraph.query.GeoCompare Maven / Gradle / Ivy

The newest version!
package org.securegraph.query;

import org.securegraph.Property;
import org.securegraph.PropertyDefinition;
import org.securegraph.type.GeoShape;

import java.util.Map;

public enum GeoCompare implements Predicate {
    WITHIN;

    @Override
    public boolean evaluate(Iterable properties, Object second, Map 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