]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.common/src/org/simantics/db/common/primitiverequest/Builtin.java
More DB ListenerAdapter abstract to force isDisposed implementation
[simantics/platform.git] / bundles / org.simantics.db.common / src / org / simantics / db / common / primitiverequest / Builtin.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
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
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.db.common.primitiverequest;
13
14 import org.simantics.db.AsyncReadGraph;
15 import org.simantics.db.Resource;
16 import org.simantics.db.procedure.AsyncProcedure;
17 import org.simantics.db.request.AsyncRead;
18
19 final public class Builtin implements AsyncRead<Resource> {
20
21     final protected String URI;
22     
23     @Override
24     public int hashCode() {
25         return URI.hashCode();
26     }
27     
28     @Override
29     public int threadHash() {
30         return hashCode();
31     }
32     
33     @Override
34     public boolean equals(Object object) {
35         if (this == object)
36             return true;
37         else if (object == null)
38             return false;
39         else if (getClass() != object.getClass())
40             return false;
41         Builtin r = (Builtin)object;
42         return URI.equals(r.URI);
43     }
44
45     public Builtin(String URI) {
46         assert(URI != null);
47         this.URI = URI;
48     }
49
50     @Override
51     public void perform(AsyncReadGraph graph, AsyncProcedure<Resource> procedure) {
52         
53         graph.forBuiltin(URI, procedure);
54         
55     }
56     
57     @Override
58     public int getFlags() {
59         return 0;
60     }
61
62 }