]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.structural2/src/org/simantics/structural2/scl/StructuralConfiguration.java
Merge "Remove unnecessary getComparableKey from HashMapBinding"
[simantics/platform.git] / bundles / org.simantics.structural2 / src / org / simantics / structural2 / scl / StructuralConfiguration.java
1 package org.simantics.structural2.scl;
2
3 import org.simantics.db.Resource;
4
5
6 /**
7  * Represents a structural configuration.
8  * Has exactly two subclasses {@link StructuralComponent} and {@link StructuralComposite}.
9  * 
10  * @author Hannu Niemistö
11  */
12 public abstract class StructuralConfiguration<Connection> {
13     /*
14      * Prevents extending this class outside of this package. 
15      */
16     public StructuralConfiguration() {
17     }
18     
19     /**
20      * Returns underlying resource of the configuration.
21      * It can be used to obtain information about the configuration
22      * that is not accessible using StructuralComponent or
23      * StructuralComposite. For procedural configurations
24      * this method may return {@code null} or a resource
25      * that represents a template of the configuration.
26      */
27     public abstract Resource getResource();
28     
29     /**
30      * If the configuration is a root composite of a component
31      * type, there are two possible resources that could be
32      * reasonably returned in getResource(). New getResource()
33      * returns the resource that is linked with IsDefinedBy from
34      * the component type and getInstanceResource() returns the
35      * instance of the component type. In all other cases this
36      * method returns the same resource as getResource().
37      */
38     public Resource getInstanceResource() {
39         return getResource();
40     }
41     
42     public abstract StructuralComponent<Connection> getContext();
43 }