diff options
author | Henrik Rentz-Reichert | 2013-08-07 16:08:58 +0000 |
---|---|---|
committer | Henrik Rentz-Reichert | 2013-08-07 16:08:58 +0000 |
commit | 3b077b417cfe120a1d6ac0133c9981f5c36d1208 (patch) | |
tree | dcbcc9a2d888760d790a02d3d9f427a7ccfb5f26 /plugins/org.eclipse.etrice.generator.java/src/org/eclipse | |
parent | 3b8403120c3258c1eb807319f5f07ab2a85e8f28 (diff) | |
download | org.eclipse.etrice-3b077b417cfe120a1d6ac0133c9981f5c36d1208.tar.gz org.eclipse.etrice-3b077b417cfe120a1d6ac0133c9981f5c36d1208.tar.xz org.eclipse.etrice-3b077b417cfe120a1d6ac0133c9981f5c36d1208.zip |
[*] bug 414560: [core.etphys][core.room] rename some attributes and references, use unordered groups
https://bugs.eclipse.org/bugs/show_bug.cgi?id=414560
Diffstat (limited to 'plugins/org.eclipse.etrice.generator.java/src/org/eclipse')
8 files changed, 48 insertions, 48 deletions
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassGen.xtend index 46e87a065..9b1322a3b 100644 --- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassGen.xtend +++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassGen.xtend @@ -107,7 +107,7 @@ class ActorClassGen extends GenericActorClassGenerator { «ENDFOR» //--------------------- saps - «FOR sap : ac.strSAPs» + «FOR sap : ac.serviceAccessPoints» protected «sap.getPortClassName()» «sap.name» = null; «ENDFOR» @@ -118,7 +118,7 @@ class ActorClassGen extends GenericActorClassGenerator { //--------------------- optional actors «FOR sub : ac.actorRefs.filter(r|r.refType==ReferenceType.OPTIONAL)» - protected «sub.type.name»«IF sub.size!=1»Replicated«ENDIF»Interface «sub.name» = null; + protected «sub.type.name»«IF sub.multiplicity!=1»Replicated«ENDIF»Interface «sub.name» = null; «ENDFOR» //--------------------- interface item IDs @@ -144,7 +144,7 @@ class ActorClassGen extends GenericActorClassGenerator { «ENDFOR» // own saps - «FOR sap : ac.strSAPs» + «FOR sap : ac.serviceAccessPoints» «sap.name» = new «sap.getPortClassName()»(this, "«sap.name»", IFITEM_«sap.name», 0); «ENDFOR» @@ -156,9 +156,9 @@ class ActorClassGen extends GenericActorClassGenerator { // sub actors «FOR sub : ac.actorRefs» «IF sub.refType==ReferenceType.OPTIONAL» - «sub.name» = new «sub.type.name»«IF sub.size!=1»Replicated«ENDIF»Interface(this, "«sub.name»"); - «ELSEIF sub.size>1» - for (int i=0; i<«sub.size»; ++i) { + «sub.name» = new «sub.type.name»«IF sub.multiplicity!=1»Replicated«ENDIF»Interface(this, "«sub.name»"); + «ELSEIF sub.multiplicity>1» + for (int i=0; i<«sub.multiplicity»; ++i) { «IF GlobalSettings::generateMSCInstrumentation» DebuggingService.getInstance().addMessageActorCreate(this, "«sub.name»_"+i); «ENDIF» @@ -194,7 +194,7 @@ class ActorClassGen extends GenericActorClassGenerator { «FOR ep : ac.getEndPorts()» «ep.portClassName.getterImplementation(ep.name, ac.name)» «ENDFOR» - «FOR sap : ac.strSAPs» + «FOR sap : ac.serviceAccessPoints» «sap.portClassName.getterImplementation(sap.name, ac.name)» «ENDFOR» «FOR svc : ac.serviceImplementations» @@ -292,12 +292,12 @@ class ActorClassGen extends GenericActorClassGenerator { «ENDIF» «IF !ac.attributes.empty» «FOR att : ac.attributes» - «IF att.refType.type instanceof PrimitiveType» + «IF att.type.type instanceof PrimitiveType» «genSavePrimitive(att)» «ELSE» ««« DataClass and ExternalType (the latter one has to implement Serializable) «IF att.size>1» - for («att.refType.type.name» v: «att.name») output.writeObject(v); + for («att.type.type.name» v: «att.name») output.writeObject(v); «ELSE» output.writeObject(«att.name»); «ENDIF» @@ -316,14 +316,14 @@ class ActorClassGen extends GenericActorClassGenerator { «ENDIF» «IF !ac.attributes.empty» «FOR att : ac.attributes» - «IF att.refType.type instanceof PrimitiveType» + «IF att.type.type instanceof PrimitiveType» «genLoadPrimitive(att)» «ELSE» ««« DataClass and ExternalType (the latter one has to implement Serializable) «IF att.size>1» - for (int i=0; i< «att.name».length; ++i) «att.name»[i] = («att.refType.type.name») input.readObject(); + for (int i=0; i< «att.name».length; ++i) «att.name»[i] = («att.type.type.name») input.readObject(); «ELSE» - «att.name» = («att.refType.type.name») input.readObject(); + «att.name» = («att.type.type.name») input.readObject(); «ENDIF» «ENDIF» «ENDFOR» @@ -332,7 +332,7 @@ class ActorClassGen extends GenericActorClassGenerator { } private def genSavePrimitive(Attribute att) { - val type = (att.refType.type as PrimitiveType).targetName + val type = (att.type.type as PrimitiveType).targetName val method = type.saveMethod if (att.size>1) @@ -356,7 +356,7 @@ class ActorClassGen extends GenericActorClassGenerator { } private def genLoadPrimitive(Attribute att) { - val type = (att.refType.type as PrimitiveType).targetName + val type = (att.type.type as PrimitiveType).targetName val method = type.loadMethod if (att.size>1) diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.xtend index 04bb38530..44884708f 100644 --- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.xtend +++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.xtend @@ -56,7 +56,7 @@ class ConfigGenAddon { def private CharSequence applyInstanceConfig(InstanceBase instance, String invokes, List<Attribute> path){ var a = path.last - var aType = a.refType.type + var aType = a.type.type switch aType { PrimitiveType: { var value = typeHelpers.getAttrInstanceConfigValue(path, instance) @@ -76,7 +76,7 @@ class ConfigGenAddon { def public genDynConfigGetterSetter(ActorClass ac){''' «FOR a : dataConfigExt.getDynConfigReadAttributes(ac)» - public «a.refType.type.typeName»«IF a.size>0»[]«ENDIF» get«a.name.toFirstUpper»(){ + public «a.type.type.typeName»«IF a.size>0»[]«ENDIF» get«a.name.toFirstUpper»(){ if(lock_«a.name» == null) return «a.name»; else @@ -84,7 +84,7 @@ class ConfigGenAddon { return «a.name»; } } - public void set«a.name.toFirstUpper»(«a.refType.type.typeName»«IF a.size>0»[]«ENDIF» «a.name»){ + public void set«a.name.toFirstUpper»(«a.type.type.typeName»«IF a.size>0»[]«ENDIF» «a.name»){ if(lock_«a.name» == null) this.«a.name» = «a.name»; else @@ -97,7 +97,7 @@ class ConfigGenAddon { } «ENDFOR» «FOR a : dataConfigExt.getDynConfigWriteAttributes(ac)» - public void setAndWrite«a.name.toFirstUpper»(«a.refType.type.typeName»«IF a.size>0»[]«ENDIF» «a.name»){ + public void setAndWrite«a.name.toFirstUpper»(«a.type.type.typeName»«IF a.size>0»[]«ENDIF» «a.name»){ set«a.name.toFirstUpper»(«a.name»); getVariableService().write(this.getInstancePath()+"/«a.name»", «a.name»); } @@ -116,7 +116,7 @@ class ConfigGenAddon { } def private CharSequence genMinMaxConstantsRec(ActorClass ac, String varNamePath, List<Attribute> path){ - var aType = path.last.refType.type + var aType = path.last.type.type switch aType { DataClass: ''' diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/DataClassGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/DataClassGen.xtend index 11f12568e..4d50fe5df 100644 --- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/DataClassGen.xtend +++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/DataClassGen.xtend @@ -80,7 +80,7 @@ class DataClassGen { { // user defined constructor body - «FOR l : ctor.detailCode.commands» + «FOR l : ctor.detailCode.lines» «l» «ENDFOR» } @@ -151,7 +151,7 @@ class DataClassGen { def private deepCopy(List<Attribute> attributes) { ''' «FOR a : attributes» - «IF a.refType.type instanceof ComplexType» + «IF a.type.type instanceof ComplexType» if («a.name»!=null) { «IF a.size==0» copy.«a.name» = «a.name».deepCopy(); diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/Initialization.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/Initialization.xtend index 4cb3a7433..ea073b7d2 100644 --- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/Initialization.xtend +++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/Initialization.xtend @@ -40,14 +40,14 @@ class Initialization { // initialize attributes «FOR a : attribs» «attributeClassInit(a, roomClass, useClassDefaultsOnly)» - «IF a.refType.type.dataClass»«attributeInitPrimitiveRec(new ArrayList<Attribute>.union(a), roomClass)»«ENDIF» + «IF a.type.type.dataClass»«attributeInitPrimitiveRec(new ArrayList<Attribute>.union(a), roomClass)»«ENDIF» «ENDFOR» ''' } def private attributeClassInit(Attribute a, EObject roomClass, boolean useClassDefaultsOnly){ - var aType = a.refType.type - if(a.refType.ref){ + var aType = a.type.type + if(a.type.ref){ if(a.defaultValueLiteral != null) attributeInit(a, a.defaultValueLiteral) else if(languageExt.needsInitialization(a)) @@ -66,7 +66,7 @@ class Initialization { def private CharSequence attributeInitPrimitiveRec(List<Attribute> path, EObject roomClass){ var a = path.last - var aType = a.refType.type + var aType = a.type.type if(aType.dataClass){ return ''' «FOR e : (aType as DataClass).allAttributes» @@ -90,7 +90,7 @@ class Initialization { } def genAttributeInitializer(Attribute a, String value, String invokes){ - var aType = a.refType.type + var aType = a.type.type // special treatment of char array with single character ('x') ''' «IF a.size == 0 || (a.size > 0 && "char".equals(aType.typeName) && !value.matches("'.'|\\(char\\).*"))» @@ -98,7 +98,7 @@ class Initialization { «ELSEIF !value.trim.startsWith('{') || "char".equals(aType.typeName)» { «aType.typeName»[] array = new «aType.typeName»[«a.size»]; - «IF !(a.refType.ref && aType.primitive)» + «IF !(a.type.ref && aType.primitive)» for (int i=0;i<«a.size»;i++){ array[i] = «value»; } diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/JavaExtensions.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/JavaExtensions.xtend index c2db8f663..a33c69f6d 100644 --- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/JavaExtensions.xtend +++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/JavaExtensions.xtend @@ -81,7 +81,7 @@ class JavaExtensions implements ILanguageExtension { } def boolean needsInitialization(Attribute a){ - a.size > 0 || !typeHelpers.isPrimitive(a.refType.type) || typeHelpers.typeName(a.refType.type).equals("String") + a.size > 0 || !typeHelpers.isPrimitive(a.type.type) || typeHelpers.typeName(a.type.type).equals("String") } override String accessLevelPrivate() {"private "} diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/NodeGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/NodeGen.xtend index bc25b0c95..5fd2cc7ab 100644 --- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/NodeGen.xtend +++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/NodeGen.xtend @@ -170,8 +170,8 @@ class NodeGen { // sub actors «FOR sub : cc.actorRefs» - «IF sub.size>1» - for (int i=0; i<«sub.size»; ++i) { + «IF sub.multiplicity>1» + for (int i=0; i<«sub.multiplicity»; ++i) { «IF GlobalSettings::generateMSCInstrumentation» DebuggingService.getInstance().addMessageActorCreate(this, "«sub.name»_"+i); «ENDIF» diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend index 36796bb8d..b788efced 100644 --- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend +++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend @@ -156,7 +156,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator { «FOR hdlr : pc.getReceiveHandlers(conj)» case «hdlr.msg.getCodeName()»: { - «FOR command : hdlr.detailCode.commands» + «FOR command : hdlr.detailCode.lines» «command» «ENDFOR» } @@ -265,7 +265,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator { ''' «messageSignature(m)» { «IF hdlr!=null» - «FOR command : hdlr.detailCode.commands» «command» + «FOR command : hdlr.detailCode.lines» «command» «ENDFOR» «ELSE» «IF GlobalSettings::generateMSCInstrumentation» 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 4ec86e0da..510b92894 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 @@ -145,7 +145,7 @@ class VariableServiceGen { «FOR dc : getAllDataClasses(dataClasses)» private void writeDataClass(String id, «dc.typeName» object, Map<String, Object> map){ «FOR a : dc.allAttributes» - «IF a.refType.type.primitive» + «IF a.type.type.primitive» map.put(id+"/«a.name»", «IF a.size>0»toObjectArray(«ENDIF»object.«invokeGetter(a.name, null)»«IF a.size>0»)«ENDIF»); «ELSE» writeDataClass(id+"/«a.name»", object.«invokeGetter(a.name, null)», map); @@ -169,7 +169,7 @@ class VariableServiceGen { var max = configExt.getAttrClassConfigMaxValue(ac, path) != null if(min || max) ''' - «IF a.size>0»for(«a.refType.type.typeName» e : «aVarName») + «IF a.size>0»for(«a.type.type.typeName» e : «aVarName») «ENDIF»checkMinMax(«IF a.size>0»e«ELSE»«aVarName»«ENDIF», «IF min»«ac.name».MIN«aVarName»«ELSE»null«ENDIF», «IF max»«ac.name».MAX«aVarName»«ELSE»null«ENDIF»); ''' } @@ -177,7 +177,7 @@ class VariableServiceGen { def private getDynConfigDataClasses(Iterable<ActorInstance> ais){ val result = new HashSet<DataClass> ais.forEach(ai | configExt.getDynConfigReadAttributes(ai). - forEach(a | if(a.refType.type.dataClass)result.add(a.refType.type as DataClass) + forEach(a | if(a.type.type.dataClass)result.add(a.type.type as DataClass) )) return result } @@ -189,7 +189,7 @@ class VariableServiceGen { visit.addAll(dcs) while(!visit.empty){ var dc = visit.pop - dc.allAttributes.forEach(a | if(a.refType.type.dataClass)visit.add(a.refType.type as DataClass)) + dc.allAttributes.forEach(a | if(a.type.type.dataClass)visit.add(a.type.type as DataClass)) } return result } @@ -210,13 +210,13 @@ class VariableServiceGen { def private CharSequence genGetAttributeValues(List<Attribute> path, ActorInstance ai){ val a = path.last - if (a.refType.type.primitive) { + if (a.type.type.primitive) { ''' 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) + else if (a.type.type.dataClass) { + var dataClass = (a.type.type as DataClass) ''' «FOR at : dataClass.allAttributes» «genGetAttributeValues(path.union(at), ai)» @@ -228,20 +228,20 @@ class VariableServiceGen { def private CharSequence genSetAttributeValues1(List<Attribute> path, ActorInstance ai){ var a = path.last var aVarName = path.toAbsolutePath("_") - if(a.refType.type.primitive){''' + if(a.type.type.primitive){''' id = "«ai.path»«path.toAbsolutePath("/")»"; - «IF a.size==0»«a.refType.type.typeName.toWrapper»«ELSE»«a.refType.type.typeName»[]«ENDIF» «aVarName» = null; + «IF a.size==0»«a.type.type.typeName.toWrapper»«ELSE»«a.type.type.typeName»[]«ENDIF» «aVarName» = null; object = values.get(id); if(object != null){ - «aVarName» = ensure«a.refType.type.typeName.toFirstUpper»«IF a.size>0»Array«ENDIF»(object«IF a.size>0», «a.size»«ENDIF»); + «aVarName» = ensure«a.type.type.typeName.toFirstUpper»«IF a.size>0»Array«ENDIF»(object«IF a.size>0», «a.size»«ENDIF»); «genMinMaxCheck(path, ai.actorClass)» - if(!«IF a.size==0»«aVarName».equals(«ELSE»Arrays.equals(«aVarName», «ENDIF»(«IF a.size==0»«a.refType.type.typeName.toWrapper»«ELSE»«a.refType.type.typeName»[]«ENDIF»)getDiffMap().get(id))) + if(!«IF a.size==0»«aVarName».equals(«ELSE»Arrays.equals(«aVarName», «ENDIF»(«IF a.size==0»«a.type.type.typeName.toWrapper»«ELSE»«a.type.type.typeName»[]«ENDIF»)getDiffMap().get(id))) changed = true; } else warning(id, "is missing"); ''' - } else if(a.refType.type.dataClass){ - var dataClass = (a.refType.type as DataClass) + } else if(a.type.type.dataClass){ + var dataClass = (a.type.type as DataClass) ''' «FOR at : dataClass.allAttributes» «genSetAttributeValues1(path.union(at), ai)» @@ -253,7 +253,7 @@ class VariableServiceGen { def private CharSequence genSetAttributeValues2(List<Attribute> path, ActorInstance ai){ var a = path.last var aVarName = path.toAbsolutePath("_") - if (a.refType.type.primitive) { + if (a.type.type.primitive) { val getters = if(path.size>1)path.take(path.size-1).invokeGetters(null)+"." else "" ''' if(«aVarName» != null){ @@ -261,8 +261,8 @@ class VariableServiceGen { getDiffMap().put("«ai.path»«path.toAbsolutePath("/")»", «aVarName»); } ''' - } else if (a.refType.type.dataClass) { - val dataClass = (a.refType.type as DataClass) + } else if (a.type.type.dataClass) { + val dataClass = (a.type.type as DataClass) ''' «FOR at : dataClass.allAttributes» «genSetAttributeValues2(path.union(at), ai)» |