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.exception.DatabaseException;
15 import org.simantics.db.impl.graph.ReadGraphImpl;
16 import org.simantics.db.request.RequestFlags;
18 abstract public class UnaryQuery<Procedure> extends CacheEntryBase<Procedure> implements Query {
22 public UnaryQuery(int r) {
34 return RequestFlags.INVALIDATE;
38 final public boolean equals(Object object) {
41 else if (object == null)
43 else if (getClass() != object.getClass())
45 UnaryQuery<?> other = (UnaryQuery<?>)object;
46 return id == other.id;
50 final public Query getQuery() {
51 assert(!isDiscarded());
55 // abstract public void recompute(ReadGraphImpl graph) throws DatabaseException;
56 abstract public void removeEntry(QueryProcessor provider);
58 public Object get(ReadGraphImpl graph, Procedure procedure) throws Throwable {
59 if(procedure != null) {
60 performFromCache(graph, procedure);
68 boolean isImmutable(ReadGraphImpl graph) throws DatabaseException {
69 return graph.processor.isImmutable(id);