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