]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.modeling/src/org/simantics/modeling/typicals/ReadTypicalInfo.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.modeling / src / org / simantics / modeling / typicals / ReadTypicalInfo.java
index 55d768b0bb712eb9ea6d2e393266265eb08458da..fb443c9aa9cc52ec5f46c19a98f50314f03ea210 100644 (file)
@@ -1,61 +1,61 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.modeling.typicals;\r
-\r
-import gnu.trove.map.hash.THashMap;\r
-\r
-import java.util.TreeSet;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.common.request.ObjectsWithType;\r
-import org.simantics.db.common.request.UnaryRead;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.diagram.stubs.DiagramResource;\r
-import org.simantics.layer0.Layer0;\r
-import org.simantics.modeling.ModelingResources;\r
-\r
-/**\r
- * Reads a TypicalInfo info structure for the specified typical diagram instance.\r
- *  \r
- * @author Tuukka Lehtonen\r
- */\r
-public class ReadTypicalInfo extends UnaryRead<Resource, TypicalInfoBean> {\r
-\r
-    public ReadTypicalInfo(Resource typicalInstance) {\r
-        super(typicalInstance);\r
-    }\r
-\r
-    @Override\r
-    public TypicalInfoBean perform(ReadGraph graph) throws DatabaseException {\r
-        Layer0 L0 = Layer0.getInstance(graph);\r
-        DiagramResource DIA = DiagramResource.getInstance(graph);\r
-        ModelingResources MOD = ModelingResources.getInstance(graph);\r
-\r
-        TypicalInfoBean info = new TypicalInfoBean();\r
-        info.instanceElements = new TreeSet<Resource>( graph.syncRequest( new ObjectsWithType(parameter, L0.ConsistsOf, DIA.Element) ) );\r
-        info.instanceToTemplate = new THashMap<Resource, Resource>( info.instanceElements.size() );\r
-        info.templateToInstance = new THashMap<Resource, Resource>( info.instanceElements.size() );\r
-        info.isTemplatized = new TreeSet<Resource>();\r
-        for (Resource instanceElement : info.instanceElements) {\r
-            Resource templateElement = graph.getPossibleObject(instanceElement, MOD.HasElementSource);\r
-            if (templateElement != null) {\r
-                info.instanceToTemplate.put(instanceElement, templateElement);\r
-                info.templateToInstance.put(templateElement, instanceElement);\r
-            }\r
-            if (graph.hasStatement(instanceElement, MOD.IsTemplatized))\r
-                info.isTemplatized.add(instanceElement);\r
-        }\r
-        return info;\r
-    }\r
-\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2012 Association for Decentralized Information Management in
+ * Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.modeling.typicals;
+
+import gnu.trove.map.hash.THashMap;
+
+import java.util.TreeSet;
+
+import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.common.request.ObjectsWithType;
+import org.simantics.db.common.request.UnaryRead;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.diagram.stubs.DiagramResource;
+import org.simantics.layer0.Layer0;
+import org.simantics.modeling.ModelingResources;
+
+/**
+ * Reads a TypicalInfo info structure for the specified typical diagram instance.
+ *  
+ * @author Tuukka Lehtonen
+ */
+public class ReadTypicalInfo extends UnaryRead<Resource, TypicalInfoBean> {
+
+    public ReadTypicalInfo(Resource typicalInstance) {
+        super(typicalInstance);
+    }
+
+    @Override
+    public TypicalInfoBean perform(ReadGraph graph) throws DatabaseException {
+        Layer0 L0 = Layer0.getInstance(graph);
+        DiagramResource DIA = DiagramResource.getInstance(graph);
+        ModelingResources MOD = ModelingResources.getInstance(graph);
+
+        TypicalInfoBean info = new TypicalInfoBean();
+        info.instanceElements = new TreeSet<Resource>( graph.syncRequest( new ObjectsWithType(parameter, L0.ConsistsOf, DIA.Element) ) );
+        info.instanceToTemplate = new THashMap<Resource, Resource>( info.instanceElements.size() );
+        info.templateToInstance = new THashMap<Resource, Resource>( info.instanceElements.size() );
+        info.isTemplatized = new TreeSet<Resource>();
+        for (Resource instanceElement : info.instanceElements) {
+            Resource templateElement = graph.getPossibleObject(instanceElement, MOD.HasElementSource);
+            if (templateElement != null) {
+                info.instanceToTemplate.put(instanceElement, templateElement);
+                info.templateToInstance.put(templateElement, instanceElement);
+            }
+            if (graph.hasStatement(instanceElement, MOD.IsTemplatized))
+                info.isTemplatized.add(instanceElement);
+        }
+        return info;
+    }
+
 }
\ No newline at end of file