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