Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Haug2012-12-12 15:04:49 +0000
committerJuergen Haug2012-12-12 15:04:49 +0000
commit72802f3f5250f6632ed0a4e6dc3bedcb9c5ffee4 (patch)
tree82752da439d361c9701506d895362c4110b523d9 /plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice
parent13e48a31dba2985660abdbf3120ef2ca93557f69 (diff)
downloadorg.eclipse.etrice-72802f3f5250f6632ed0a4e6dc3bedcb9c5ffee4.tar.gz
org.eclipse.etrice-72802f3f5250f6632ed0a4e6dc3bedcb9c5ffee4.tar.xz
org.eclipse.etrice-72802f3f5250f6632ed0a4e6dc3bedcb9c5ffee4.zip
[config, generator, tests] static and dynamic config test + fixes
Diffstat (limited to 'plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice')
-rw-r--r--plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/DataConfiguration.xtend28
-rw-r--r--plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/util/DataConfigurationHelper.java26
2 files changed, 27 insertions, 27 deletions
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 d01676543..dafa4cea7 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
@@ -28,14 +28,14 @@ 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.core.room.SubSystemClass
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.xtext.scoping.impl.ImportUriResolver
class DataConfiguration implements IDataConfiguration {
@@ -60,11 +60,11 @@ class DataConfiguration implements IDataConfiguration {
}
override getAttrClassConfigMaxValue(ActorClass actor, List<Attribute> path) {
- actor.getAttrClassConfig(path)?.min?.toStringExpr
+ actor.getAttrClassConfig(path)?.max?.toStringExpr
}
override getAttrClassConfigMinValue(ActorClass actor, List<Attribute> path) {
- actor.getAttrClassConfig(path)?.max?.toStringExpr
+ actor.getAttrClassConfig(path)?.min?.toStringExpr
}
def private getAttrClassConfig(ActorClass actor, List<Attribute> path){
@@ -91,11 +91,11 @@ class DataConfiguration implements IDataConfiguration {
}
// dynamic
- override getPollingTimerUser(SubSystemClass subsystem) {
+ override getPollingTimerUser(SubSystemInstance subsystem) {
subsystem.config?.dynConfig?.polling
}
- override getUserCode1(SubSystemClass subsystem) {
+ override getUserCode1(SubSystemInstance subsystem) {
var dynConfig = subsystem.config?.dynConfig
return
if(dynConfig?.filePath != null)
@@ -104,7 +104,7 @@ class DataConfiguration implements IDataConfiguration {
dynConfig?.userCode1
}
- override getUserCode2(SubSystemClass subsystem) {
+ override getUserCode2(SubSystemInstance subsystem) {
var dynConfig = subsystem.config?.dynConfig
return
if(dynConfig?.filePath != null)
@@ -113,24 +113,24 @@ class DataConfiguration implements IDataConfiguration {
dynConfig?.userCode2
}
- override getDynConfigReadAttributes(String actorInstance) {
+ override getDynConfigReadAttributes(ActorInstance ai) {
val result = new ArrayList<Attribute>
- var configs = DataConfigurationHelper::dynActorInstanceAttrMap.get(actorInstance)
+ var configs = DataConfigurationHelper::dynActorInstanceAttrMap.get(ai.path)
configs?.forEach(c | if(c.readOnly)result.add(c.attribute))
return result
}
- override getDynConfigWriteAttributes(String actorInstance) {
+ override getDynConfigWriteAttributes(ActorInstance ai) {
val result = new ArrayList<Attribute>
- var configs = DataConfigurationHelper::dynActorInstanceAttrMap.get(actorInstance)
+ var configs = DataConfigurationHelper::dynActorInstanceAttrMap.get(ai.path)
configs?.forEach(c | if(!c.readOnly)result.add(c.attribute))
return result
}
- override hasVariableService(SubSystemClass subsystem) {
+ override hasVariableService(SubSystemInstance subsystem) {
subsystem.config?.dynConfig != null
}
@@ -147,8 +147,8 @@ class DataConfiguration implements IDataConfiguration {
}
}
- def private getConfig(SubSystemClass cc){
- DataConfigurationHelper::subSystemConfigMap.get(cc)
+ def private getConfig(SubSystemInstance cc){
+ DataConfigurationHelper::subSystemConfigMap.get(cc.path)
}
override getDynConfigReadAttributes(ActorClass actor) {
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 34486d689..eddcee088 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
@@ -35,7 +35,6 @@ 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;
-import org.eclipse.etrice.core.room.SubSystemClass;
public class DataConfigurationHelper {
@@ -45,7 +44,7 @@ public class DataConfigurationHelper {
public static Map<String, AttrInstanceConfig> actorInstanceAttrMap = new HashMap<String, AttrInstanceConfig>();
// dynamic
- public static Map<SubSystemClass, SubSystemConfig> subSystemConfigMap = new HashMap<SubSystemClass, SubSystemConfig>();
+ 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>>();
@@ -109,14 +108,13 @@ public class DataConfigurationHelper {
}
}
for (SubSystemConfig ssConfig : config.getSubSystemConfigs()) {
- if (subSystemConfigMap.containsKey(ssConfig.getSubSystem())) {
- logger.logError(
- "Multiple configurations for subSystem class "
- + ssConfig.getSubSystem().getName()
- + " found", null);
+ String path = ConfigUtil.getPath(ssConfig);
+ if (subSystemConfigMap.containsKey(path)) {
+ logger.logError("Multiple configurations for subSystem"
+ + path + " found", null);
error = true;
} else
- subSystemConfigMap.put(ssConfig.getSubSystem(), ssConfig);
+ subSystemConfigMap.put(path, ssConfig);
}
}
@@ -127,7 +125,7 @@ public class DataConfigurationHelper {
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);
@@ -137,16 +135,18 @@ public class DataConfigurationHelper {
dynActorInstanceAttrMap.put(path, list);
ActorClass ac = ConfigUtil.getLastActorRef(
- actorConfig.getSubSystem().getType(), actorConfig.getPath()).getType();
+ 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);
+ for (PortInstanceConfig c : actorConfig.getPorts()) {
+ for (AttrInstanceConfig a : c.getAttributes())
+ collectConfigs(a, path + "/" + c.getItem().getName() + "/"
+ + a.getAttribute().getName(), map);
}
}

Back to the top