/******************************************************************************* * Copyright (c) 2010 Fraunhofer IWU and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Fraunhofer IWU - initial API and implementation *******************************************************************************/ package net.enilink.komma.parser.sparql.tree; public class PropertyPattern { protected GraphNode predicate; protected GraphNode object; public PropertyPattern(GraphNode predicate, GraphNode object) { this.predicate = predicate; this.object = object; } public GraphNode getPredicate() { return predicate; } public GraphNode getObject() { return object; } public PropertyPattern copy() { return new PropertyPattern(predicate.copy(true), object.copy(true)); } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((object == null) ? 0 : object.hashCode()); result = prime * result + ((predicate == null) ? 0 : predicate.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof PropertyPattern)) return false; PropertyPattern other = (PropertyPattern) obj; if (object == null) { if (other.object != null) return false; } else if (!object.equals(other.object)) return false; if (predicate == null) { if (other.predicate != null) return false; } else if (!predicate.equals(other.predicate)) return false; return true; } }