diff options
author | Henrik Rentz-Reichert | 2012-11-22 15:25:37 +0000 |
---|---|---|
committer | Henrik Rentz-Reichert | 2012-11-22 15:25:37 +0000 |
commit | d76122f82f7a02ca989c78d4537368a3db6077f8 (patch) | |
tree | 46676f22189975d1620409252d8c5e84892ab087 | |
parent | 34f8b2a6291a6476a81de2ba66d0554795f7d49b (diff) | |
download | org.eclipse.etrice-d76122f82f7a02ca989c78d4537368a3db6077f8.tar.gz org.eclipse.etrice-d76122f82f7a02ca989c78d4537368a3db6077f8.tar.xz org.eclipse.etrice-d76122f82f7a02ca989c78d4537368a3db6077f8.zip |
[generator, generator.config, generator.java] removed work-around
When using the configuration currently *no* LogicalSystem must be
defined!
8 files changed, 31 insertions, 100 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 0981c3ef4..e7b0e7588 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 @@ -35,7 +35,6 @@ import org.eclipse.emf.ecore.resource.Resource import org.eclipse.etrice.core.config.ConfigModel
import com.google.inject.Inject
import org.eclipse.xtext.scoping.impl.ImportUriResolver
-import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance
class DataConfiguration implements IDataConfiguration {
@@ -82,12 +81,12 @@ class DataConfiguration implements IDataConfiguration { }
override getAttrInstanceConfigValue(ActorInstance ai, List<Attribute> path) {
- var id = ai.subsyspath+"/"+path.toStringPath
+ var id = ai.path+"/"+path.toStringPath
DataConfigurationHelper::actorInstanceAttrMap.get(id)?.value?.toStringExpr
}
override getAttrInstanceConfigValue(ActorInstance ai, InterfaceItem port, List<Attribute> path) {
- var id = ai.subsyspath+"/"+port.name+"/"+path.toStringPath
+ var id = ai.path+"/"+port.name+"/"+path.toStringPath
DataConfigurationHelper::actorInstanceAttrMap.get(id)?.value?.toStringExpr
}
@@ -178,12 +177,4 @@ class DataConfiguration implements IDataConfiguration { }
}
- // TODO: this has to be replaced by a simple ai.path later
- def subsyspath(ActorInstance ai) {
- var parent = ai.eContainer
- while (! (parent instanceof SubSystemInstance))
- parent = parent.eContainer
- ai.path.replaceFirst("/[a-zA-Z_]+/", "/"+(parent as SubSystemInstance).subSystemClass.name+"/")
- }
-
}
\ No newline at end of file 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 be5d41bf6..45e8f6405 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 @@ -24,7 +24,6 @@ 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.SubSystemInstance;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.Attribute;
import org.eclipse.etrice.core.room.InterfaceItem;
@@ -140,8 +139,8 @@ public class DataConfiguration implements IDataConfiguration { public String getAttrInstanceConfigValue(final ActorInstance ai, final List<Attribute> path) {
String _xblockexpression = null;
{
- String _subsyspath = this.subsyspath(ai);
- String _plus = (_subsyspath + "/");
+ String _path = ai.getPath();
+ String _plus = (_path + "/");
String _stringPath = this.toStringPath(path);
String id = (_plus + _stringPath);
AttrInstanceConfig _get = DataConfigurationHelper.actorInstanceAttrMap.get(id);
@@ -155,8 +154,8 @@ public class DataConfiguration implements IDataConfiguration { public String getAttrInstanceConfigValue(final ActorInstance ai, final InterfaceItem port, final List<Attribute> path) {
String _xblockexpression = null;
{
- String _subsyspath = this.subsyspath(ai);
- String _plus = (_subsyspath + "/");
+ String _path = ai.getPath();
+ String _plus = (_path + "/");
String _name = port.getName();
String _plus_1 = (_plus + _name);
String _plus_2 = (_plus_1 + "/");
@@ -370,27 +369,4 @@ public class DataConfiguration implements IDataConfiguration { }
}
}
-
- public String subsyspath(final ActorInstance ai) {
- String _xblockexpression = null;
- {
- EObject parent = ai.eContainer();
- boolean _not = (!(parent instanceof SubSystemInstance));
- boolean _while = _not;
- while (_while) {
- EObject _eContainer = parent.eContainer();
- parent = _eContainer;
- boolean _not_1 = (!(parent instanceof SubSystemInstance));
- _while = _not_1;
- }
- String _path = ai.getPath();
- SubSystemClass _subSystemClass = ((SubSystemInstance) parent).getSubSystemClass();
- String _name = _subSystemClass.getName();
- String _plus = ("/" + _name);
- String _plus_1 = (_plus + "/");
- String _replaceFirst = _path.replaceFirst("/[a-zA-Z_]+/", _plus_1);
- _xblockexpression = (_replaceFirst);
- }
- return _xblockexpression;
- }
}
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.xtend index 498b1f3c7..c4dbabbf2 100644 --- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.xtend +++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.xtend @@ -168,7 +168,7 @@ class SubSystemClassGen { «ENDIF»
«ENDFOR»
}
- «IF !dataConfigExt.getDynConfigWriteAttributes(ai.subsyspath).empty»
+ «IF !dataConfigExt.getDynConfigWriteAttributes(ai.path).empty»
, variableService
«ENDIF»
);
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/VariableServiceGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/VariableServiceGen.xtend index 12be3060a..568111467 100644 --- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/VariableServiceGen.xtend +++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/VariableServiceGen.xtend @@ -56,7 +56,7 @@ class VariableServiceGen { def private generate(Root root, SubSystemInstance comp) { val cc = comp.subSystemClass val aisAttrMap = new HashMap<ActorInstance, List<Attribute>> - comp.allContainedInstances.forEach(ai | if(!configExt.getDynConfigReadAttributes(ai.subsyspath).empty)aisAttrMap.put(ai, configExt.getDynConfigReadAttributes(ai.subsyspath))) + comp.allContainedInstances.forEach(ai | if(!configExt.getDynConfigReadAttributes(ai.path).empty)aisAttrMap.put(ai, configExt.getDynConfigReadAttributes(ai.path))) ''' package «cc.getPackage()»; @@ -173,7 +173,7 @@ class VariableServiceGen { def private getDynConfigDataClasses(Iterable<ActorInstance> ais){ val result = new HashSet<DataClass> - ais.forEach(ai | configExt.getDynConfigReadAttributes(ai.subsyspath). + ais.forEach(ai | configExt.getDynConfigReadAttributes(ai.path). forEach(a | if(a.refType.type.dataClass)result.add(a.refType.type as DataClass) )) return result @@ -202,13 +202,13 @@ class VariableServiceGen { } def private getVarName(ActorInstance ai){ - '''«FOR p : ai.subsyspath.split('/').drop(2) SEPARATOR '_'»«p»«ENDFOR»''' + '''«FOR p : ai.path.split('/').drop(2) SEPARATOR '_'»«p»«ENDFOR»''' } def private genGetAttributeValues(List<Attribute> path, ActorInstance ai){ var a = path.last if(a.refType.type.primitive){''' - values.put("«ai.subsyspath»«path.toAbsolutePath('/')»", «IF a.size>0»toObjectArray(«ENDIF»«ai.varName».«path.invokeGetters(null)»«IF a.size>0»)«ENDIF»); + values.put("«ai.path»«path.toAbsolutePath('/')»", «IF a.size>0»toObjectArray(«ENDIF»«ai.varName».«path.invokeGetters(null)»«IF a.size>0»)«ENDIF»); ''' } else if(a.refType.type.dataClass){ var dataClass = (a.refType.type as DataClass) @@ -224,7 +224,7 @@ class VariableServiceGen { var a = path.last var aVarName = path.toAbsolutePath("_") if(a.refType.type.primitive){''' - id = "«ai.subsyspath»«path.toAbsolutePath("/")»"; + id = "«ai.path»«path.toAbsolutePath("/")»"; «IF a.size==0»«a.refType.type.typeName.toWrapper»«ELSE»«a.refType.type.typeName»[]«ENDIF» «aVarName» = null; object = values.get(id); if(object != null){ @@ -253,7 +253,7 @@ class VariableServiceGen { ''' if(«aVarName» != null){ «ai.varName».«getters»«invokeSetter(a.name, null, aVarName)»; - getDiffMap().put("«ai.subsyspath»«path.toAbsolutePath("/")»", «aVarName»); + getDiffMap().put("«ai.path»«path.toAbsolutePath("/")»", «aVarName»); } ''' } else if(a.refType.type.dataClass){ diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.java index e524b6e86..2e6666ded 100644 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.java +++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.java @@ -571,8 +571,8 @@ public class SubSystemClassGen { _builder.append("}");
_builder.newLine();
{
- String _subsyspath = this._roomExtensions.subsyspath(ai_2);
- List<Attribute> _dynConfigWriteAttributes = this.dataConfigExt.getDynConfigWriteAttributes(_subsyspath);
+ String _path_10 = ai_2.getPath();
+ List<Attribute> _dynConfigWriteAttributes = this.dataConfigExt.getDynConfigWriteAttributes(_path_10);
boolean _isEmpty_5 = _dynConfigWriteAttributes.isEmpty();
boolean _not_2 = (!_isEmpty_5);
if (_not_2) {
@@ -684,8 +684,8 @@ public class SubSystemClassGen { }
_builder.append("\t\t\t\t\t");
_builder.append("addr_item_");
- String _path_10 = ai_5.getPath();
- String _pathName_8 = this._roomExtensions.getPathName(_path_10);
+ String _path_11 = ai_5.getPath();
+ String _pathName_8 = this._roomExtensions.getPathName(_path_11);
_builder.append(_pathName_8, " ");
_builder.newLineIfNotEmpty();
}
diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/VariableServiceGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/VariableServiceGen.java index c46e0a43b..ca85ccda1 100644 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/VariableServiceGen.java +++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/VariableServiceGen.java @@ -88,13 +88,13 @@ public class VariableServiceGen { EList<ActorInstance> _allContainedInstances = comp.getAllContainedInstances();
final Procedure1<ActorInstance> _function = new Procedure1<ActorInstance>() {
public void apply(final ActorInstance ai) {
- String _subsyspath = VariableServiceGen.this.roomExt.subsyspath(ai);
- List<Attribute> _dynConfigReadAttributes = VariableServiceGen.this.configExt.getDynConfigReadAttributes(_subsyspath);
+ String _path = ai.getPath();
+ List<Attribute> _dynConfigReadAttributes = VariableServiceGen.this.configExt.getDynConfigReadAttributes(_path);
boolean _isEmpty = _dynConfigReadAttributes.isEmpty();
boolean _not = (!_isEmpty);
if (_not) {
- String _subsyspath_1 = VariableServiceGen.this.roomExt.subsyspath(ai);
- List<Attribute> _dynConfigReadAttributes_1 = VariableServiceGen.this.configExt.getDynConfigReadAttributes(_subsyspath_1);
+ String _path_1 = ai.getPath();
+ List<Attribute> _dynConfigReadAttributes_1 = VariableServiceGen.this.configExt.getDynConfigReadAttributes(_path_1);
aisAttrMap.put(ai, _dynConfigReadAttributes_1);
}
}
@@ -537,8 +537,8 @@ public class VariableServiceGen { final HashSet<DataClass> result = _hashSet;
final Procedure1<ActorInstance> _function = new Procedure1<ActorInstance>() {
public void apply(final ActorInstance ai) {
- String _subsyspath = VariableServiceGen.this.roomExt.subsyspath(ai);
- List<Attribute> _dynConfigReadAttributes = VariableServiceGen.this.configExt.getDynConfigReadAttributes(_subsyspath);
+ String _path = ai.getPath();
+ List<Attribute> _dynConfigReadAttributes = VariableServiceGen.this.configExt.getDynConfigReadAttributes(_path);
final Procedure1<Attribute> _function = new Procedure1<Attribute>() {
public void apply(final Attribute a) {
RefableType _refType = a.getRefType();
@@ -623,8 +623,8 @@ public class VariableServiceGen { private CharSequence getVarName(final ActorInstance ai) {
StringConcatenation _builder = new StringConcatenation();
{
- String _subsyspath = this.roomExt.subsyspath(ai);
- String[] _split = _subsyspath.split("/");
+ String _path = ai.getPath();
+ String[] _split = _path.split("/");
Iterable<String> _drop = IterableExtensions.<String>drop(((Iterable<String>)Conversions.doWrapArray(_split)), 2);
boolean _hasElements = false;
for(final String p : _drop) {
@@ -650,8 +650,8 @@ public class VariableServiceGen { if (_isPrimitive) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("values.put(\"");
- String _subsyspath = this.roomExt.subsyspath(ai);
- _builder.append(_subsyspath, "");
+ String _path = ai.getPath();
+ _builder.append(_path, "");
String _absolutePath = this.toAbsolutePath(path, "/");
_builder.append(_absolutePath, "");
_builder.append("\", ");
@@ -721,8 +721,8 @@ public class VariableServiceGen { if (_isPrimitive) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("id = \"");
- String _subsyspath = this.roomExt.subsyspath(ai);
- _builder.append(_subsyspath, "");
+ String _path = ai.getPath();
+ _builder.append(_path, "");
String _absolutePath = this.toAbsolutePath(path, "/");
_builder.append(_absolutePath, "");
_builder.append("\";");
@@ -902,8 +902,8 @@ public class VariableServiceGen { _builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("getDiffMap().put(\"");
- String _subsyspath = this.roomExt.subsyspath(ai);
- _builder.append(_subsyspath, " ");
+ String _path = ai.getPath();
+ _builder.append(_path, " ");
String _absolutePath = this.toAbsolutePath(path, "/");
_builder.append(_absolutePath, " ");
_builder.append("\", ");
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/RoomExtensions.xtend b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/RoomExtensions.xtend index 773a6b842..3ca6b8f36 100644 --- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/RoomExtensions.xtend +++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/RoomExtensions.xtend @@ -55,8 +55,6 @@ import org.eclipse.etrice.core.room.Trigger import static org.eclipse.etrice.generator.base.CodegenHelpers.*
import static extension org.eclipse.etrice.core.room.util.RoomHelpers.*
-import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance
-import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance
@Singleton
class RoomExtensions {
@@ -596,12 +594,4 @@ class RoomExtensions { return result;
} - // TODO: this has to be replaced by a simple ai.path later
- def subsyspath(ActorInstance ai) {
- var parent = ai.eContainer
- while (! (parent instanceof SubSystemInstance))
- parent = parent.eContainer
- ai.path.replaceFirst("/[a-zA-Z_]+/", "/"+(parent as SubSystemInstance).subSystemClass.name+"/")
- }
-
}
diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/RoomExtensions.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/RoomExtensions.java index 64010b7e1..9c1dd65dd 100644 --- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/RoomExtensions.java +++ b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/RoomExtensions.java @@ -12,14 +12,12 @@ import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.etrice.core.genmodel.etricegen.ActiveTrigger;
-import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance;
import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
import org.eclipse.etrice.core.genmodel.etricegen.ExpandedRefinedState;
import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance;
import org.eclipse.etrice.core.genmodel.etricegen.PortInstance;
import org.eclipse.etrice.core.genmodel.etricegen.SAPInstance;
import org.eclipse.etrice.core.genmodel.etricegen.ServiceImplInstance;
-import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance;
import org.eclipse.etrice.core.genmodel.etricegen.TransitionChain;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.Attribute;
@@ -44,7 +42,6 @@ import org.eclipse.etrice.core.room.SimpleState; import org.eclipse.etrice.core.room.StandardOperation;
import org.eclipse.etrice.core.room.State;
import org.eclipse.etrice.core.room.StateGraph;
-import org.eclipse.etrice.core.room.SubSystemClass;
import org.eclipse.etrice.core.room.TrPoint;
import org.eclipse.etrice.core.room.Transition;
import org.eclipse.etrice.core.room.TransitionPoint;
@@ -963,29 +960,6 @@ public class RoomExtensions { return result;
}
- public String subsyspath(final ActorInstance ai) {
- String _xblockexpression = null;
- {
- EObject parent = ai.eContainer();
- boolean _not = (!(parent instanceof SubSystemInstance));
- boolean _while = _not;
- while (_while) {
- EObject _eContainer = parent.eContainer();
- parent = _eContainer;
- boolean _not_1 = (!(parent instanceof SubSystemInstance));
- _while = _not_1;
- }
- String _path = ai.getPath();
- SubSystemClass _subSystemClass = ((SubSystemInstance) parent).getSubSystemClass();
- String _name = _subSystemClass.getName();
- String _plus = ("/" + _name);
- String _plus_1 = (_plus + "/");
- String _replaceFirst = _path.replaceFirst("/[a-zA-Z_]+/", _plus_1);
- _xblockexpression = (_replaceFirst);
- }
- return _xblockexpression;
- }
-
public String getPortClassName(final EObject p) {
if (p instanceof Port) {
return _getPortClassName((Port)p);
|