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.impl.query;
\r
14 import org.simantics.db.impl.graph.ReadGraphImpl;
\r
15 import org.simantics.db.request.RequestFlags;
\r
17 abstract public class StringQuery<Procedure> extends CacheEntryBase implements Query {
\r
19 final public String id;
\r
20 final public int hash;
\r
22 public StringQuery(String id) {
\r
25 hash = id.hashCode();
\r
30 return id.hashCode();
\r
33 final protected static int hash(String id) {
\r
34 return id.hashCode();
\r
39 return RequestFlags.INVALIDATE;
\r
43 final public boolean equals(Object object) {
\r
46 else if (object == null)
\r
48 else if (getClass() != object.getClass())
\r
50 StringQuery other = (StringQuery)object;
\r
51 return id == other.id;
\r
55 final public Query getQuery() {
\r
60 public void recompute(ReadGraphImpl graph, Object provider, CacheEntry entry) {
\r
61 throw new Error("Recompute of primitive queries is not supported.");
\r
65 public void performFromCache(ReadGraphImpl graph, Object provider, Object procedure) {
\r
66 throw new Error("Not possible.");
\r
69 abstract public void recompute(ReadGraphImpl graph, QueryProcessor provider);
\r
70 abstract public void computeForEach(ReadGraphImpl graph, QueryProcessor provider, Procedure procedure);
\r
71 abstract public void performFromCache(ReadGraphImpl graph, QueryProcessor provider, Procedure procedure);
\r
72 abstract public void putEntry(QueryProcessor provider);
\r
73 abstract public void removeEntry(QueryProcessor provider);
\r
74 abstract public StringQuery<Procedure> getEntry(QueryProcessor provider);
\r