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;
18 public class NewStatementImpl implements Statement {
20 public final ResourceImpl subject;
21 public final ResourceImpl predicate;
22 public final ResourceImpl object;
24 public NewStatementImpl(int id, ResourceImpl subject, ResourceImpl predicate, ResourceImpl object) {
26 throw new IllegalArgumentException();
28 throw new IllegalArgumentException();
30 throw new IllegalArgumentException();
31 this.subject = (ResourceImpl)subject;
32 this.predicate = (ResourceImpl)predicate;
33 this.object = (ResourceImpl)object;
36 final public Resource getObject() {
41 final public Resource getPredicate() {
46 final public Resource getSubject() {
53 int result = 6151 * ((int)(subject.id ^ (subject.id>>>32))*6151 +
54 (int)(predicate.id ^ (predicate.id>>>32))) +
55 (int)(object.id ^ (object.id>>>32));
61 public boolean isAsserted(Resource testSubject) {
62 return !subject.equals(testSubject);
65 public boolean equals(Object object)
69 else if (object == null)
72 Statement r = (Statement)object;
73 return subject.id == r.getSubject().getResourceId() &&
74 predicate.id == r.getPredicate().getResourceId() &&
75 this.object.id == r.getObject().getResourceId();
76 } catch (ClassCastException e) {