Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.etrice.generator.config')
-rw-r--r--plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/DataConfiguration.xtend23
-rw-r--r--plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/util/DataConfigurationHelper.java33
-rw-r--r--plugins/org.eclipse.etrice.generator.config/xtend-gen/org/eclipse/etrice/generator/config/DataConfiguration.java25
3 files changed, 48 insertions, 33 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 b762b63b9..cd4e7a2aa 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
@@ -41,6 +41,9 @@ import org.eclipse.xtext.scoping.impl.ImportUriResolver
class DataConfiguration implements IDataConfiguration {
@Inject
+ protected extension DataConfigurationHelper
+
+ @Inject
protected ILogger logger;
@Inject
@@ -53,7 +56,7 @@ class DataConfiguration implements IDataConfiguration {
}
override setResources(ResourceSet resource, ILogger logger) {
- DataConfigurationHelper::setConfigModels(resource, logger)
+ setConfigModels(resource, logger)
}
// static
@@ -71,12 +74,12 @@ class DataConfiguration implements IDataConfiguration {
def private getAttrClassConfig(ActorClass actor, List<Attribute> path) {
var id = '''/«actor.name»/«path.toStringPath»'''.toString
- DataConfigurationHelper::actorClassAttrMap.get(id)
+ 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
+ protocolClassAttrMap.get(id)?.value?.toStringExpr
}
def private toStringPath(List<Attribute> path) {
@@ -85,11 +88,11 @@ class DataConfiguration implements IDataConfiguration {
override getAttrInstanceConfigValue(ActorInstance ai, List<Attribute> path) {
var id = ai.path + "/" + path.toStringPath
- DataConfigurationHelper::actorInstanceAttrMap.get(id)?.value?.toStringExpr
+ actorInstanceAttrMap.get(id)?.value?.toStringExpr
}
override getAttrInstanceConfigValue(InterfaceItemInstance item, List<Attribute> path) {
- DataConfigurationHelper::actorInstanceAttrMap.get(item.path + "/" + path.toStringPath)?.value?.toStringExpr
+ actorInstanceAttrMap.get(item.path + "/" + path.toStringPath)?.value?.toStringExpr
}
// dynamic
@@ -117,7 +120,7 @@ class DataConfiguration implements IDataConfiguration {
override getDynConfigReadAttributes(ActorInstance ai) {
val result = new ArrayList<Attribute>
- var configs = DataConfigurationHelper::dynActorInstanceAttrMap.get(ai.path)
+ var configs = dynActorInstanceAttrMap.get(ai.path)
configs?.forEach(c|if(c.readOnly) result.add(c.attribute))
return result
@@ -125,7 +128,7 @@ class DataConfiguration implements IDataConfiguration {
override getDynConfigWriteAttributes(ActorInstance ai) {
val result = new ArrayList<Attribute>
- var configs = DataConfigurationHelper::dynActorInstanceAttrMap.get(ai.path)
+ var configs = dynActorInstanceAttrMap.get(ai.path)
configs?.forEach(c|if(!c.readOnly) result.add(c.attribute))
return result
@@ -156,19 +159,19 @@ class DataConfiguration implements IDataConfiguration {
}
def private getConfig(SubSystemInstance cc) {
- DataConfigurationHelper::subSystemConfigMap.get(cc.path)
+ subSystemConfigMap.get(cc.path)
}
override getDynConfigReadAttributes(ActorClass actor) {
val result = new HashSet<Attribute>
- var configs = DataConfigurationHelper::dynActorClassAttrMap.get(actor)
+ val configs = dynActorClassAttrMap.get(actor)
configs?.forEach(c|if(c.readOnly) result.add(c.attribute))
return result.toList
}
override getDynConfigWriteAttributes(ActorClass actor) {
val result = new HashSet<Attribute>
- var configs = DataConfigurationHelper::dynActorClassAttrMap.get(actor)
+ val configs = dynActorClassAttrMap.get(actor)
configs?.forEach(c|if(!c.readOnly) result.add(c.attribute))
return result.toList
}
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 da8d187b4..2a8612f66 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
@@ -36,19 +36,26 @@ import org.eclipse.etrice.core.room.Attribute;
import org.eclipse.etrice.core.room.DataClass;
import org.eclipse.etrice.core.room.ProtocolClass;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+
+@Singleton
public class DataConfigurationHelper {
+ @Inject
+ private ConfigUtil ConfigUtil;
+
// 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>();
+ public Map<String, AttrClassConfig> actorClassAttrMap = new HashMap<String, AttrClassConfig>();
+ public Map<String, AttrClassConfig> protocolClassAttrMap = new HashMap<String, AttrClassConfig>();
+ public 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 Map<String, SubSystemConfig> subSystemConfigMap = new HashMap<String, SubSystemConfig>();
+ public Map<String, List<AttrInstanceConfig>> dynActorInstanceAttrMap = new HashMap<String, List<AttrInstanceConfig>>();
+ public Map<ActorClass, List<AttrInstanceConfig>> dynActorClassAttrMap = new HashMap<ActorClass, List<AttrInstanceConfig>>();
- public static boolean setConfigModels(ResourceSet rs, ILogger logger) {
+ public boolean setConfigModels(ResourceSet rs, ILogger logger) {
actorClassAttrMap.clear();
protocolClassAttrMap.clear();
actorInstanceAttrMap.clear();
@@ -121,7 +128,7 @@ public class DataConfigurationHelper {
return !error;
}
- private static void collectConfigs(ActorInstanceConfig actorConfig,
+ private void collectConfigs(ActorInstanceConfig actorConfig,
String path, Map<String, AttrInstanceConfig> map) {
for (AttrInstanceConfig c : actorConfig.getAttributes()) {
collectConfigs(c, path + "/" + c.getAttribute().getName(), map);
@@ -150,7 +157,7 @@ public class DataConfigurationHelper {
}
}
- private static void collectConfigs(ProtocolClassConfig protocolConfig,
+ private void collectConfigs(ProtocolClassConfig protocolConfig,
Map<String, AttrClassConfig> map) {
String path = "/" + protocolConfig.getProtocol().getName();
if (protocolConfig.getRegular() != null)
@@ -165,14 +172,14 @@ public class DataConfigurationHelper {
+ c.getAttribute().getName(), map);
}
- private static void collectConfigs(ActorClassConfig actorConfig,
+ private 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,
+ private void collectConfigs(AttrClassConfig config, String path,
Map<String, AttrClassConfig> map) {
Attribute a = config.getAttribute();
if (a.getType().getType() instanceof DataClass)
@@ -181,7 +188,7 @@ public class DataConfigurationHelper {
map.put(path, config);
}
- private static void collectConfigs(AttrInstanceConfig config, String path,
+ private void collectConfigs(AttrInstanceConfig config, String path,
Map<String, AttrInstanceConfig> map) {
Attribute a = config.getAttribute();
if (a.getType().getType() instanceof DataClass)
@@ -190,7 +197,7 @@ public class DataConfigurationHelper {
map.put(path, config);
}
- public static String toStringPath(Iterable<String> path, String pathDelim) {
+ public String toStringPath(Iterable<String> path, String pathDelim) {
StringBuilder b = new StringBuilder();
for (String p : path)
b.append(pathDelim + p);
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 1b0ca915c..4344aef1d 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
@@ -45,12 +45,17 @@ import org.eclipse.etrice.generator.base.IDataConfiguration;
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.Extension;
import org.eclipse.xtext.xbase.lib.IterableExtensions;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
@SuppressWarnings("all")
public class DataConfiguration implements IDataConfiguration {
@Inject
+ @Extension
+ protected DataConfigurationHelper _dataConfigurationHelper;
+
+ @Inject
protected ILogger logger;
@Inject
@@ -63,7 +68,7 @@ public class DataConfiguration implements IDataConfiguration {
}
public boolean setResources(final ResourceSet resource, final ILogger logger) {
- return DataConfigurationHelper.setConfigModels(resource, logger);
+ return this._dataConfigurationHelper.setConfigModels(resource, logger);
}
public String getAttrClassConfigValue(final ActorClass actor, final List<Attribute> path) {
@@ -116,7 +121,7 @@ public class DataConfiguration implements IDataConfiguration {
String _stringPath = this.toStringPath(path);
_builder.append(_stringPath, "");
String id = _builder.toString();
- _xblockexpression = DataConfigurationHelper.actorClassAttrMap.get(id);
+ _xblockexpression = this._dataConfigurationHelper.actorClassAttrMap.get(id);
}
return _xblockexpression;
}
@@ -140,7 +145,7 @@ public class DataConfiguration implements IDataConfiguration {
String _stringPath = this.toStringPath(path);
_builder.append(_stringPath, "");
String id = _builder.toString();
- AttrClassConfig _get = DataConfigurationHelper.protocolClassAttrMap.get(id);
+ AttrClassConfig _get = this._dataConfigurationHelper.protocolClassAttrMap.get(id);
ConfigValueArray _value = null;
if (_get!=null) {
_value=_get.getValue();
@@ -178,7 +183,7 @@ public class DataConfiguration implements IDataConfiguration {
String _plus = (_path + "/");
String _stringPath = this.toStringPath(path);
String id = (_plus + _stringPath);
- AttrInstanceConfig _get = DataConfigurationHelper.actorInstanceAttrMap.get(id);
+ AttrInstanceConfig _get = this._dataConfigurationHelper.actorInstanceAttrMap.get(id);
ConfigValueArray _value = null;
if (_get!=null) {
_value=_get.getValue();
@@ -197,7 +202,7 @@ public class DataConfiguration implements IDataConfiguration {
String _plus = (_path + "/");
String _stringPath = this.toStringPath(path);
String _plus_1 = (_plus + _stringPath);
- AttrInstanceConfig _get = DataConfigurationHelper.actorInstanceAttrMap.get(_plus_1);
+ AttrInstanceConfig _get = this._dataConfigurationHelper.actorInstanceAttrMap.get(_plus_1);
ConfigValueArray _value = null;
if (_get!=null) {
_value=_get.getValue();
@@ -288,7 +293,7 @@ public class DataConfiguration implements IDataConfiguration {
public List<Attribute> getDynConfigReadAttributes(final ActorInstance ai) {
final ArrayList<Attribute> result = new ArrayList<Attribute>();
String _path = ai.getPath();
- List<AttrInstanceConfig> configs = DataConfigurationHelper.dynActorInstanceAttrMap.get(_path);
+ List<AttrInstanceConfig> configs = this._dataConfigurationHelper.dynActorInstanceAttrMap.get(_path);
if (configs!=null) {
final Procedure1<AttrInstanceConfig> _function = new Procedure1<AttrInstanceConfig>() {
public void apply(final AttrInstanceConfig c) {
@@ -307,7 +312,7 @@ public class DataConfiguration implements IDataConfiguration {
public List<Attribute> getDynConfigWriteAttributes(final ActorInstance ai) {
final ArrayList<Attribute> result = new ArrayList<Attribute>();
String _path = ai.getPath();
- List<AttrInstanceConfig> configs = DataConfigurationHelper.dynActorInstanceAttrMap.get(_path);
+ List<AttrInstanceConfig> configs = this._dataConfigurationHelper.dynActorInstanceAttrMap.get(_path);
if (configs!=null) {
final Procedure1<AttrInstanceConfig> _function = new Procedure1<AttrInstanceConfig>() {
public void apply(final AttrInstanceConfig c) {
@@ -407,12 +412,12 @@ public class DataConfiguration implements IDataConfiguration {
private SubSystemConfig getConfig(final SubSystemInstance cc) {
String _path = cc.getPath();
- return DataConfigurationHelper.subSystemConfigMap.get(_path);
+ return this._dataConfigurationHelper.subSystemConfigMap.get(_path);
}
public List<Attribute> getDynConfigReadAttributes(final ActorClass actor) {
final HashSet<Attribute> result = new HashSet<Attribute>();
- List<AttrInstanceConfig> configs = DataConfigurationHelper.dynActorClassAttrMap.get(actor);
+ final List<AttrInstanceConfig> configs = this._dataConfigurationHelper.dynActorClassAttrMap.get(actor);
if (configs!=null) {
final Procedure1<AttrInstanceConfig> _function = new Procedure1<AttrInstanceConfig>() {
public void apply(final AttrInstanceConfig c) {
@@ -430,7 +435,7 @@ public class DataConfiguration implements IDataConfiguration {
public List<Attribute> getDynConfigWriteAttributes(final ActorClass actor) {
final HashSet<Attribute> result = new HashSet<Attribute>();
- List<AttrInstanceConfig> configs = DataConfigurationHelper.dynActorClassAttrMap.get(actor);
+ final List<AttrInstanceConfig> configs = this._dataConfigurationHelper.dynActorClassAttrMap.get(actor);
if (configs!=null) {
final Procedure1<AttrInstanceConfig> _function = new Procedure1<AttrInstanceConfig>() {
public void apply(final AttrInstanceConfig c) {

Back to the top