]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/adapter/GenericRelation.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.db.layer0 / src / org / simantics / db / layer0 / adapter / GenericRelation.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
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
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.db.layer0.adapter;
13
14 import java.util.List;
15
16 import org.simantics.db.ReadGraph;
17 import org.simantics.db.exception.DatabaseException;
18 import org.simantics.utils.datastructures.Pair;
19
20 public interface GenericRelation {
21
22         /**
23          * Tests whether a tuple belongs to the relation.
24          */
25         boolean contains(ReadGraph graph, Object[] tuple) throws DatabaseException;
26         
27         /**
28          * Tells if realize-method is implemented.
29          */
30         boolean isRealizable();
31         /**
32          * Returns the contents of the relation as a list.
33          */
34         List<Object[]> realize(ReadGraph graph) throws DatabaseException;       
35         
36         /**
37          * Selects and projects the relation by given binding pattern and constants.
38          * The binding pattern is a string of 'b' and 'f' characters. The length
39          * of constants array has to be the number of 'b' letters in binding pattern.
40          */
41         public GenericRelation select(String bindingPattern, Object[] constants);
42         
43         /**
44          * Restricts the relation by given constraint.
45          */
46         public GenericRelation selectByRelation(String bindingPattern, GenericRelation constraint);
47         
48         /**
49          * Tells the names and types of the fields of the relation.
50          */
51         Pair<String, String>[] getFields();
52         
53         //<T> T getInterface(Class<T> clazz);
54         
55 }