/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.jena.query.spatial; import org.apache.jena.graph.Node ; public class SpatialPredicatePair { private Node latitudePredicate; private Node longitudePredicate; public SpatialPredicatePair(Node latitudePredicate, Node longitudePredicate) { super(); this.latitudePredicate = latitudePredicate; this.longitudePredicate = longitudePredicate; } public Node getLatitudePredicate() { return latitudePredicate; } public Node getLongitudePredicate() { return longitudePredicate; } @Override public int hashCode() { return latitudePredicate.hashCode() * 7 + longitudePredicate.hashCode() * 13; } @Override public boolean equals(Object otherObject) { // a quick test to see if the objects are identical if (this == otherObject) return true; // must return false if the explicit parameter is null if (otherObject == null) return false; // if the classes don't match, they can't be equal if (getClass() != otherObject.getClass()) return false; // now we know otherObject is a non-null Employee SpatialPredicatePair other = (SpatialPredicatePair) otherObject; // test whether the fields have identical values return latitudePredicate.equals(other.latitudePredicate) && longitudePredicate == other.longitudePredicate; } @Override public String toString(){ return "[ " + latitudePredicate.toString() + ", " + longitudePredicate.toString() + " ]"; } }