]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.modeling/src/org/simantics/modeling/typicals/TypicalInfoBean.java
Merge "InputStream returns -1 on EOF instead of throwing IOException"
[simantics/platform.git] / bundles / org.simantics.modeling / src / org / simantics / modeling / typicals / TypicalInfoBean.java
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
3  * 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.modeling.typicals;\r
13 \r
14 import java.util.Map;\r
15 import java.util.Set;\r
16 \r
17 import org.simantics.databoard.Bindings;\r
18 import org.simantics.databoard.annotations.Identifier;\r
19 import org.simantics.databoard.annotations.Optional;\r
20 import org.simantics.databoard.binding.Binding;\r
21 import org.simantics.databoard.util.Bean;\r
22 import org.simantics.db.Resource;\r
23 \r
24 /**\r
25  * Information structure for a single typical diagram instance diagram.\r
26  * \r
27  * @author Tuukka Lehtonen\r
28  */\r
29 public class TypicalInfoBean extends Bean.Id {\r
30 \r
31     public static final Binding BINDING = Bindings.getBindingUnchecked(TypicalInfoBean.class);\r
32 \r
33     /**\r
34      * All DIA.Elements in the typical diagram instance.\r
35      */\r
36     @Identifier public Set<Resource>           instanceElements;\r
37 \r
38     /**\r
39      * Maps all typical diagram instance elements to template elements where\r
40      * a MOD.HasElementSource mapping exists.\r
41      */\r
42     @Identifier public Map<Resource, Resource> instanceToTemplate;\r
43 \r
44     /**\r
45      * Inverse map of {@link #instanceToTemplate}\r
46      */\r
47     public Map<Resource, Resource>             templateToInstance;\r
48 \r
49     /**\r
50      * Describes the set of DIA.Elements that are marked with\r
51      * MOD.IsTemplatized tag.\r
52      */\r
53     @Identifier public Set<Resource>           isTemplatized;\r
54 \r
55     /**\r
56      * Current set of template diagram elements.\r
57      */\r
58     @Optional public transient Set<Resource>   templateElements;\r
59 \r
60     /**\r
61      * Auxiliary transient data passed on during synchronization.\r
62      */\r
63     @Optional public transient Map<Object, Object> auxiliary;\r
64 \r
65     public TypicalInfoBean() {\r
66         super(BINDING);\r
67     }\r
68 \r
69     @SuppressWarnings("unchecked")\r
70     public <T> T getAux(Object key) {\r
71         return auxiliary == null ? null : (T) auxiliary.get(key);\r
72     }\r
73 \r
74 }