Commit 1f0858a7 authored by Sascha Niklas Schneiders's avatar Sascha Niklas Schneiders
Browse files

updated to MC 6.0.0

parent 1bc03b0a
Pipeline #214395 failed with stage
in 3 minutes and 30 seconds
......@@ -39,7 +39,7 @@
<!-- .. SE-Libraries .................................................. -->
<monticore.version>5.3.0</monticore.version>
<monticore.version>6.0.0</monticore.version>
<se-commons.version>1.7.7</se-commons.version>
<mc.grammars.assembly.version>0.0.8</mc.grammars.assembly.version>
<languages.version>4.0.1-SNAPSHOT</languages.version>
......@@ -53,7 +53,7 @@
<jscience.version>4.3.1</jscience.version>
<jsr305.version>3.0.0</jsr305.version>
<!-- .. Plugins ....................................................... -->
<monticore.plugin>5.3.0</monticore.plugin>
<monticore.plugin>6.0.0</monticore.plugin>
<assembly.plugin>2.5.4</assembly.plugin>
<compiler.plugin>3.3</compiler.plugin>
<source.plugin>2.4</source.plugin>
......
......@@ -42,13 +42,13 @@ public class ComponentWithTypeParametersHasInstance
*/
@Override
public void check(ASTEMAComponent node) {
EMAComponentSymbol emaComponentSymbol = (EMAComponentSymbol) node.getSymbolOpt().get();
EMAComponentSymbol emaComponentSymbol = (EMAComponentSymbol) node.getSymbol();
Collection<EMAComponentInstantiationSymbol> subComponents = emaComponentSymbol.getSubComponents();
Set<EMAComponentSymbol> instantiatedInnerComponents = subComponents
.stream()
.map(instanceSymbol -> instanceSymbol.getComponentType().getReferencedSymbol())
.map(instanceSymbol -> instanceSymbol.getComponentType().getLoadedSymbol())
.filter(symbol -> symbol.hasFormalTypeParameters())
.collect(Collectors.toSet());
......
......@@ -39,7 +39,7 @@ public class ConnectorEndPointCorrectlyQualified
private void checkEndpointCorrectlyQualified(ASTQualifiedNameWithArray name,
Predicate<Integer> predicate, String errorMessage) {
int i = 0;
if (name.getCompNameOpt().isPresent())
if (name.isPresentCompName())
++i;
if (name.getPortName() != null)
++i;
......@@ -62,10 +62,10 @@ public class ConnectorEndPointCorrectlyQualified
*/
@Override
public void check(ASTEMAConnector node) {
if (node.getSourceOpt().isPresent()) {
if (node.isPresentSource()) {
checkEndPointMaximallyTwiceQualified(node.getSource().getQualifiedNameWithArray());
} else {
if (!node.getUnitNumberResolutionOpt().isPresent() && !node.getBoolLiteralOpt().isPresent())
if (!node.isPresentUnitNumberResolution() && !node.isPresentBoolLiteral())
Log.error("Error Connector has no valid source or constant " + node.toString());
}
......
......@@ -47,10 +47,10 @@ public class DefaultParametersHaveCorrectOrder
for (ASTParameter param : params) {
if (!foundDefaultParameter) {
foundDefaultParameter = param.getDefaultValueOpt().isPresent();
foundDefaultParameter = param.isPresentDefaultValue();
}
else {
if (foundDefaultParameter && !param.getDefaultValueOpt().isPresent()) {
if (foundDefaultParameter && !param.isPresentDefaultValue()) {
Log.error("0xAC005 There are non default parameters after a default parameter",
node.get_SourcePositionStart());
}
......
......@@ -32,7 +32,7 @@ public class InRosPortRosSender implements EmbeddedMontiArcASTEMAComponentCoCo {
//TODO IMPLEMENT ME!F
@Override
public void check(ASTEMAComponent node) {
EMAComponentSymbol symbol = node.getSymbolOpt().orElse(null);
EMAComponentSymbol symbol = node.isPresentSymbol()?node.getSymbol():(null);
if (symbol != null) {
check(symbol);
}
......
......@@ -29,7 +29,7 @@ public class OnlyIncomingPortIsConfig implements EmbeddedMontiArcASTEMAPortCoCo
@Override
public void check(ASTEMAPort node) {
EMAPortSymbol symbol = node.getSymbolOpt().orElse(null);
EMAPortSymbol symbol = node.isPresentSymbol()?node.getSymbol():(null);
if (symbol == null)
return;
check((EMAPortSymbol) symbol);
......
......@@ -63,7 +63,7 @@ public class PortUsage implements EmbeddedMontiArcASTEMAComponentCoCo {
@Override
public void check(ASTEMAComponent node) {
EMAComponentSymbol entry = (EMAComponentSymbol) node.getSymbolOpt().get();
EMAComponentSymbol entry = (EMAComponentSymbol) node.getSymbol();
// %%%%%%%%%%%%%%%% CV5 %%%%%%%%%%%%%%%%
if (entry.isDecomposed()) {
......@@ -75,13 +75,13 @@ public class PortUsage implements EmbeddedMontiArcASTEMAComponentCoCo {
Collection<String> remainingPorts = getNames(entry.getIncomingPorts());
Collection<String> connectorSources =
getSourceNames(entry.getAstNode().get().getConnectors());
getSourceNames(entry.getAstNode().getConnectors());
if (entry.isInnerComponent()) {
// ports not connected by the inner component itself might be connected from the parent
// component or any of the parent's subcomponents' simple connectors
EMAComponentSymbol componentUsingSubComp =
(EMAComponentSymbol) entry.getEnclosingScope().getSpanningSymbol().get();
(EMAComponentSymbol) entry.getEnclosingScope().getSpanningSymbol();
connectorSources.addAll(getSourceNames(componentUsingSubComp.getConnectors()));
}
......
......@@ -24,12 +24,8 @@ import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._ast.ASTEMAComponent;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._cocos.EmbeddedMontiArcASTEMAComponentCoCo;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.EMAComponentInstantiationSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.EMAComponentSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.EMAComponentSymbolReference;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.EMAPortSymbol;
import de.se_rwth.commons.logging.Log;
import java.util.Optional;
/**
* Implementation of R7
*
......@@ -45,7 +41,7 @@ public class SimpleConnectorSourceExists implements EmbeddedMontiArcASTEMACompon
*/
@Override
public void check(ASTEMAComponent node) {
EMAComponentSymbol symbol = (EMAComponentSymbol) node.getSymbolOpt().orElse(null);
EMAComponentSymbol symbol = node.isPresentSymbol()?node.getSymbol():(null);
if (null == symbol) {
Log.error(String.format("0x9AF6C ASTEMAComponent node \"%s\" has no symbol. Did you forget to "
......@@ -57,7 +53,7 @@ public class SimpleConnectorSourceExists implements EmbeddedMontiArcASTEMACompon
//TODO IMPLEMENT ME!
/*for (ASTEMAConnector emaConnectorSymbol : instanceSymbol.getSimpleConnectors()) {
EMAComponentSymbolReference typeReference = instanceSymbol.getComponentType();
EMAComponentSymbolLoader typeReference = instanceSymbol.getComponentType();
if (!typeReference.existsReferencedSymbol()) {
Log.error(String.format("0xBEA8B The component type \"%s\" can't be resolved.",
......@@ -65,7 +61,7 @@ public class SimpleConnectorSourceExists implements EmbeddedMontiArcASTEMACompon
return;
}
EMAComponentSymbol sourceComponent = typeReference.getReferencedSymbol();
EMAComponentSymbol sourceComponent = typeReference.getLoadedSymbol();
String sourcePort = emaConnectorSymbol.getSource();
Optional<EMAPortSymbol> outgoingPort = sourceComponent.getOutgoingPort(sourcePort);
......
......@@ -48,14 +48,14 @@ public class SourceTargetNumberMatch implements EmbeddedMontiArcASTEMAConnectorC
private int getSourceNum(ASTEMAConnector node){
int sourceNum = 0, sourceComp = 0, sourcePort = 0;
if (node.getSourceOpt().isPresent()) {
if (node.isPresentSource()) {
ASTQualifiedNameWithArray source = node.getSource().getQualifiedNameWithArray();
if (source.getCompArrayOpt().isPresent()){
if (source.getCompArray().getLowerboundOpt().isPresent())
if (source.isPresentCompArray()){
if (source.getCompArray().isPresentLowerbound())
sourceComp = source.getCompArray().getUpperbound().getNumber().get().intValue() - source.getCompArray().getLowerbound().getNumber().get().intValue() + 1;
}else sourceComp = 1;
if (source.getPortArrayOpt().isPresent()){
if (source.getPortArray().getLowerboundOpt().isPresent())
if (source.isPresentPortArray()){
if (source.getPortArray().isPresentLowerbound())
sourcePort = source.getPortArray().getUpperbound().getNumber().get().intValue() - source.getPortArray().getLowerbound().getNumber().get().intValue() + 1;
}else sourcePort = 1;
sourceNum = sourceComp * sourcePort;
......@@ -65,12 +65,12 @@ public class SourceTargetNumberMatch implements EmbeddedMontiArcASTEMAConnectorC
private int getTargetNum(ASTQualifiedNameWithArray target){
int targetNum = 0, targetComp = 0, targetPort = 0;
if (target.getCompArrayOpt().isPresent()){
if (target.getCompArray().getLowerboundOpt().isPresent())
if (target.isPresentCompArray()){
if (target.getCompArray().isPresentLowerbound())
targetComp = target.getCompArray().getUpperbound().getNumber().get().intValue() - target.getCompArray().getLowerbound().getNumber().get().intValue() + 1;
}else targetComp = 1;
if (target.getPortArrayOpt().isPresent()){
if (target.getPortArray().getLowerboundOpt().isPresent())
if (target.isPresentPortArray()){
if (target.getPortArray().isPresentLowerbound())
targetPort = target.getPortArray().getUpperbound().getNumber().get().intValue() - target.getPortArray().getLowerbound().getNumber().get().intValue() + 1;
}else targetPort = 1;
targetNum = targetComp * targetPort;
......
......@@ -62,7 +62,7 @@ public class SubComponentsConnected implements EmbeddedMontiArcASTEMAComponentCo
@Override
public void check(ASTEMAComponent node) {
EMAComponentSymbol entry = (EMAComponentSymbol) node.getSymbolOpt().get();
EMAComponentSymbol entry = (EMAComponentSymbol) node.getSymbol();
// Implemented on the symTab as it takes auto-instantiation into account which is not reflected
// in the AST.
for (EMAComponentInstantiationSymbol sub : entry.getSubComponents()) {
......@@ -73,7 +73,7 @@ public class SubComponentsConnected implements EmbeddedMontiArcASTEMAComponentCo
// connectors with sub.in as target occur in outer.connectors or as
// outer.AnySub.simpleconnectors
Collection<String> remainingSubIn = getNames(sub.getComponentType().getIncomingPorts());
Collection<String> remainingSubIn = getNames(sub.getComponentType().getLoadedSymbol().getIncomingPorts());
// Connectors in the outer context always refer to the ports in a relative-qualified way (e.g.
// sub.portX) and hence we must prefix the remaining ones with sub's name to compare sets of
// relative-qualified names
......@@ -112,7 +112,7 @@ public class SubComponentsConnected implements EmbeddedMontiArcASTEMAComponentCo
// sub.out->outer.AnySub.in
// connectors with sub.out as source occur as outer.connectors or
// outer.AnySub.simpleConnectors
Collection<String> remainingSubOut = getNames(sub.getComponentType().getOutgoingPorts());
Collection<String> remainingSubOut = getNames(sub.getComponentType().getLoadedSymbol().getOutgoingPorts());
// Connectors in the outer context always refer to the ports in a relative-qualified way (e.g.
// sub.portX) and hence we must prefix the remaining ones with sub's name to compare sets of
// relative-qualified names
......@@ -140,7 +140,7 @@ public class SubComponentsConnected implements EmbeddedMontiArcASTEMAComponentCo
String relativePortName) {
String[] tmp = relativePortName.split("\\.");
String shortName = tmp[tmp.length - 1];
EMAComponentSymbol comp = instanceSymbol.getComponentType().getReferencedSymbol();
EMAComponentSymbol comp = instanceSymbol.getComponentType().getLoadedSymbol();
EMAPortSymbol port = comp.getIncomingPort(shortName).orElse(null);
return port == null ? false : port.isConfig();
}
......
......@@ -35,7 +35,7 @@ public class TopLevelComponentHasNoInstanceName
*/
@Override
public void check(ASTEMAComponent node) {
if (!node.getSymbolOpt().isPresent()) {
if (!node.isPresentSymbol()) {
Log.error(String.format(
"0xE51E8 Symbol of component \"%s\" is missing. " +
"The context condition \"%s\" can't be checked that way.",
......
......@@ -39,12 +39,12 @@ public class TypeParameterNamesUnique implements EmbeddedMontiArcASTEMAComponent
*/
@Override
public void check(ASTEMAComponent node) {
if (node.getGenericTypeParametersOpt().isPresent()) {
ASTTypeParameters2 typeParameters = node.getGenericTypeParametersOpt().get();
if (node.isPresentGenericTypeParameters()) {
ASTTypeParameters2 typeParameters = node.getGenericTypeParameters();
List<String> typeParameterNames = new ArrayList<>();
for (ASTTypeVariableDeclaration2 typeParameter : typeParameters.getTypeVariableDeclaration2List()) {
if (typeParameter.getNamingResolutionOpt().isPresent() && typeParameterNames.contains(typeParameter.getNamingResolution().getName())) {
if (typeParameter.isPresentNamingResolution() && typeParameterNames.contains(typeParameter.getNamingResolution().getName())) {
Log.error(String.format(
"0x35F1A The formal type parameter name \"%s\" is not unique",
typeParameter.getNamingResolution().getName()), typeParameter.get_SourcePositionStart());
......
......@@ -46,15 +46,15 @@ public class UniquePorts implements EmbeddedMontiArcASTInterfaceCoCo {
List<String> usedNames = new ArrayList<>();
for (ASTEMAPort port : node.getPortsList()) {
String name = "";
if (port.getNameOpt().isPresent()) {
name = port.getNameOpt().get();
if (port.isPresentName()) {
name = port.getName();
}
else {
// calc implicit name
String implicitName = ArcTypePrinter.printType(port.getType());
// TODO use symTab
// EMAPortSymbol entry = ((EMAPortSymbol) port.getSymbolOpt().get());
// String implicitName = entry.getTypeReference().getReferencedSymbol().getName();
// EMAPortSymbol entry = ((EMAPortSymbol) port.getSymbol());
// String implicitName = entry.getTypeReference().getLoadedSymbol().getName();
name = StringTransformations.uncapitalize(implicitName);
}
if (usedNames.contains(name)) {
......
......@@ -42,9 +42,9 @@ public class ASTEMAComponent extends ASTEMAComponentTOP {
public ASTEMAComponent(String name, Optional<ASTTypeParameters2> genericTypeParameters, List<ASTParameter> parameters, Optional<ASTReferenceType> superComponent, ASTEMAComponentBody body, boolean r__interface) {
setName(name);
setGenericTypeParametersOpt(genericTypeParameters);
setGenericTypeParameters(genericTypeParameters.orElse(null));
setParameterList(parameters);
setSuperComponentOpt(superComponent);
setSuperComponent(superComponent.orElse(null));
setBody(body);
setInterface(r__interface);
}
......
......@@ -22,9 +22,8 @@ package de.monticore.lang.embeddedmontiarc.embeddedmontiarc._ast;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._parser.EmbeddedMontiArcParser;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.EMAComponentInstantiationSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.EMAComponentInstantiationSymbolReference;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.EMAPortSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.EMAPortSymbolReference;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.EMAPortSymbolLoader;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.IEmbeddedMontiArcScope;
import de.monticore.lang.monticar.common2._ast.ASTQualifiedNameWithArray;
import de.monticore.lang.monticar.resolutions._ast.ASTUnitNumberResolution;
......@@ -53,18 +52,18 @@ public class ASTEMAConnector extends ASTEMAConnectorTOP {
setSource(connector.source.get());
if(connector.boolLiteral.isPresent())
setBoolLiteral(connector.boolLiteral.get());
setStringLiteralOpt(connector.stringLiteral);
setUnitNumberResolutionOpt(connector.unitNumberResolution);
setStringLiteral(connector.stringLiteral.orElse(null));
setUnitNumberResolution(connector.unitNumberResolution.orElse(null));
setTargets(connector.targets);
}
public ASTEMAConnector(Optional<ASTQualifiedNameWithArrayAndStar> source,
Optional<ASTBooleanLiteral> boolLiteral, Optional<ASTStringLiteral> stringLiteral,
Optional<ASTUnitNumberResolution> unitNumberResolution, ASTConnectorTargets targets) {
setSourceOpt(source);
setBoolLiteralOpt(boolLiteral);
setStringLiteralOpt(stringLiteral);
setUnitNumberResolutionOpt(unitNumberResolution);
setSource(source.orElse(null));
setBoolLiteral(boolLiteral.orElse(null));
setStringLiteral(stringLiteral.orElse(null));
setUnitNumberResolution(unitNumberResolution.orElse(null));
setTargets(targets);
}
......@@ -90,11 +89,11 @@ public class ASTEMAConnector extends ASTEMAConnectorTOP {
List<EMAPortSymbol> emaPortSymbols = new ArrayList<>();
for (ASTQualifiedNameWithArrayAndStar astQualifiedNameWithArrayAndStar :
targets.getQualifiedNameWithArrayAndStarList()) {
EMAPortSymbolReference emaPortSymbolReference =
new EMAPortSymbolReference(astQualifiedNameWithArrayAndStar.getQualifedNameAsString(true),
EMAPortSymbolLoader emaPortSymbolReference =
new EMAPortSymbolLoader(astQualifiedNameWithArrayAndStar.getQualifedNameAsString(true),
definingScope);
if (emaPortSymbolReference.existsReferencedSymbol()) {
emaPortSymbols.add(emaPortSymbolReference.getReferencedSymbol());
if (emaPortSymbolReference.isSymbolLoaded()) {
emaPortSymbols.add(emaPortSymbolReference.getLoadedSymbol());
}
}
return emaPortSymbols;
......
......@@ -34,7 +34,7 @@ public class ASTQualifiedNameWithArrayAndStar extends ASTQualifiedNameWithArrayA
public ASTQualifiedNameWithArrayAndStar(ASTQualifiedNameWithArray qualifiedNameWithArray,
Optional<ASTDotStar> dotStar) {
setQualifiedNameWithArray(qualifiedNameWithArray);
setDotStarOpt(dotStar);
setDotStar(dotStar.orElse(null));
}
/**
......
......@@ -163,7 +163,7 @@ public class EMAComponentBuilder {
public static EMAComponentBuilder addFormalTypeParameter(EMAComponentSymbol cs,
ResolvedTypeSymbol formalTypeParameter) {
if (!formalTypeParameter.getAstNode().get().isFormalTypeParameter()) {
if (!formalTypeParameter.getAstNode().isFormalTypeParameter()) {
//TODO IMPLEMENT ME!F
//Log.error(String.format("%s is not a formal type parameter. ResolvedTypeSymbol#isFormalTypeParameter() is false.",
// SymbolPrinter.printFormalTypeParameters(formalTypeParameter)));
......
......@@ -53,7 +53,7 @@ public class EMAComponentInstantiationGenericTypeReplacer implements EmbeddedMon
@Override
public void endVisit(ASTUnitNumberResolution resolutionType){
if(resolutionType.getNameOpt().isPresent() && resolutionType.getName().equals(currentGenericReplacement.getName())){
if(resolutionType.isPresentName() && resolutionType.getName().equals(currentGenericReplacement.getName())){
currentPortSymbol.setTypeReference(currentGenericReplacement.getNewType());
}
handled = true;
......
......@@ -20,7 +20,6 @@
*/
package de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable;
import de.monticore.ast.ASTCNode;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._ast.ASTEMAConnector;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc.types.EMAVariable;
import de.monticore.lang.embeddedmontiarc.helper.SymbolPrinter;
......@@ -29,7 +28,6 @@ import de.monticore.lang.monticar.resolutions._ast.ASTUnitNumberResolution;
import de.se_rwth.commons.logging.Log;
import external1.expressionsbasis._ast.ASTExpression;
import external1.types._ast.ASTType;
import java.util.*;
import java.util.stream.Collectors;
......@@ -52,7 +50,7 @@ import java.util.stream.Collectors;
*/
public class EMAComponentInstantiationSymbol extends EMAComponentInstantiationSymbolTOP {
protected EMAComponentSymbolReference type = null;
protected EMAComponentSymbolLoader type = null;
protected List<GenericReplacement> actualTypeArguments = new ArrayList<>();
protected List<ASTResolutionDeclaration> resolutionDeclarations = new ArrayList<>();//TODO IMPLEMENT ME!F Remove this?
protected List<EMAVariable> parameters = new ArrayList<>();
......@@ -67,7 +65,7 @@ public class EMAComponentInstantiationSymbol extends EMAComponentInstantiationSy
/**
* use {@link #builder()}
*/
protected EMAComponentInstantiationSymbol(String name, EMAComponentSymbolReference type) {
protected EMAComponentInstantiationSymbol(String name, EMAComponentSymbolLoader type) {
super(name);
this.type = type;
}
......@@ -93,7 +91,7 @@ public class EMAComponentInstantiationSymbol extends EMAComponentInstantiationSy
this.actualTypeArguments.add(genericReplacement);
}
public EMAComponentSymbolReference getComponentType() {
public EMAComponentSymbolLoader getComponentType() {
return type;
}
......@@ -135,7 +133,7 @@ public class EMAComponentInstantiationSymbol extends EMAComponentInstantiationSy
}
public Collection<EMAPortArraySymbol> getPortArrayList() {
return getComponentType().getReferencedSymbol().getSpannedScope().getLocalEMAPortSymbols()
return getComponentType().getLoadedSymbol().getSpannedScope().getLocalEMAPortSymbols()
.stream().
filter(x -> x.isPortArray).map(x -> (EMAPortArraySymbol) x)
.collect(Collectors.toList());
......@@ -259,13 +257,13 @@ public class EMAComponentInstantiationSymbol extends EMAComponentInstantiationSy
public int getUnitNumberResolutionSubComponents(String name) {
ASTUnitNumberResolution unitNumberResolution =
(ASTUnitNumberResolution) getSubComponents().iterator().next().getComponentType()
.getReferencedSymbol().getResolutionDeclaration(name).get().getASTResolution().get();
.getLoadedSymbol().getResolutionDeclaration(name).get().getASTResolution().get();
return unitNumberResolution.getNumber().get().intValue();
}
public List<ASTResolutionDeclaration> getResolutionDeclarationsSubComponent(String name) {
return getSubComponent(name).get().getComponentType().getReferencedSymbol()
return getSubComponent(name).get().getComponentType().getLoadedSymbol()
.getResolutionDeclarations();
}
......@@ -283,8 +281,8 @@ public class EMAComponentInstantiationSymbol extends EMAComponentInstantiationSy
}
public List<EMAVariable> getParameters() {
if (getComponentType().getReferencedSymbol().getParameters().size() != parameters.size()) {
return getComponentType().getReferencedSymbol().getParameters();
if (getComponentType().getLoadedSymbol().getParameters().size() != parameters.size()) {
return getComponentType().getLoadedSymbol().getParameters();
}
return parameters;
}
......@@ -302,11 +300,11 @@ public class EMAComponentInstantiationSymbol extends EMAComponentInstantiationSy
}
public Optional<EMAComponentSymbol> getEnclosingComponent() {
return (Optional<EMAComponentSymbol>) getEnclosingScope().getSpanningSymbol();
return Optional.ofNullable((EMAComponentSymbol) getEnclosingScope().getSpanningSymbol());
}
public Optional<EMAComponentSymbol> getParent() {
return (Optional<EMAComponentSymbol>) getEnclosingScope().getSpanningSymbol();
return Optional.ofNullable((EMAComponentSymbol)getEnclosingScope().getSpanningSymbol());
}
public void setPackageName(String packageName) {
......
......@@ -39,7 +39,7 @@ public class EMAComponentInstantiationSymbolBuilder
protected IEmbeddedMontiArcScope spannedScope = EmbeddedScopeBuilder.createSpannedScope();
protected Optional<String> name = Optional.empty();
protected Optional<EMAComponentSymbolReference> symbolReference = Optional.empty();
protected Optional<EMAComponentSymbolLoader> symbolReference = Optional.empty();
protected List<EMAPortSymbol> ports = new ArrayList<>();
protected List<EMAComponentInstantiationSymbol> subComponents = new ArrayList<>();
protected List<ASTEMAConnector> connectors = new ArrayList<>();
......@@ -105,7 +105,7 @@ public class EMAComponentInstantiationSymbolBuilder
}
public EMAComponentInstantiationSymbolBuilder setSymbolReference(
EMAComponentSymbolReference symbolReference) {
EMAComponentSymbolLoader symbolReference) {
this.symbolReference = Optional.of(symbolReference);
return this;
}
......@@ -260,10 +260,10 @@ public class EMAComponentInstantiationSymbolBuilder
/*mapTypeArguments.forEach((k, v) -> {
// 1) replace port generics
inst.getPortInstanceList().stream()
// .filter(p -> p.getTypeReference().getReferencedSymbol()
// .filter(p -> p.getTypeReference().getLoadedSymbol()
.getFullName().equals(k.getFullName()))
.filter( p -> p.getTypeReference().existsReferencedSymbol() ? p
.getTypeReference().getReferencedSymbol().getName().equals(k.getName()) : false)
.getTypeReference().getLoadedSymbol().getName().equals(k.getName()) : false)
.forEachOrdered(p -> p.setTypeReference((MCTypeReference<? extends ASTType>)
v.getType()));
......@@ -275,10 +275,10 @@ public class EMAComponentInstantiationSymbolBuilder
s.getActualTypeArguments().stream()
// replace this filtered type arguments with the value we
//want to replace
// .map(a -> a.getType().getReferencedSymbol
// .map(a -> a.getType().getLoadedSymbol
().getFullName().equals(k.getFullName()) ? v : a)
.map(a -> (a.getType().existsReferencedSymbol() ? (a.getType
().getReferencedSymbol().getName().equals(k.getName()) ? v :
().getLoadedSymbol().getName().equals(k.getName()) ? v :
a) : a))
.collect(Collectors.toList())
));
......@@ -289,7 +289,7 @@ public class EMAComponentInstantiationSymbolBuilder
// delegate generic exchanges through inner component hierarchy
inst.getSubComponents().stream().forEachOrdered(s -> {
if (s.getActualTypeArguments().size() != s.getComponentType().getFormalTypeParameters()
if (s.getActualTypeArguments().size() != s.getComponentType().getLoadedSymbol().getFormalTypeParameters()
.size()) {
/*Log.error(String.format("instance '%s' has a subcomponent instance '%s'
where the given generics '%s' distinguish from the generics definition
......@@ -300,7 +300,7 @@ public class EMAComponentInstantiationSymbolBuilder
//TODO change this after removing everything that is related to Java/JavaDSL
} else {
Log.debug(s.getComponentType().toString(), "ComponentType");
Log.debug(s.getComponentType().getFormalTypeParameters().toString(),
Log.debug(s.getComponentType().getLoadedSymbol().getFormalTypeParameters().toString(),
"FormalTypeParameters");
//TODO IMPLEMENT ME!F
/*exchangeGenerics(s, createMap(s.getComponentType().getFormalTypeParameters(),
......@@ -367,8 +367,8 @@ public class EMAComponentInstantiationSymbolBuilder
exchangeGenerics(sym, actualTypeArguments);
sym.fixInstances();
Log.debug(
"name: " + sym.getFullName() + " enclosingScope: " + sym.getEnclosingScope().getName()
.orElse("<Missing Name>"), "EMAComponentInstantiationSymbolBuilder");
"name: " + sym.getFullName() + " enclosingScope: " + (sym.getEnclosingScope().isPresentName()?sym.getEnclosingScope().getName()
:"<Missing Name>"), "EMAComponentInstantiationSymbolBuilder");
Log.debug(SymbolPrinter.printEMAComponentInstance(sym), "Instance:");
return sym;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment