]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.structural2/src/org/simantics/structural2/scl/StructuralConfiguration.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.structural2 / src / org / simantics / structural2 / scl / StructuralConfiguration.java
diff --git a/bundles/org.simantics.structural2/src/org/simantics/structural2/scl/StructuralConfiguration.java b/bundles/org.simantics.structural2/src/org/simantics/structural2/scl/StructuralConfiguration.java
new file mode 100644 (file)
index 0000000..3d3daab
--- /dev/null
@@ -0,0 +1,43 @@
+package org.simantics.structural2.scl;\r
+\r
+import org.simantics.db.Resource;\r
+\r
+\r
+/**\r
+ * Represents a structural configuration.\r
+ * Has exactly two subclasses {@link StructuralComponent} and {@link StructuralComposite}.\r
+ * \r
+ * @author Hannu Niemistö\r
+ */\r
+public abstract class StructuralConfiguration<Connection> {\r
+    /*\r
+     * Prevents extending this class outside of this package. \r
+     */\r
+    public StructuralConfiguration() {\r
+    }\r
+    \r
+    /**\r
+     * Returns underlying resource of the configuration.\r
+     * It can be used to obtain information about the configuration\r
+     * that is not accessible using StructuralComponent or\r
+     * StructuralComposite. For procedural configurations\r
+     * this method may return {@code null} or a resource\r
+     * that represents a template of the configuration.\r
+     */\r
+    public abstract Resource getResource();\r
+    \r
+    /**\r
+     * If the configuration is a root composite of a component\r
+     * type, there are two possible resources that could be\r
+     * reasonably returned in getResource(). New getResource()\r
+     * returns the resource that is linked with IsDefinedBy from\r
+     * the component type and getInstanceResource() returns the\r
+     * instance of the component type. In all other cases this\r
+     * method returns the same resource as getResource().\r
+     */\r
+    public Resource getInstanceResource() {\r
+       return getResource();\r
+    }\r
+    \r
+    public abstract StructuralComponent<Connection> getContext();\r
+}\r