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
18 abstract public class BinaryQuery<Procedure> extends CacheEntryBase implements Query {
\r
20 final public long id;
\r
22 public BinaryQuery(final long r1, final long r2) {
\r
34 final public int r1() {
\r
35 return (int)(id>>>32);
\r
38 final public int r2() {
\r
42 final protected static long id(long r1, long r2) {
\r
43 long result = (r1<<32) | (r2 & 0xffffffffL);
\r
49 return RequestFlags.INVALIDATE;
\r
53 final public boolean equals(Object object) {
\r
56 else if (object == null)
\r
58 else if (getClass() != object.getClass())
\r
60 BinaryQuery<?> other = (BinaryQuery<?>)object;
\r
61 return id == other.id;
\r
65 final public Query getQuery() {
\r
70 public void recompute(ReadGraphImpl graph, Object provider, CacheEntry entry) {
\r
71 recompute(graph, (QueryProcessor)provider);
\r
75 public void performFromCache(ReadGraphImpl graph, Object provider, Object procedure) {
\r
76 performFromCache(graph, (QueryProcessor)provider, (Procedure)procedure);
\r
79 abstract public void recompute(ReadGraphImpl graph, QueryProcessor provider);
\r
80 abstract public void computeForEach(ReadGraphImpl graph, QueryProcessor provider, Procedure procedure, boolean store);
\r
81 abstract public void performFromCache(ReadGraphImpl graph, QueryProcessor provider, Procedure procedure);
\r
82 abstract public void putEntry(QueryProcessor provider);
\r
83 abstract public void removeEntry(QueryProcessor provider);
\r
84 abstract public BinaryQuery<Procedure> getEntry(QueryProcessor provider);
\r