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