]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.structural2/src/org/simantics/structural2/modelingRules/IModelingRules.java
Sync git svn branch with SVN repository r33324.
[simantics/platform.git] / bundles / org.simantics.structural2 / src / org / simantics / structural2 / modelingRules / IModelingRules.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.structural2.modelingRules;\r
13 \r
14 import java.util.Collection;\r
15 import java.util.Set;\r
16 \r
17 import org.simantics.db.ReadGraph;\r
18 import org.simantics.db.Resource;\r
19 import org.simantics.db.WriteGraph;\r
20 import org.simantics.db.exception.DatabaseException;\r
21 \r
22 /**\r
23  * @see <a href="https://www.simantics.org/wiki/index.php/Diagram_ontology#Connection_typing_and_constraints">Ontology documentation</a>\r
24  * @author Hannu Niemistö\r
25  */\r
26 public interface IModelingRules {\r
27         /**\r
28          * Returns true if the component type can be populated to the diagram.\r
29          */\r
30         boolean canPopulate(ReadGraph g, \r
31                         Resource componentType) throws DatabaseException;\r
32 \r
33         /**\r
34          * Tells if connecting the given connection points is possible\r
35          * and what the connection type would be.\r
36          */\r
37         ConnectionJudgement judgeConnection(ReadGraph g, \r
38                         Collection<IConnectionPoint> connectionPoints)\r
39                 throws DatabaseException;\r
40 \r
41         /**\r
42          * Computes a connection type the the given connection\r
43          */\r
44         Resource computeConnectionType(ReadGraph g,\r
45                         Collection<IConnectionPoint> connectionPoints)\r
46                                         throws DatabaseException;\r
47         \r
48         /**\r
49          * Gets attachment relations of already existing connection.\r
50          */\r
51         IAttachmentRelationMap getAttachmentRelations(ReadGraph g, \r
52                         Resource connection) throws DatabaseException;\r
53         \r
54         /**\r
55          * Writes the connection type of the connection to graph.\r
56          */\r
57         void setConnectionType(WriteGraph g,\r
58                         Resource connection,\r
59                         Resource connectionType) throws DatabaseException;\r
60         \r
61         /**\r
62          * Reads the connection type of the connection.\r
63          */\r
64         Resource getConnectionType(ReadGraph g, \r
65                         Resource connection) throws DatabaseException;\r
66         \r
67         Set<CPTerminal> resolveTerminals(ReadGraph g,\r
68                         Collection<IConnectionPoint> connectionPoints) throws DatabaseException;\r
69         \r
70 }\r