diff options
Diffstat (limited to 'plugins/org.eclipse.etrice.generator.config')
10 files changed, 943 insertions, 943 deletions
diff --git a/plugins/org.eclipse.etrice.generator.config/.classpath b/plugins/org.eclipse.etrice.generator.config/.classpath index 54357e36e..358df1bc1 100644 --- a/plugins/org.eclipse.etrice.generator.config/.classpath +++ b/plugins/org.eclipse.etrice.generator.config/.classpath @@ -1,8 +1,8 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="xtend-gen"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="xtend-gen"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/plugins/org.eclipse.etrice.generator.config/.gitignore b/plugins/org.eclipse.etrice.generator.config/.gitignore index d1b2f933f..65847a73f 100644 --- a/plugins/org.eclipse.etrice.generator.config/.gitignore +++ b/plugins/org.eclipse.etrice.generator.config/.gitignore @@ -1,2 +1,2 @@ -bin
-*._trace
+bin +*._trace diff --git a/plugins/org.eclipse.etrice.generator.config/.project b/plugins/org.eclipse.etrice.generator.config/.project index 4093fbb76..7734f8673 100644 --- a/plugins/org.eclipse.etrice.generator.config/.project +++ b/plugins/org.eclipse.etrice.generator.config/.project @@ -1,34 +1,34 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.etrice.generator.config</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.etrice.generator.config</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.xtext.ui.shared.xtextBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.xtext.ui.shared.xtextNature</nature> + </natures> +</projectDescription> diff --git a/plugins/org.eclipse.etrice.generator.config/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.etrice.generator.config/.settings/org.eclipse.jdt.core.prefs index f287d53cf..c537b6306 100644 --- a/plugins/org.eclipse.etrice.generator.config/.settings/org.eclipse.jdt.core.prefs +++ b/plugins/org.eclipse.etrice.generator.config/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,7 @@ -eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.6
+eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/plugins/org.eclipse.etrice.generator.config/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.generator.config/META-INF/MANIFEST.MF index 63a9d6793..012251909 100644 --- a/plugins/org.eclipse.etrice.generator.config/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.etrice.generator.config/META-INF/MANIFEST.MF @@ -1,17 +1,17 @@ -Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: eTrice Generator Config
-Bundle-SymbolicName: org.eclipse.etrice.generator.config;singleton:=true
-Bundle-Version: 0.3.0.qualifier
-Bundle-Vendor: Eclipse eTrice (Incubation)
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Bundle-ActivationPolicy: lazy
-Require-Bundle: org.eclipse.etrice.core.room;bundle-version="0.3.0",
- org.eclipse.etrice.core.config;bundle-version="0.3.0",
- org.eclipse.etrice.generator;bundle-version="0.3.0",
- org.eclipse.etrice.core.genmodel;bundle-version="0.3.0",
- org.eclipse.xtend.lib,
- com.google.guava,
- org.eclipse.xtext.xbase.lib
-Export-Package: org.eclipse.etrice.generator.config
-
+Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: eTrice Generator Config +Bundle-SymbolicName: org.eclipse.etrice.generator.config;singleton:=true +Bundle-Version: 0.3.0.qualifier +Bundle-Vendor: Eclipse eTrice (Incubation) +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ActivationPolicy: lazy +Require-Bundle: org.eclipse.etrice.core.room;bundle-version="0.3.0", + org.eclipse.etrice.core.config;bundle-version="0.3.0", + org.eclipse.etrice.generator;bundle-version="0.3.0", + org.eclipse.etrice.core.genmodel;bundle-version="0.3.0", + org.eclipse.xtend.lib, + com.google.guava, + org.eclipse.xtext.xbase.lib +Export-Package: org.eclipse.etrice.generator.config + diff --git a/plugins/org.eclipse.etrice.generator.config/about.html b/plugins/org.eclipse.etrice.generator.config/about.html index f47dbddbb..c258ef55d 100644 --- a/plugins/org.eclipse.etrice.generator.config/about.html +++ b/plugins/org.eclipse.etrice.generator.config/about.html @@ -1,28 +1,28 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>June 5, 2006</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, "Program" will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party ("Redistributor") and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
-
-</body>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> +<title>About</title> +</head> +<body lang="EN-US"> +<h2>About This Content</h2> + +<p>June 5, 2006</p> +<h3>License</h3> + +<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. +For purposes of the EPL, "Program" will mean the Content.</p> + +<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p> + +</body> </html>
\ No newline at end of file diff --git a/plugins/org.eclipse.etrice.generator.config/build.properties b/plugins/org.eclipse.etrice.generator.config/build.properties index eeeed051e..ea832598c 100644 --- a/plugins/org.eclipse.etrice.generator.config/build.properties +++ b/plugins/org.eclipse.etrice.generator.config/build.properties @@ -1,4 +1,4 @@ -source.. = src/,\
- xtend-gen/
-bin.includes = META-INF/,\
- .
+source.. = src/,\ + xtend-gen/ +bin.includes = META-INF/,\ + . diff --git a/plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/DataConfiguration.xtend b/plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/DataConfiguration.xtend index 3530e3e02..d382794ca 100644 --- a/plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/DataConfiguration.xtend +++ b/plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/DataConfiguration.xtend @@ -1,184 +1,184 @@ -/*******************************************************************************
- * Copyright (c) 2012 Juergen Haug
- * 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:
- * Juergen Haug
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.generator.config
-
-import com.google.inject.Inject
-import java.util.ArrayList
-import java.util.List
-import org.eclipse.emf.ecore.EObject
-import org.eclipse.emf.ecore.resource.ResourceSet
-import org.eclipse.etrice.core.ConfigStandaloneSetup
-import org.eclipse.etrice.core.config.BooleanLiteral
-import org.eclipse.etrice.core.config.ConfigModel
-import org.eclipse.etrice.core.config.IntLiteral
-import org.eclipse.etrice.core.config.Literal
-import org.eclipse.etrice.core.config.LiteralArray
-import org.eclipse.etrice.core.config.RealLiteral
-import org.eclipse.etrice.core.config.StringLiteral
-import org.eclipse.etrice.core.genmodel.base.ILogger
-import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance
-import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance
-import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance
-import org.eclipse.etrice.core.room.ActorClass
-import org.eclipse.etrice.core.room.Attribute
-import org.eclipse.etrice.core.room.ProtocolClass
-import org.eclipse.etrice.generator.base.IDataConfiguration
-import org.eclipse.etrice.generator.base.IResourceURIAcceptor
-import org.eclipse.etrice.generator.config.util.DataConfigurationHelper
-import org.eclipse.xtext.scoping.impl.ImportUriResolver
-import org.eclipse.emf.common.EMFPlugin
-
-class DataConfiguration implements IDataConfiguration {
-
- @Inject
- protected ILogger logger;
-
- @Inject
- protected ImportUriResolver uriResolver;
-
- override doSetup() {
- if (!EMFPlugin::IS_ECLIPSE_RUNNING)
- ConfigStandaloneSetup::doSetup()
-
- }
-
- override setResources(ResourceSet resource, ILogger logger) {
- DataConfigurationHelper::setConfigModels(resource, logger)
- }
-
- // static
-
- override getAttrClassConfigValue(ActorClass actor, List<Attribute> path) {
- actor.getAttrClassConfig(path)?.value?.toStringExpr
- }
-
- override getAttrClassConfigMaxValue(ActorClass actor, List<Attribute> path) {
- actor.getAttrClassConfig(path)?.max?.toStringExpr
- }
-
- override getAttrClassConfigMinValue(ActorClass actor, List<Attribute> path) {
- actor.getAttrClassConfig(path)?.min?.toStringExpr
- }
-
- def private getAttrClassConfig(ActorClass actor, List<Attribute> path){
- var id = '''/«actor.name»/«path.toStringPath»'''.toString
- DataConfigurationHelper::actorClassAttrMap.get(id)
- }
-
- override getAttrClassConfigValue(ProtocolClass pc, boolean regular, List<Attribute> path) {
- var id = '''/«pc.name»/«IF regular»regular«ELSE»conjugated«ENDIF»/«path.toStringPath»'''.toString
- DataConfigurationHelper::protocolClassAttrMap.get(id)?.value?.toStringExpr
- }
-
- def private toStringPath(List<Attribute> path){
- '''«FOR a : path SEPARATOR '/'»«a.name»«ENDFOR»'''.toString
- }
-
- override getAttrInstanceConfigValue(ActorInstance ai, List<Attribute> path) {
- var id = ai.path+"/"+path.toStringPath
- DataConfigurationHelper::actorInstanceAttrMap.get(id)?.value?.toStringExpr
- }
-
- override getAttrInstanceConfigValue(InterfaceItemInstance item, List<Attribute> path) {
- DataConfigurationHelper::actorInstanceAttrMap.get(item.path+"/"+path.toStringPath)?.value?.toStringExpr
- }
- // dynamic
-
- override getPollingTimerUser(SubSystemInstance subsystem) {
- val dynConf = subsystem.config?.dynConfig
- if (dynConf==null)
- 0
- else
- dynConf.polling
- }
-
- override getUserCode1(SubSystemInstance subsystem) {
- var dynConfig = subsystem.config?.dynConfig
- return
- if(dynConfig?.filePath != null)
- "import org.eclipse.etrice.runtime.java.config.ConfigSourceFile;" // TODO JH make lang independent
- else
- dynConfig?.userCode1
- }
-
- override getUserCode2(SubSystemInstance subsystem) {
- var dynConfig = subsystem.config?.dynConfig
- return
- if(dynConfig?.filePath != null)
- '''new ConfigSourceFile("«dynConfig.filePath»")'''
- else
- dynConfig?.userCode2
- }
-
- override getDynConfigReadAttributes(ActorInstance ai) {
- val result = new ArrayList<Attribute>
- var configs = DataConfigurationHelper::dynActorInstanceAttrMap.get(ai.path)
- configs?.forEach(c | if(c.readOnly)result.add(c.attribute))
-
- return result
- }
-
- override getDynConfigWriteAttributes(ActorInstance ai) {
- val result = new ArrayList<Attribute>
- var configs = DataConfigurationHelper::dynActorInstanceAttrMap.get(ai.path)
- configs?.forEach(c | if(!c.readOnly)result.add(c.attribute))
-
- return result
- }
-
-
- override hasVariableService(SubSystemInstance subsystem) {
- subsystem.config?.dynConfig != null
- }
-
- def private toStringExpr(LiteralArray literal){
- '''«FOR l : literal.literals SEPARATOR ','»«l.toStringExpr»«ENDFOR»'''.toString
- }
-
- def private toStringExpr(Literal literal){
- switch(literal){
- BooleanLiteral: literal.isTrue.toString
- IntLiteral: literal.value.toString
- RealLiteral: literal.value.toString
- StringLiteral: literal.value.toString
- }
- }
-
- def private getConfig(SubSystemInstance cc){
- DataConfigurationHelper::subSystemConfigMap.get(cc.path)
- }
-
- override getDynConfigReadAttributes(ActorClass actor) {
- val result = new ArrayList<Attribute>
- var configs = DataConfigurationHelper::dynActorClassAttrMap.get(actor)
- configs?.forEach(c | if(c.readOnly)result.add(c.attribute))
- return result
- }
-
- override getDynConfigWriteAttributes(ActorClass actor) {
- val result = new ArrayList<Attribute>
- var configs = DataConfigurationHelper::dynActorClassAttrMap.get(actor)
- configs?.forEach(c | if(!c.readOnly)result.add(c.attribute))
- return result
- }
-
- override void addReferencedModels(IResourceURIAcceptor acceptor, EObject root) {
- if (root instanceof ConfigModel) {
- for (imp : (root as ConfigModel).imports) {
- val importURI = uriResolver.resolve(imp)
- acceptor.addResourceURI(importURI);
- }
- }
- }
-
-}
+/******************************************************************************* + * Copyright (c) 2012 Juergen Haug + * 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: + * Juergen Haug + * + *******************************************************************************/ + +package org.eclipse.etrice.generator.config + +import com.google.inject.Inject +import java.util.ArrayList +import java.util.List +import org.eclipse.emf.ecore.EObject +import org.eclipse.emf.ecore.resource.ResourceSet +import org.eclipse.etrice.core.ConfigStandaloneSetup +import org.eclipse.etrice.core.config.BooleanLiteral +import org.eclipse.etrice.core.config.ConfigModel +import org.eclipse.etrice.core.config.IntLiteral +import org.eclipse.etrice.core.config.Literal +import org.eclipse.etrice.core.config.LiteralArray +import org.eclipse.etrice.core.config.RealLiteral +import org.eclipse.etrice.core.config.StringLiteral +import org.eclipse.etrice.core.genmodel.base.ILogger +import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance +import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance +import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance +import org.eclipse.etrice.core.room.ActorClass +import org.eclipse.etrice.core.room.Attribute +import org.eclipse.etrice.core.room.ProtocolClass +import org.eclipse.etrice.generator.base.IDataConfiguration +import org.eclipse.etrice.generator.base.IResourceURIAcceptor +import org.eclipse.etrice.generator.config.util.DataConfigurationHelper +import org.eclipse.xtext.scoping.impl.ImportUriResolver +import org.eclipse.emf.common.EMFPlugin + +class DataConfiguration implements IDataConfiguration { + + @Inject + protected ILogger logger; + + @Inject + protected ImportUriResolver uriResolver; + + override doSetup() { + if (!EMFPlugin::IS_ECLIPSE_RUNNING) + ConfigStandaloneSetup::doSetup() + + } + + override setResources(ResourceSet resource, ILogger logger) { + DataConfigurationHelper::setConfigModels(resource, logger) + } + + // static + + override getAttrClassConfigValue(ActorClass actor, List<Attribute> path) { + actor.getAttrClassConfig(path)?.value?.toStringExpr + } + + override getAttrClassConfigMaxValue(ActorClass actor, List<Attribute> path) { + actor.getAttrClassConfig(path)?.max?.toStringExpr + } + + override getAttrClassConfigMinValue(ActorClass actor, List<Attribute> path) { + actor.getAttrClassConfig(path)?.min?.toStringExpr + } + + def private getAttrClassConfig(ActorClass actor, List<Attribute> path){ + var id = '''/«actor.name»/«path.toStringPath»'''.toString + DataConfigurationHelper::actorClassAttrMap.get(id) + } + + override getAttrClassConfigValue(ProtocolClass pc, boolean regular, List<Attribute> path) { + var id = '''/«pc.name»/«IF regular»regular«ELSE»conjugated«ENDIF»/«path.toStringPath»'''.toString + DataConfigurationHelper::protocolClassAttrMap.get(id)?.value?.toStringExpr + } + + def private toStringPath(List<Attribute> path){ + '''«FOR a : path SEPARATOR '/'»«a.name»«ENDFOR»'''.toString + } + + override getAttrInstanceConfigValue(ActorInstance ai, List<Attribute> path) { + var id = ai.path+"/"+path.toStringPath + DataConfigurationHelper::actorInstanceAttrMap.get(id)?.value?.toStringExpr + } + + override getAttrInstanceConfigValue(InterfaceItemInstance item, List<Attribute> path) { + DataConfigurationHelper::actorInstanceAttrMap.get(item.path+"/"+path.toStringPath)?.value?.toStringExpr + } + // dynamic + + override getPollingTimerUser(SubSystemInstance subsystem) { + val dynConf = subsystem.config?.dynConfig + if (dynConf==null) + 0 + else + dynConf.polling + } + + override getUserCode1(SubSystemInstance subsystem) { + var dynConfig = subsystem.config?.dynConfig + return + if(dynConfig?.filePath != null) + "import org.eclipse.etrice.runtime.java.config.ConfigSourceFile;" // TODO JH make lang independent + else + dynConfig?.userCode1 + } + + override getUserCode2(SubSystemInstance subsystem) { + var dynConfig = subsystem.config?.dynConfig + return + if(dynConfig?.filePath != null) + '''new ConfigSourceFile("«dynConfig.filePath»")''' + else + dynConfig?.userCode2 + } + + override getDynConfigReadAttributes(ActorInstance ai) { + val result = new ArrayList<Attribute> + var configs = DataConfigurationHelper::dynActorInstanceAttrMap.get(ai.path) + configs?.forEach(c | if(c.readOnly)result.add(c.attribute)) + + return result + } + + override getDynConfigWriteAttributes(ActorInstance ai) { + val result = new ArrayList<Attribute> + var configs = DataConfigurationHelper::dynActorInstanceAttrMap.get(ai.path) + configs?.forEach(c | if(!c.readOnly)result.add(c.attribute)) + + return result + } + + + override hasVariableService(SubSystemInstance subsystem) { + subsystem.config?.dynConfig != null + } + + def private toStringExpr(LiteralArray literal){ + '''«FOR l : literal.literals SEPARATOR ','»«l.toStringExpr»«ENDFOR»'''.toString + } + + def private toStringExpr(Literal literal){ + switch(literal){ + BooleanLiteral: literal.isTrue.toString + IntLiteral: literal.value.toString + RealLiteral: literal.value.toString + StringLiteral: literal.value.toString + } + } + + def private getConfig(SubSystemInstance cc){ + DataConfigurationHelper::subSystemConfigMap.get(cc.path) + } + + override getDynConfigReadAttributes(ActorClass actor) { + val result = new ArrayList<Attribute> + var configs = DataConfigurationHelper::dynActorClassAttrMap.get(actor) + configs?.forEach(c | if(c.readOnly)result.add(c.attribute)) + return result + } + + override getDynConfigWriteAttributes(ActorClass actor) { + val result = new ArrayList<Attribute> + var configs = DataConfigurationHelper::dynActorClassAttrMap.get(actor) + configs?.forEach(c | if(!c.readOnly)result.add(c.attribute)) + return result + } + + override void addReferencedModels(IResourceURIAcceptor acceptor, EObject root) { + if (root instanceof ConfigModel) { + for (imp : (root as ConfigModel).imports) { + val importURI = uriResolver.resolve(imp) + acceptor.addResourceURI(importURI); + } + } + } + +} diff --git a/plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/util/DataConfigurationHelper.java b/plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/util/DataConfigurationHelper.java index eddcee088..2364a4bf0 100644 --- a/plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/util/DataConfigurationHelper.java +++ b/plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/util/DataConfigurationHelper.java @@ -1,200 +1,200 @@ -/*******************************************************************************
- * Copyright (c) 2012 Juergen Haug
- * 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:
- * Juergen Haug
- *
- *******************************************************************************/
-package org.eclipse.etrice.generator.config.util;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.etrice.core.config.ActorClassConfig;
-import org.eclipse.etrice.core.config.ActorInstanceConfig;
-import org.eclipse.etrice.core.config.AttrClassConfig;
-import org.eclipse.etrice.core.config.AttrInstanceConfig;
-import org.eclipse.etrice.core.config.ConfigModel;
-import org.eclipse.etrice.core.config.PortInstanceConfig;
-import org.eclipse.etrice.core.config.ProtocolClassConfig;
-import org.eclipse.etrice.core.config.SubSystemConfig;
-import org.eclipse.etrice.core.config.util.ConfigUtil;
-import org.eclipse.etrice.core.genmodel.base.ILogger;
-import org.eclipse.etrice.core.room.ActorClass;
-import org.eclipse.etrice.core.room.Attribute;
-import org.eclipse.etrice.core.room.DataClass;
-import org.eclipse.etrice.core.room.ProtocolClass;
-
-public class DataConfigurationHelper {
-
- // static
- public static Map<String, AttrClassConfig> actorClassAttrMap = new HashMap<String, AttrClassConfig>();
- public static Map<String, AttrClassConfig> protocolClassAttrMap = new HashMap<String, AttrClassConfig>();
- public static Map<String, AttrInstanceConfig> actorInstanceAttrMap = new HashMap<String, AttrInstanceConfig>();
-
- // dynamic
- public static Map<String, SubSystemConfig> subSystemConfigMap = new HashMap<String, SubSystemConfig>();
- public static Map<String, List<AttrInstanceConfig>> dynActorInstanceAttrMap = new HashMap<String, List<AttrInstanceConfig>>();
- public static Map<ActorClass, List<AttrInstanceConfig>> dynActorClassAttrMap = new HashMap<ActorClass, List<AttrInstanceConfig>>();
-
- public static boolean setConfigModels(ResourceSet rs, ILogger logger) {
- actorClassAttrMap.clear();
- protocolClassAttrMap.clear();
- actorInstanceAttrMap.clear();
- subSystemConfigMap.clear();
- dynActorInstanceAttrMap.clear();
- dynActorClassAttrMap.clear();
-
- boolean error = false;
-
- List<ConfigModel> configs = new ArrayList<ConfigModel>();
- for (Resource res : rs.getResources()) {
- EObject object = res.getContents().get(0);
- if (object instanceof ConfigModel)
- configs.add((ConfigModel) object);
- }
-
- if (!configs.isEmpty())
- logger.logInfo("-- loading configurations");
-
- Set<ActorClass> actorClasses = new HashSet<ActorClass>();
- Set<ProtocolClass> protocolClasses = new HashSet<ProtocolClass>();
- Set<String> actorInstances = new HashSet<String>();
- for (ConfigModel config : configs) {
- for (ActorClassConfig classConfig : config.getActorClassConfigs()) {
- if (actorClasses.contains(classConfig.getActor())) {
- logger.logError("Multiple configurations for actor class "
- + classConfig.getActor().getName() + " found", null);
- error = true;
- } else {
- actorClasses.add(classConfig.getActor());
- collectConfigs(classConfig, actorClassAttrMap);
- }
- }
- for (ProtocolClassConfig protocolConfig : config
- .getProtocolClassConfigs()) {
- if (protocolClasses.contains(protocolConfig.getProtocol())) {
- logger.logError(
- "Multiple configurations for protocol class "
- + protocolConfig.getProtocol().getName()
- + " found", null);
- error = true;
- } else {
- protocolClasses.add(protocolConfig.getProtocol());
- collectConfigs(protocolConfig, protocolClassAttrMap);
- }
- }
- for (ActorInstanceConfig instanceConfig : config
- .getActorInstanceConfigs()) {
- String path = ConfigUtil.getPath(instanceConfig);
- if (actorInstances.contains(path)) {
- logger.logError(
- "Multiple configurations for actor instance "
- + path + " found", null);
- } else {
- actorInstances.add(path);
- collectConfigs(instanceConfig, path, actorInstanceAttrMap);
- }
- }
- for (SubSystemConfig ssConfig : config.getSubSystemConfigs()) {
- String path = ConfigUtil.getPath(ssConfig);
- if (subSystemConfigMap.containsKey(path)) {
- logger.logError("Multiple configurations for subSystem"
- + path + " found", null);
- error = true;
- } else
- subSystemConfigMap.put(path, ssConfig);
- }
- }
-
- return !error;
- }
-
- private static void collectConfigs(ActorInstanceConfig actorConfig,
- String path, Map<String, AttrInstanceConfig> map) {
- for (AttrInstanceConfig c : actorConfig.getAttributes()) {
- collectConfigs(c, path + "/" + c.getAttribute().getName(), map);
-
- if (c.isDynConfig()) {
- List<AttrInstanceConfig> list = dynActorInstanceAttrMap
- .get(path);
- if (list == null)
- list = new ArrayList<AttrInstanceConfig>();
- list.add(c);
- dynActorInstanceAttrMap.put(path, list);
-
- ActorClass ac = ConfigUtil.getLastActorRef(
- actorConfig.getSubSystem().getType(),
- actorConfig.getPath()).getType();
- if ((list = dynActorClassAttrMap.get(ac)) == null)
- list = new ArrayList<AttrInstanceConfig>();
- list.add(c);
- dynActorClassAttrMap.put(ac, list);
- }
- }
- for (PortInstanceConfig c : actorConfig.getPorts()) {
- for (AttrInstanceConfig a : c.getAttributes())
- collectConfigs(a, path + "/" + c.getItem().getName() + "/"
- + a.getAttribute().getName(), map);
- }
- }
-
- private static void collectConfigs(ProtocolClassConfig protocolConfig,
- Map<String, AttrClassConfig> map) {
- String path = "/" + protocolConfig.getProtocol().getName();
- if (protocolConfig.getRegular() != null)
- for (AttrClassConfig c : protocolConfig.getRegular()
- .getAttributes())
- collectConfigs(c, path + "/regular/"
- + c.getAttribute().getName(), map);
- if (protocolConfig.getConjugated() != null)
- for (AttrClassConfig c : protocolConfig.getConjugated()
- .getAttributes())
- collectConfigs(c, path + "/conjugated/"
- + c.getAttribute().getName(), map);
- }
-
- private static void collectConfigs(ActorClassConfig actorConfig,
- Map<String, AttrClassConfig> map) {
- String path = "/" + actorConfig.getActor().getName();
- for (AttrClassConfig c : actorConfig.getAttributes())
- collectConfigs(c, path + "/" + c.getAttribute().getName(), map);
- }
-
- private static void collectConfigs(AttrClassConfig config, String path,
- Map<String, AttrClassConfig> map) {
- Attribute a = config.getAttribute();
- if (a.getRefType().getType() instanceof DataClass)
- for (AttrClassConfig c : config.getAttributes())
- collectConfigs(c, path + "/" + c.getAttribute().getName(), map);
- map.put(path, config);
- }
-
- private static void collectConfigs(AttrInstanceConfig config, String path,
- Map<String, AttrInstanceConfig> map) {
- Attribute a = config.getAttribute();
- if (a.getRefType().getType() instanceof DataClass)
- for (AttrInstanceConfig c : config.getAttributes())
- collectConfigs(c, path + "/" + c.getAttribute().getName(), map);
- map.put(path, config);
- }
-
- public static String toStringPath(Iterable<String> path, String pathDelim) {
- StringBuilder b = new StringBuilder();
- for (String p : path)
- b.append(pathDelim + p);
-
- return b.toString();
- }
-}
+/******************************************************************************* + * Copyright (c) 2012 Juergen Haug + * 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: + * Juergen Haug + * + *******************************************************************************/ +package org.eclipse.etrice.generator.config.util; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.etrice.core.config.ActorClassConfig; +import org.eclipse.etrice.core.config.ActorInstanceConfig; +import org.eclipse.etrice.core.config.AttrClassConfig; +import org.eclipse.etrice.core.config.AttrInstanceConfig; +import org.eclipse.etrice.core.config.ConfigModel; +import org.eclipse.etrice.core.config.PortInstanceConfig; +import org.eclipse.etrice.core.config.ProtocolClassConfig; +import org.eclipse.etrice.core.config.SubSystemConfig; +import org.eclipse.etrice.core.config.util.ConfigUtil; +import org.eclipse.etrice.core.genmodel.base.ILogger; +import org.eclipse.etrice.core.room.ActorClass; +import org.eclipse.etrice.core.room.Attribute; +import org.eclipse.etrice.core.room.DataClass; +import org.eclipse.etrice.core.room.ProtocolClass; + +public class DataConfigurationHelper { + + // static + public static Map<String, AttrClassConfig> actorClassAttrMap = new HashMap<String, AttrClassConfig>(); + public static Map<String, AttrClassConfig> protocolClassAttrMap = new HashMap<String, AttrClassConfig>(); + public static Map<String, AttrInstanceConfig> actorInstanceAttrMap = new HashMap<String, AttrInstanceConfig>(); + + // dynamic + public static Map<String, SubSystemConfig> subSystemConfigMap = new HashMap<String, SubSystemConfig>(); + public static Map<String, List<AttrInstanceConfig>> dynActorInstanceAttrMap = new HashMap<String, List<AttrInstanceConfig>>(); + public static Map<ActorClass, List<AttrInstanceConfig>> dynActorClassAttrMap = new HashMap<ActorClass, List<AttrInstanceConfig>>(); + + public static boolean setConfigModels(ResourceSet rs, ILogger logger) { + actorClassAttrMap.clear(); + protocolClassAttrMap.clear(); + actorInstanceAttrMap.clear(); + subSystemConfigMap.clear(); + dynActorInstanceAttrMap.clear(); + dynActorClassAttrMap.clear(); + + boolean error = false; + + List<ConfigModel> configs = new ArrayList<ConfigModel>(); + for (Resource res : rs.getResources()) { + EObject object = res.getContents().get(0); + if (object instanceof ConfigModel) + configs.add((ConfigModel) object); + } + + if (!configs.isEmpty()) + logger.logInfo("-- loading configurations"); + + Set<ActorClass> actorClasses = new HashSet<ActorClass>(); + Set<ProtocolClass> protocolClasses = new HashSet<ProtocolClass>(); + Set<String> actorInstances = new HashSet<String>(); + for (ConfigModel config : configs) { + for (ActorClassConfig classConfig : config.getActorClassConfigs()) { + if (actorClasses.contains(classConfig.getActor())) { + logger.logError("Multiple configurations for actor class " + + classConfig.getActor().getName() + " found", null); + error = true; + } else { + actorClasses.add(classConfig.getActor()); + collectConfigs(classConfig, actorClassAttrMap); + } + } + for (ProtocolClassConfig protocolConfig : config + .getProtocolClassConfigs()) { + if (protocolClasses.contains(protocolConfig.getProtocol())) { + logger.logError( + "Multiple configurations for protocol class " + + protocolConfig.getProtocol().getName() + + " found", null); + error = true; + } else { + protocolClasses.add(protocolConfig.getProtocol()); + collectConfigs(protocolConfig, protocolClassAttrMap); + } + } + for (ActorInstanceConfig instanceConfig : config + .getActorInstanceConfigs()) { + String path = ConfigUtil.getPath(instanceConfig); + if (actorInstances.contains(path)) { + logger.logError( + "Multiple configurations for actor instance " + + path + " found", null); + } else { + actorInstances.add(path); + collectConfigs(instanceConfig, path, actorInstanceAttrMap); + } + } + for (SubSystemConfig ssConfig : config.getSubSystemConfigs()) { + String path = ConfigUtil.getPath(ssConfig); + if (subSystemConfigMap.containsKey(path)) { + logger.logError("Multiple configurations for subSystem" + + path + " found", null); + error = true; + } else + subSystemConfigMap.put(path, ssConfig); + } + } + + return !error; + } + + private static void collectConfigs(ActorInstanceConfig actorConfig, + String path, Map<String, AttrInstanceConfig> map) { + for (AttrInstanceConfig c : actorConfig.getAttributes()) { + collectConfigs(c, path + "/" + c.getAttribute().getName(), map); + + if (c.isDynConfig()) { + List<AttrInstanceConfig> list = dynActorInstanceAttrMap + .get(path); + if (list == null) + list = new ArrayList<AttrInstanceConfig>(); + list.add(c); + dynActorInstanceAttrMap.put(path, list); + + ActorClass ac = ConfigUtil.getLastActorRef( + actorConfig.getSubSystem().getType(), + actorConfig.getPath()).getType(); + if ((list = dynActorClassAttrMap.get(ac)) == null) + list = new ArrayList<AttrInstanceConfig>(); + list.add(c); + dynActorClassAttrMap.put(ac, list); + } + } + for (PortInstanceConfig c : actorConfig.getPorts()) { + for (AttrInstanceConfig a : c.getAttributes()) + collectConfigs(a, path + "/" + c.getItem().getName() + "/" + + a.getAttribute().getName(), map); + } + } + + private static void collectConfigs(ProtocolClassConfig protocolConfig, + Map<String, AttrClassConfig> map) { + String path = "/" + protocolConfig.getProtocol().getName(); + if (protocolConfig.getRegular() != null) + for (AttrClassConfig c : protocolConfig.getRegular() + .getAttributes()) + collectConfigs(c, path + "/regular/" + + c.getAttribute().getName(), map); + if (protocolConfig.getConjugated() != null) + for (AttrClassConfig c : protocolConfig.getConjugated() + .getAttributes()) + collectConfigs(c, path + "/conjugated/" + + c.getAttribute().getName(), map); + } + + private static void collectConfigs(ActorClassConfig actorConfig, + Map<String, AttrClassConfig> map) { + String path = "/" + actorConfig.getActor().getName(); + for (AttrClassConfig c : actorConfig.getAttributes()) + collectConfigs(c, path + "/" + c.getAttribute().getName(), map); + } + + private static void collectConfigs(AttrClassConfig config, String path, + Map<String, AttrClassConfig> map) { + Attribute a = config.getAttribute(); + if (a.getRefType().getType() instanceof DataClass) + for (AttrClassConfig c : config.getAttributes()) + collectConfigs(c, path + "/" + c.getAttribute().getName(), map); + map.put(path, config); + } + + private static void collectConfigs(AttrInstanceConfig config, String path, + Map<String, AttrInstanceConfig> map) { + Attribute a = config.getAttribute(); + if (a.getRefType().getType() instanceof DataClass) + for (AttrInstanceConfig c : config.getAttributes()) + collectConfigs(c, path + "/" + c.getAttribute().getName(), map); + map.put(path, config); + } + + public static String toStringPath(Iterable<String> path, String pathDelim) { + StringBuilder b = new StringBuilder(); + for (String p : path) + b.append(pathDelim + p); + + return b.toString(); + } +} diff --git a/plugins/org.eclipse.etrice.generator.config/xtend-gen/org/eclipse/etrice/generator/config/DataConfiguration.java b/plugins/org.eclipse.etrice.generator.config/xtend-gen/org/eclipse/etrice/generator/config/DataConfiguration.java index ca5d0ab39..350861fe3 100644 --- a/plugins/org.eclipse.etrice.generator.config/xtend-gen/org/eclipse/etrice/generator/config/DataConfiguration.java +++ b/plugins/org.eclipse.etrice.generator.config/xtend-gen/org/eclipse/etrice/generator/config/DataConfiguration.java @@ -1,460 +1,460 @@ -/**
- * Copyright (c) 2012 Juergen Haug
- * 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:
- * Juergen Haug
- */
-package org.eclipse.etrice.generator.config;
-
-import com.google.common.base.Objects;
-import com.google.inject.Inject;
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.emf.common.EMFPlugin;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.etrice.core.ConfigStandaloneSetup;
-import org.eclipse.etrice.core.config.AttrClassConfig;
-import org.eclipse.etrice.core.config.AttrInstanceConfig;
-import org.eclipse.etrice.core.config.BooleanLiteral;
-import org.eclipse.etrice.core.config.ConfigModel;
-import org.eclipse.etrice.core.config.DynamicConfig;
-import org.eclipse.etrice.core.config.Import;
-import org.eclipse.etrice.core.config.IntLiteral;
-import org.eclipse.etrice.core.config.Literal;
-import org.eclipse.etrice.core.config.LiteralArray;
-import org.eclipse.etrice.core.config.NumberLiteral;
-import org.eclipse.etrice.core.config.RealLiteral;
-import org.eclipse.etrice.core.config.StringLiteral;
-import org.eclipse.etrice.core.config.SubSystemConfig;
-import org.eclipse.etrice.core.genmodel.base.ILogger;
-import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance;
-import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance;
-import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance;
-import org.eclipse.etrice.core.room.ActorClass;
-import org.eclipse.etrice.core.room.Attribute;
-import org.eclipse.etrice.core.room.ProtocolClass;
-import org.eclipse.etrice.generator.base.IDataConfiguration;
-import org.eclipse.etrice.generator.base.IResourceURIAcceptor;
-import org.eclipse.etrice.generator.config.util.DataConfigurationHelper;
-import org.eclipse.xtend2.lib.StringConcatenation;
-import org.eclipse.xtext.scoping.impl.ImportUriResolver;
-import org.eclipse.xtext.xbase.lib.IterableExtensions;
-import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
-
-@SuppressWarnings("all")
-public class DataConfiguration implements IDataConfiguration {
- @Inject
- protected ILogger logger;
-
- @Inject
- protected ImportUriResolver uriResolver;
-
- public void doSetup() {
- boolean _not = (!EMFPlugin.IS_ECLIPSE_RUNNING);
- if (_not) {
- ConfigStandaloneSetup.doSetup();
- }
- }
-
- public boolean setResources(final ResourceSet resource, final ILogger logger) {
- boolean _setConfigModels = DataConfigurationHelper.setConfigModels(resource, logger);
- return _setConfigModels;
- }
-
- public String getAttrClassConfigValue(final ActorClass actor, final List<Attribute> path) {
- String _stringExpr = null;
- AttrClassConfig _attrClassConfig = this.getAttrClassConfig(actor, path);
- LiteralArray _value = null;
- if (_attrClassConfig!=null) {
- _value=_attrClassConfig.getValue();
- }
- if (_value!=null) {
- _stringExpr=this.toStringExpr(_value);
- }
- return _stringExpr;
- }
-
- public String getAttrClassConfigMaxValue(final ActorClass actor, final List<Attribute> path) {
- String _stringExpr = null;
- AttrClassConfig _attrClassConfig = this.getAttrClassConfig(actor, path);
- NumberLiteral _max = null;
- if (_attrClassConfig!=null) {
- _max=_attrClassConfig.getMax();
- }
- if (_max!=null) {
- _stringExpr=this.toStringExpr(_max);
- }
- return _stringExpr;
- }
-
- public String getAttrClassConfigMinValue(final ActorClass actor, final List<Attribute> path) {
- String _stringExpr = null;
- AttrClassConfig _attrClassConfig = this.getAttrClassConfig(actor, path);
- NumberLiteral _min = null;
- if (_attrClassConfig!=null) {
- _min=_attrClassConfig.getMin();
- }
- if (_min!=null) {
- _stringExpr=this.toStringExpr(_min);
- }
- return _stringExpr;
- }
-
- private AttrClassConfig getAttrClassConfig(final ActorClass actor, final List<Attribute> path) {
- AttrClassConfig _xblockexpression = null;
- {
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("/");
- String _name = actor.getName();
- _builder.append(_name, "");
- _builder.append("/");
- String _stringPath = this.toStringPath(path);
- _builder.append(_stringPath, "");
- String id = _builder.toString();
- AttrClassConfig _get = DataConfigurationHelper.actorClassAttrMap.get(id);
- _xblockexpression = (_get);
- }
- return _xblockexpression;
- }
-
- public String getAttrClassConfigValue(final ProtocolClass pc, final boolean regular, final List<Attribute> path) {
- String _xblockexpression = null;
- {
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("/");
- String _name = pc.getName();
- _builder.append(_name, "");
- _builder.append("/");
- {
- if (regular) {
- _builder.append("regular");
- } else {
- _builder.append("conjugated");
- }
- }
- _builder.append("/");
- String _stringPath = this.toStringPath(path);
- _builder.append(_stringPath, "");
- String id = _builder.toString();
- String _stringExpr = null;
- AttrClassConfig _get = DataConfigurationHelper.protocolClassAttrMap.get(id);
- LiteralArray _value = null;
- if (_get!=null) {
- _value=_get.getValue();
- }
- if (_value!=null) {
- _stringExpr=this.toStringExpr(_value);
- }
- _xblockexpression = (_stringExpr);
- }
- return _xblockexpression;
- }
-
- private String toStringPath(final List<Attribute> path) {
- StringConcatenation _builder = new StringConcatenation();
- {
- boolean _hasElements = false;
- for(final Attribute a : path) {
- if (!_hasElements) {
- _hasElements = true;
- } else {
- _builder.appendImmediate("/", "");
- }
- String _name = a.getName();
- _builder.append(_name, "");
- }
- }
- String _string = _builder.toString();
- return _string;
- }
-
- public String getAttrInstanceConfigValue(final ActorInstance ai, final List<Attribute> path) {
- String _xblockexpression = null;
- {
- String _path = ai.getPath();
- String _plus = (_path + "/");
- String _stringPath = this.toStringPath(path);
- String id = (_plus + _stringPath);
- String _stringExpr = null;
- AttrInstanceConfig _get = DataConfigurationHelper.actorInstanceAttrMap.get(id);
- LiteralArray _value = null;
- if (_get!=null) {
- _value=_get.getValue();
- }
- if (_value!=null) {
- _stringExpr=this.toStringExpr(_value);
- }
- _xblockexpression = (_stringExpr);
- }
- return _xblockexpression;
- }
-
- public String getAttrInstanceConfigValue(final InterfaceItemInstance item, final List<Attribute> path) {
- String _stringExpr = null;
- String _path = item.getPath();
- String _plus = (_path + "/");
- String _stringPath = this.toStringPath(path);
- String _plus_1 = (_plus + _stringPath);
- AttrInstanceConfig _get = DataConfigurationHelper.actorInstanceAttrMap.get(_plus_1);
- LiteralArray _value = null;
- if (_get!=null) {
- _value=_get.getValue();
- }
- if (_value!=null) {
- _stringExpr=this.toStringExpr(_value);
- }
- return _stringExpr;
- }
-
- public int getPollingTimerUser(final SubSystemInstance subsystem) {
- int _xblockexpression = (int) 0;
- {
- SubSystemConfig _config = this.getConfig(subsystem);
- DynamicConfig _dynConfig = null;
- if (_config!=null) {
- _dynConfig=_config.getDynConfig();
- }
- final DynamicConfig dynConf = _dynConfig;
- int _xifexpression = (int) 0;
- boolean _equals = Objects.equal(dynConf, null);
- if (_equals) {
- _xifexpression = 0;
- } else {
- int _polling = dynConf.getPolling();
- _xifexpression = _polling;
- }
- _xblockexpression = (_xifexpression);
- }
- return _xblockexpression;
- }
-
- public String getUserCode1(final SubSystemInstance subsystem) {
- SubSystemConfig _config = this.getConfig(subsystem);
- DynamicConfig _dynConfig = null;
- if (_config!=null) {
- _dynConfig=_config.getDynConfig();
- }
- DynamicConfig dynConfig = _dynConfig;
- String _xifexpression = null;
- String _filePath = null;
- if (dynConfig!=null) {
- _filePath=dynConfig.getFilePath();
- }
- boolean _notEquals = (!Objects.equal(_filePath, null));
- if (_notEquals) {
- _xifexpression = "import org.eclipse.etrice.runtime.java.config.ConfigSourceFile;";
- } else {
- String _userCode1 = null;
- if (dynConfig!=null) {
- _userCode1=dynConfig.getUserCode1();
- }
- _xifexpression = _userCode1;
- }
- return _xifexpression;
- }
-
- public String getUserCode2(final SubSystemInstance subsystem) {
- SubSystemConfig _config = this.getConfig(subsystem);
- DynamicConfig _dynConfig = null;
- if (_config!=null) {
- _dynConfig=_config.getDynConfig();
- }
- DynamicConfig dynConfig = _dynConfig;
- String _xifexpression = null;
- String _filePath = null;
- if (dynConfig!=null) {
- _filePath=dynConfig.getFilePath();
- }
- boolean _notEquals = (!Objects.equal(_filePath, null));
- if (_notEquals) {
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("new ConfigSourceFile(\"");
- String _filePath_1 = dynConfig.getFilePath();
- _builder.append(_filePath_1, "");
- _builder.append("\")");
- _xifexpression = _builder.toString();
- } else {
- String _userCode2 = null;
- if (dynConfig!=null) {
- _userCode2=dynConfig.getUserCode2();
- }
- _xifexpression = _userCode2;
- }
- return _xifexpression;
- }
-
- public List<Attribute> getDynConfigReadAttributes(final ActorInstance ai) {
- ArrayList<Attribute> _arrayList = new ArrayList<Attribute>();
- final ArrayList<Attribute> result = _arrayList;
- String _path = ai.getPath();
- List<AttrInstanceConfig> configs = DataConfigurationHelper.dynActorInstanceAttrMap.get(_path);
- if (configs!=null) {
- final Procedure1<AttrInstanceConfig> _function = new Procedure1<AttrInstanceConfig>() {
- public void apply(final AttrInstanceConfig c) {
- boolean _isReadOnly = c.isReadOnly();
- if (_isReadOnly) {
- Attribute _attribute = c.getAttribute();
- result.add(_attribute);
- }
- }
- };
- IterableExtensions.<AttrInstanceConfig>forEach(configs, _function);
- }
- return result;
- }
-
- public List<Attribute> getDynConfigWriteAttributes(final ActorInstance ai) {
- ArrayList<Attribute> _arrayList = new ArrayList<Attribute>();
- final ArrayList<Attribute> result = _arrayList;
- String _path = ai.getPath();
- List<AttrInstanceConfig> configs = DataConfigurationHelper.dynActorInstanceAttrMap.get(_path);
- if (configs!=null) {
- final Procedure1<AttrInstanceConfig> _function = new Procedure1<AttrInstanceConfig>() {
- public void apply(final AttrInstanceConfig c) {
- boolean _isReadOnly = c.isReadOnly();
- boolean _not = (!_isReadOnly);
- if (_not) {
- Attribute _attribute = c.getAttribute();
- result.add(_attribute);
- }
- }
- };
- IterableExtensions.<AttrInstanceConfig>forEach(configs, _function);
- }
- return result;
- }
-
- public boolean hasVariableService(final SubSystemInstance subsystem) {
- SubSystemConfig _config = this.getConfig(subsystem);
- DynamicConfig _dynConfig = null;
- if (_config!=null) {
- _dynConfig=_config.getDynConfig();
- }
- boolean _notEquals = (!Objects.equal(_dynConfig, null));
- return _notEquals;
- }
-
- private String toStringExpr(final LiteralArray literal) {
- StringConcatenation _builder = new StringConcatenation();
- {
- EList<Literal> _literals = literal.getLiterals();
- boolean _hasElements = false;
- for(final Literal l : _literals) {
- if (!_hasElements) {
- _hasElements = true;
- } else {
- _builder.appendImmediate(",", "");
- }
- String _stringExpr = this.toStringExpr(l);
- _builder.append(_stringExpr, "");
- }
- }
- String _string = _builder.toString();
- return _string;
- }
-
- private String toStringExpr(final Literal literal) {
- String _switchResult = null;
- boolean _matched = false;
- if (!_matched) {
- if (literal instanceof BooleanLiteral) {
- final BooleanLiteral _booleanLiteral = (BooleanLiteral)literal;
- _matched=true;
- boolean _isIsTrue = _booleanLiteral.isIsTrue();
- String _string = Boolean.valueOf(_isIsTrue).toString();
- _switchResult = _string;
- }
- }
- if (!_matched) {
- if (literal instanceof IntLiteral) {
- final IntLiteral _intLiteral = (IntLiteral)literal;
- _matched=true;
- long _value = _intLiteral.getValue();
- String _string = Long.valueOf(_value).toString();
- _switchResult = _string;
- }
- }
- if (!_matched) {
- if (literal instanceof RealLiteral) {
- final RealLiteral _realLiteral = (RealLiteral)literal;
- _matched=true;
- double _value = _realLiteral.getValue();
- String _string = Double.valueOf(_value).toString();
- _switchResult = _string;
- }
- }
- if (!_matched) {
- if (literal instanceof StringLiteral) {
- final StringLiteral _stringLiteral = (StringLiteral)literal;
- _matched=true;
- String _value = _stringLiteral.getValue();
- String _string = _value.toString();
- _switchResult = _string;
- }
- }
- return _switchResult;
- }
-
- private SubSystemConfig getConfig(final SubSystemInstance cc) {
- String _path = cc.getPath();
- SubSystemConfig _get = DataConfigurationHelper.subSystemConfigMap.get(_path);
- return _get;
- }
-
- public List<Attribute> getDynConfigReadAttributes(final ActorClass actor) {
- ArrayList<Attribute> _arrayList = new ArrayList<Attribute>();
- final ArrayList<Attribute> result = _arrayList;
- List<AttrInstanceConfig> configs = DataConfigurationHelper.dynActorClassAttrMap.get(actor);
- if (configs!=null) {
- final Procedure1<AttrInstanceConfig> _function = new Procedure1<AttrInstanceConfig>() {
- public void apply(final AttrInstanceConfig c) {
- boolean _isReadOnly = c.isReadOnly();
- if (_isReadOnly) {
- Attribute _attribute = c.getAttribute();
- result.add(_attribute);
- }
- }
- };
- IterableExtensions.<AttrInstanceConfig>forEach(configs, _function);
- }
- return result;
- }
-
- public List<Attribute> getDynConfigWriteAttributes(final ActorClass actor) {
- ArrayList<Attribute> _arrayList = new ArrayList<Attribute>();
- final ArrayList<Attribute> result = _arrayList;
- List<AttrInstanceConfig> configs = DataConfigurationHelper.dynActorClassAttrMap.get(actor);
- if (configs!=null) {
- final Procedure1<AttrInstanceConfig> _function = new Procedure1<AttrInstanceConfig>() {
- public void apply(final AttrInstanceConfig c) {
- boolean _isReadOnly = c.isReadOnly();
- boolean _not = (!_isReadOnly);
- if (_not) {
- Attribute _attribute = c.getAttribute();
- result.add(_attribute);
- }
- }
- };
- IterableExtensions.<AttrInstanceConfig>forEach(configs, _function);
- }
- return result;
- }
-
- public void addReferencedModels(final IResourceURIAcceptor acceptor, final EObject root) {
- if ((root instanceof ConfigModel)) {
- EList<Import> _imports = ((ConfigModel) root).getImports();
- for (final Import imp : _imports) {
- {
- final String importURI = this.uriResolver.resolve(imp);
- acceptor.addResourceURI(importURI);
- }
- }
- }
- }
-}
+/** + * Copyright (c) 2012 Juergen Haug + * 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: + * Juergen Haug + */ +package org.eclipse.etrice.generator.config; + +import com.google.common.base.Objects; +import com.google.inject.Inject; +import java.util.ArrayList; +import java.util.List; +import org.eclipse.emf.common.EMFPlugin; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.etrice.core.ConfigStandaloneSetup; +import org.eclipse.etrice.core.config.AttrClassConfig; +import org.eclipse.etrice.core.config.AttrInstanceConfig; +import org.eclipse.etrice.core.config.BooleanLiteral; +import org.eclipse.etrice.core.config.ConfigModel; +import org.eclipse.etrice.core.config.DynamicConfig; +import org.eclipse.etrice.core.config.Import; +import org.eclipse.etrice.core.config.IntLiteral; +import org.eclipse.etrice.core.config.Literal; +import org.eclipse.etrice.core.config.LiteralArray; +import org.eclipse.etrice.core.config.NumberLiteral; +import org.eclipse.etrice.core.config.RealLiteral; +import org.eclipse.etrice.core.config.StringLiteral; +import org.eclipse.etrice.core.config.SubSystemConfig; +import org.eclipse.etrice.core.genmodel.base.ILogger; +import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance; +import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance; +import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance; +import org.eclipse.etrice.core.room.ActorClass; +import org.eclipse.etrice.core.room.Attribute; +import org.eclipse.etrice.core.room.ProtocolClass; +import org.eclipse.etrice.generator.base.IDataConfiguration; +import org.eclipse.etrice.generator.base.IResourceURIAcceptor; +import org.eclipse.etrice.generator.config.util.DataConfigurationHelper; +import org.eclipse.xtend2.lib.StringConcatenation; +import org.eclipse.xtext.scoping.impl.ImportUriResolver; +import org.eclipse.xtext.xbase.lib.IterableExtensions; +import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; + +@SuppressWarnings("all") +public class DataConfiguration implements IDataConfiguration { + @Inject + protected ILogger logger; + + @Inject + protected ImportUriResolver uriResolver; + + public void doSetup() { + boolean _not = (!EMFPlugin.IS_ECLIPSE_RUNNING); + if (_not) { + ConfigStandaloneSetup.doSetup(); + } + } + + public boolean setResources(final ResourceSet resource, final ILogger logger) { + boolean _setConfigModels = DataConfigurationHelper.setConfigModels(resource, logger); + return _setConfigModels; + } + + public String getAttrClassConfigValue(final ActorClass actor, final List<Attribute> path) { + String _stringExpr = null; + AttrClassConfig _attrClassConfig = this.getAttrClassConfig(actor, path); + LiteralArray _value = null; + if (_attrClassConfig!=null) { + _value=_attrClassConfig.getValue(); + } + if (_value!=null) { + _stringExpr=this.toStringExpr(_value); + } + return _stringExpr; + } + + public String getAttrClassConfigMaxValue(final ActorClass actor, final List<Attribute> path) { + String _stringExpr = null; + AttrClassConfig _attrClassConfig = this.getAttrClassConfig(actor, path); + NumberLiteral _max = null; + if (_attrClassConfig!=null) { + _max=_attrClassConfig.getMax(); + } + if (_max!=null) { + _stringExpr=this.toStringExpr(_max); + } + return _stringExpr; + } + + public String getAttrClassConfigMinValue(final ActorClass actor, final List<Attribute> path) { + String _stringExpr = null; + AttrClassConfig _attrClassConfig = this.getAttrClassConfig(actor, path); + NumberLiteral _min = null; + if (_attrClassConfig!=null) { + _min=_attrClassConfig.getMin(); + } + if (_min!=null) { + _stringExpr=this.toStringExpr(_min); + } + return _stringExpr; + } + + private AttrClassConfig getAttrClassConfig(final ActorClass actor, final List<Attribute> path) { + AttrClassConfig _xblockexpression = null; + { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("/"); + String _name = actor.getName(); + _builder.append(_name, ""); + _builder.append("/"); + String _stringPath = this.toStringPath(path); + _builder.append(_stringPath, ""); + String id = _builder.toString(); + AttrClassConfig _get = DataConfigurationHelper.actorClassAttrMap.get(id); + _xblockexpression = (_get); + } + return _xblockexpression; + } + + public String getAttrClassConfigValue(final ProtocolClass pc, final boolean regular, final List<Attribute> path) { + String _xblockexpression = null; + { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("/"); + String _name = pc.getName(); + _builder.append(_name, ""); + _builder.append("/"); + { + if (regular) { + _builder.append("regular"); + } else { + _builder.append("conjugated"); + } + } + _builder.append("/"); + String _stringPath = this.toStringPath(path); + _builder.append(_stringPath, ""); + String id = _builder.toString(); + String _stringExpr = null; + AttrClassConfig _get = DataConfigurationHelper.protocolClassAttrMap.get(id); + LiteralArray _value = null; + if (_get!=null) { + _value=_get.getValue(); + } + if (_value!=null) { + _stringExpr=this.toStringExpr(_value); + } + _xblockexpression = (_stringExpr); + } + return _xblockexpression; + } + + private String toStringPath(final List<Attribute> path) { + StringConcatenation _builder = new StringConcatenation(); + { + boolean _hasElements = false; + for(final Attribute a : path) { + if (!_hasElements) { + _hasElements = true; + } else { + _builder.appendImmediate("/", ""); + } + String _name = a.getName(); + _builder.append(_name, ""); + } + } + String _string = _builder.toString(); + return _string; + } + + public String getAttrInstanceConfigValue(final ActorInstance ai, final List<Attribute> path) { + String _xblockexpression = null; + { + String _path = ai.getPath(); + String _plus = (_path + "/"); + String _stringPath = this.toStringPath(path); + String id = (_plus + _stringPath); + String _stringExpr = null; + AttrInstanceConfig _get = DataConfigurationHelper.actorInstanceAttrMap.get(id); + LiteralArray _value = null; + if (_get!=null) { + _value=_get.getValue(); + } + if (_value!=null) { + _stringExpr=this.toStringExpr(_value); + } + _xblockexpression = (_stringExpr); + } + return _xblockexpression; + } + + public String getAttrInstanceConfigValue(final InterfaceItemInstance item, final List<Attribute> path) { + String _stringExpr = null; + String _path = item.getPath(); + String _plus = (_path + "/"); + String _stringPath = this.toStringPath(path); + String _plus_1 = (_plus + _stringPath); + AttrInstanceConfig _get = DataConfigurationHelper.actorInstanceAttrMap.get(_plus_1); + LiteralArray _value = null; + if (_get!=null) { + _value=_get.getValue(); + } + if (_value!=null) { + _stringExpr=this.toStringExpr(_value); + } + return _stringExpr; + } + + public int getPollingTimerUser(final SubSystemInstance subsystem) { + int _xblockexpression = (int) 0; + { + SubSystemConfig _config = this.getConfig(subsystem); + DynamicConfig _dynConfig = null; + if (_config!=null) { + _dynConfig=_config.getDynConfig(); + } + final DynamicConfig dynConf = _dynConfig; + int _xifexpression = (int) 0; + boolean _equals = Objects.equal(dynConf, null); + if (_equals) { + _xifexpression = 0; + } else { + int _polling = dynConf.getPolling(); + _xifexpression = _polling; + } + _xblockexpression = (_xifexpression); + } + return _xblockexpression; + } + + public String getUserCode1(final SubSystemInstance subsystem) { + SubSystemConfig _config = this.getConfig(subsystem); + DynamicConfig _dynConfig = null; + if (_config!=null) { + _dynConfig=_config.getDynConfig(); + } + DynamicConfig dynConfig = _dynConfig; + String _xifexpression = null; + String _filePath = null; + if (dynConfig!=null) { + _filePath=dynConfig.getFilePath(); + } + boolean _notEquals = (!Objects.equal(_filePath, null)); + if (_notEquals) { + _xifexpression = "import org.eclipse.etrice.runtime.java.config.ConfigSourceFile;"; + } else { + String _userCode1 = null; + if (dynConfig!=null) { + _userCode1=dynConfig.getUserCode1(); + } + _xifexpression = _userCode1; + } + return _xifexpression; + } + + public String getUserCode2(final SubSystemInstance subsystem) { + SubSystemConfig _config = this.getConfig(subsystem); + DynamicConfig _dynConfig = null; + if (_config!=null) { + _dynConfig=_config.getDynConfig(); + } + DynamicConfig dynConfig = _dynConfig; + String _xifexpression = null; + String _filePath = null; + if (dynConfig!=null) { + _filePath=dynConfig.getFilePath(); + } + boolean _notEquals = (!Objects.equal(_filePath, null)); + if (_notEquals) { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("new ConfigSourceFile(\""); + String _filePath_1 = dynConfig.getFilePath(); + _builder.append(_filePath_1, ""); + _builder.append("\")"); + _xifexpression = _builder.toString(); + } else { + String _userCode2 = null; + if (dynConfig!=null) { + _userCode2=dynConfig.getUserCode2(); + } + _xifexpression = _userCode2; + } + return _xifexpression; + } + + public List<Attribute> getDynConfigReadAttributes(final ActorInstance ai) { + ArrayList<Attribute> _arrayList = new ArrayList<Attribute>(); + final ArrayList<Attribute> result = _arrayList; + String _path = ai.getPath(); + List<AttrInstanceConfig> configs = DataConfigurationHelper.dynActorInstanceAttrMap.get(_path); + if (configs!=null) { + final Procedure1<AttrInstanceConfig> _function = new Procedure1<AttrInstanceConfig>() { + public void apply(final AttrInstanceConfig c) { + boolean _isReadOnly = c.isReadOnly(); + if (_isReadOnly) { + Attribute _attribute = c.getAttribute(); + result.add(_attribute); + } + } + }; + IterableExtensions.<AttrInstanceConfig>forEach(configs, _function); + } + return result; + } + + public List<Attribute> getDynConfigWriteAttributes(final ActorInstance ai) { + ArrayList<Attribute> _arrayList = new ArrayList<Attribute>(); + final ArrayList<Attribute> result = _arrayList; + String _path = ai.getPath(); + List<AttrInstanceConfig> configs = DataConfigurationHelper.dynActorInstanceAttrMap.get(_path); + if (configs!=null) { + final Procedure1<AttrInstanceConfig> _function = new Procedure1<AttrInstanceConfig>() { + public void apply(final AttrInstanceConfig c) { + boolean _isReadOnly = c.isReadOnly(); + boolean _not = (!_isReadOnly); + if (_not) { + Attribute _attribute = c.getAttribute(); + result.add(_attribute); + } + } + }; + IterableExtensions.<AttrInstanceConfig>forEach(configs, _function); + } + return result; + } + + public boolean hasVariableService(final SubSystemInstance subsystem) { + SubSystemConfig _config = this.getConfig(subsystem); + DynamicConfig _dynConfig = null; + if (_config!=null) { + _dynConfig=_config.getDynConfig(); + } + boolean _notEquals = (!Objects.equal(_dynConfig, null)); + return _notEquals; + } + + private String toStringExpr(final LiteralArray literal) { + StringConcatenation _builder = new StringConcatenation(); + { + EList<Literal> _literals = literal.getLiterals(); + boolean _hasElements = false; + for(final Literal l : _literals) { + if (!_hasElements) { + _hasElements = true; + } else { + _builder.appendImmediate(",", ""); + } + String _stringExpr = this.toStringExpr(l); + _builder.append(_stringExpr, ""); + } + } + String _string = _builder.toString(); + return _string; + } + + private String toStringExpr(final Literal literal) { + String _switchResult = null; + boolean _matched = false; + if (!_matched) { + if (literal instanceof BooleanLiteral) { + final BooleanLiteral _booleanLiteral = (BooleanLiteral)literal; + _matched=true; + boolean _isIsTrue = _booleanLiteral.isIsTrue(); + String _string = Boolean.valueOf(_isIsTrue).toString(); + _switchResult = _string; + } + } + if (!_matched) { + if (literal instanceof IntLiteral) { + final IntLiteral _intLiteral = (IntLiteral)literal; + _matched=true; + long _value = _intLiteral.getValue(); + String _string = Long.valueOf(_value).toString(); + _switchResult = _string; + } + } + if (!_matched) { + if (literal instanceof RealLiteral) { + final RealLiteral _realLiteral = (RealLiteral)literal; + _matched=true; + double _value = _realLiteral.getValue(); + String _string = Double.valueOf(_value).toString(); + _switchResult = _string; + } + } + if (!_matched) { + if (literal instanceof StringLiteral) { + final StringLiteral _stringLiteral = (StringLiteral)literal; + _matched=true; + String _value = _stringLiteral.getValue(); + String _string = _value.toString(); + _switchResult = _string; + } + } + return _switchResult; + } + + private SubSystemConfig getConfig(final SubSystemInstance cc) { + String _path = cc.getPath(); + SubSystemConfig _get = DataConfigurationHelper.subSystemConfigMap.get(_path); + return _get; + } + + public List<Attribute> getDynConfigReadAttributes(final ActorClass actor) { + ArrayList<Attribute> _arrayList = new ArrayList<Attribute>(); + final ArrayList<Attribute> result = _arrayList; + List<AttrInstanceConfig> configs = DataConfigurationHelper.dynActorClassAttrMap.get(actor); + if (configs!=null) { + final Procedure1<AttrInstanceConfig> _function = new Procedure1<AttrInstanceConfig>() { + public void apply(final AttrInstanceConfig c) { + boolean _isReadOnly = c.isReadOnly(); + if (_isReadOnly) { + Attribute _attribute = c.getAttribute(); + result.add(_attribute); + } + } + }; + IterableExtensions.<AttrInstanceConfig>forEach(configs, _function); + } + return result; + } + + public List<Attribute> getDynConfigWriteAttributes(final ActorClass actor) { + ArrayList<Attribute> _arrayList = new ArrayList<Attribute>(); + final ArrayList<Attribute> result = _arrayList; + List<AttrInstanceConfig> configs = DataConfigurationHelper.dynActorClassAttrMap.get(actor); + if (configs!=null) { + final Procedure1<AttrInstanceConfig> _function = new Procedure1<AttrInstanceConfig>() { + public void apply(final AttrInstanceConfig c) { + boolean _isReadOnly = c.isReadOnly(); + boolean _not = (!_isReadOnly); + if (_not) { + Attribute _attribute = c.getAttribute(); + result.add(_attribute); + } + } + }; + IterableExtensions.<AttrInstanceConfig>forEach(configs, _function); + } + return result; + } + + public void addReferencedModels(final IResourceURIAcceptor acceptor, final EObject root) { + if ((root instanceof ConfigModel)) { + EList<Import> _imports = ((ConfigModel) root).getImports(); + for (final Import imp : _imports) { + { + final String importURI = this.uriResolver.resolve(imp); + acceptor.addResourceURI(importURI); + } + } + } + } +} |