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