1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.db.layer0.util;
14 import org.simantics.db.RelationContext;
15 import org.simantics.db.Resource;
16 import org.simantics.db.Statement;
18 final public class RelationContextImpl implements RelationContext {
20 final private Resource subject;
21 final private Statement statement;
23 public RelationContextImpl(Resource subject, Statement statement) {
24 assert(subject != null);
25 assert(statement != null);
26 this.subject = subject;
27 this.statement = statement;
31 public int hashCode() {
32 return subject.hashCode() + 31 * statement.hashCode();
36 public boolean equals(Object object) {
39 else if (object == null)
41 else if (RelationContextImpl.class != object.getClass())
43 RelationContextImpl r = (RelationContextImpl)object;
44 return subject.equals(r.subject) && statement.equals(r.statement);
48 public Resource getSubject() {
53 public Statement getStatement() {