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 fi.vtt.simantics.procore.internal;
14 import org.simantics.db.Resource;
15 import org.simantics.db.Statement;
16 import org.simantics.db.impl.ResourceImpl;
17 import org.simantics.db.impl.support.ResourceSupport;
19 final public class DirectStatementImpl implements Statement {
21 final ResourceSupport support;
26 DirectStatementImpl(ResourceSupport support, int s, int p, int o) {
27 this.support = support;
34 public Resource getObject() {
35 return new ResourceImpl(support, o);
39 public Resource getPredicate() {
40 return new ResourceImpl(support, p);
44 public Resource getSubject() {
45 return new ResourceImpl(support, s);
49 public boolean isAsserted(Resource subject) {
54 final public int hashCode() {
55 return 41 * ( 31 * s + p) + o;
59 public boolean equals(Object object) {
62 else if (object == null)
64 else if (!(object instanceof Statement))
66 Statement r = (Statement)object;
67 return getSubject().equalsResource(r.getSubject()) && getPredicate().equalsResource(r.getPredicate()) && getObject().equalsResource(r.getObject());