cleanup

parent 1f0858a7
Pipeline #218404 failed with stage
in 2 minutes and 14 seconds
......@@ -29,7 +29,7 @@ import de.se_rwth.commons.logging.Log;
public class InRosPortRosSender implements EmbeddedMontiArcASTEMAComponentCoCo {
//TODO IMPLEMENT ME!F
//TODO IMPLEMENT ME!D
@Override
public void check(ASTEMAComponent node) {
EMAComponentSymbol symbol = node.isPresentSymbol()?node.getSymbol():(null);
......
......@@ -46,7 +46,7 @@ public class PortUsage implements EmbeddedMontiArcASTEMAComponentCoCo {
return ports.stream().map(p -> p.getName()).collect(Collectors.toList());
}
//TODO IMPLEMENT ME!
//TODO IMPLEMENT ME!D
private Collection<String> getSourceNames(Collection<ASTEMAConnector> connectors) {
return connectors.stream().map(c -> c.getSource().getQualifedNameAsString(true)).collect(Collectors.toList());
}
......@@ -99,7 +99,7 @@ public class PortUsage implements EmbeddedMontiArcASTEMAComponentCoCo {
remainingPorts = getNames(entry.getOutgoingPorts());
Collection<String> connectorTargets = getTargetNames(entry.getConnectors());
// add simple connectors of all subcomponents that might connect the ports.
//TODO IMPLEMENT ME!
//TODO IMPLEMENT ME!D
entry.getSubComponents()
.forEach(sc -> connectorTargets.addAll(getTargetNames(sc.getConnectorInstances())));
......
......@@ -21,10 +21,14 @@
package de.monticore.lang.embeddedmontiarc.cocos;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._ast.ASTEMAComponent;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._ast.ASTEMAConnector;
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.EMAComponentSymbolLoader;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.EMAPortSymbol;
import de.se_rwth.commons.logging.Log;
import java.util.Optional;
/**
* Implementation of R7
......@@ -50,28 +54,28 @@ public class SimpleConnectorSourceExists implements EmbeddedMontiArcASTEMACompon
}
for (EMAComponentInstantiationSymbol instanceSymbol : symbol.getSubComponents()) {
//TODO IMPLEMENT ME!
/*for (ASTEMAConnector emaConnectorSymbol : instanceSymbol.getSimpleConnectors()) {
//TODO IMPLEMENT ME!D
for (ASTEMAConnector emaConnectorSymbol : instanceSymbol.getConnectors()) {
EMAComponentSymbolLoader typeReference = instanceSymbol.getComponentType();
if (!typeReference.existsReferencedSymbol()) {
if (!typeReference.isSymbolLoaded()) {
Log.error(String.format("0xBEA8B The component type \"%s\" can't be resolved.",
typeReference.getFullName()));
return;
}
EMAComponentSymbol sourceComponent = typeReference.getLoadedSymbol();
String sourcePort = emaConnectorSymbol.getSource();
String sourcePort = emaConnectorSymbol.getSource().getQualifedNameAsString(true);
Optional<EMAPortSymbol> outgoingPort = sourceComponent.getOutgoingPort(sourcePort);
if (!outgoingPort.isPresent()) {
Log.error(String.format("0xF4D71 Out port \"%s\" is not present in component \"%s\".",
sourcePort, sourceComponent.getName()),
emaConnectorSymbol.getSourcePosition());
emaConnectorSymbol.get_SourcePositionStart());
}
}*/
}
}
}
......
......@@ -121,18 +121,18 @@ public class SubComponentsConnected implements EmbeddedMontiArcASTEMAComponentCo
Collection<String> outerConnectorSources = getSourceNames(entry.getConnectors());
remainingSubOut.removeAll(outerConnectorSources);
//TODO IMPLEMENT ME!
/*if (!remainingSubOut.isEmpty()) {
//TODO IMPLEMENT ME!D
if (!remainingSubOut.isEmpty()) {
// qualified sources of simple connectors
List<Object> outerSubSimpleConnectorSources =
entry.getSubComponents().stream().flatMap(sc -> sc.getSimpleConnectors().stream()
entry.getSubComponents().stream().flatMap(sc -> sc.getConnectors().stream()
// map connector to qualified source name
.map(c -> sc.getName() + "." + c.getSource())).collect(Collectors.toList());
remainingSubOut.removeAll(outerSubSimpleConnectorSources);
if (!remainingSubOut.isEmpty()) {
remainingSubOut.forEach(p -> Log.error(String.format("0xAC009 Port %s of subcomponent " + "%s is not used!", p, sub.getFullName()), node.get_SourcePositionStart()));
}
}*/
}
}
}
......
/**
*
* ******************************************************************************
* MontiCAR Modeling Family, www.se-rwth.de
* Copyright (c) 2017, Software Engineering Group at RWTH Aachen,
* All rights reserved.
*
* This project is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this project. If not, see <http://www.gnu.org/licenses/>.
* *******************************************************************************
*/
package de.monticore.lang.embeddedmontiarc.embeddedmontiarc._ast;
import external1.types._ast.ASTReferenceType;
/**
* @author Sascha Schneiders
*/
public class ASTEMAComponentInstantiation extends ASTEMAComponentInstantiationTOP {
protected ASTReferenceType type;
public ASTReferenceType getType() {
return type;
}
public void setType(ASTReferenceType type) {
this.type = type;
}
}
......@@ -72,7 +72,6 @@ public class ASTEMAConnector extends ASTEMAConnectorTOP {
* shouldInflate to true
*/
public Collection<String> getTargetsAsString(boolean shouldInflate) {
//TODO IMPLEMENT ME!F handle shouldInflate? was handled by symbol table previously
List<String> targetNames = new ArrayList<>();
for (ASTQualifiedNameWithArrayAndStar astQualifiedNameWithArrayAndStar :
getTargets().getQualifiedNameWithArrayAndStarList()) {
......@@ -121,7 +120,7 @@ public class ASTEMAConnector extends ASTEMAConnectorTOP {
}
try {
if (name.equals(
"#")) {// TODO IMPLEMENT ME!F Evgeny was not aware of this language feature when asked and looking into the test
"#")) {// Evgeny was not aware of this language feature when asked and looking into the test
// that belongs to it, the comment in the test states that it is there to avoid a
// warning/coco that all ports have to be used in a component
targets.qualifiedNameWithArrayAndStars
......
......@@ -24,6 +24,7 @@ import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._ast.ASTEMAConnector;
import de.monticore.lang.embeddedmontiarc.helper.SymbolPrinter;
import de.monticore.lang.monticar.types2._symboltable.ITypes2Scope;
import de.se_rwth.commons.logging.Log;
import external1.types._ast.ASTType;
import external1.types._symboltable.ResolvedTypeSymbol;
import java.util.Collection;
......@@ -70,8 +71,7 @@ public class EMAComponentBuilder {
}
public static EMAComponentBuilder removePort(EMAComponentSymbol cs, EMAPortSymbol ps) {
//TODO IMPLEMENT ME!F
//((Scope) cs.getSpannedScope()).remove(ps);
(cs.getSpannedScope()).remove(ps);
return getInstance();
}
......@@ -105,24 +105,6 @@ public class EMAComponentBuilder {
return getInstance();
}
public static EMAComponentBuilder removeConnector(EMAComponentSymbol cs, ASTEMAConnector con) {
//TODO IMPLEMENT ME!F
//((Scope) cs.getSpannedScope()).remove(con);
return getInstance();
}
public static EMAComponentBuilder removeConnectors(EMAComponentSymbol cs, ASTEMAConnector... con) {
for (ASTEMAConnector c : con) {
removeConnector(cs, c);
}
return getInstance();
}
public static EMAComponentBuilder removeConnectors(EMAComponentSymbol cs, Collection<ASTEMAConnector> con) {
con.stream().forEachOrdered(c -> removeConnector(cs, c));
return getInstance();
}
////////////////////////// inner components //////////////////////////////////////////////
public static EMAComponentBuilder addInnerComponent(EMAComponentSymbol cs, EMAComponentSymbol innerComponent) {
......@@ -142,8 +124,7 @@ public class EMAComponentBuilder {
}
public static EMAComponentBuilder removeInnerComponent(EMAComponentSymbol cs, EMAComponentSymbol innerComponent) {
//TODO IMPLEMENT ME!F
//((Scope) cs.getSpannedScope()).remove(innerComponent);
( cs.getSpannedScope()).remove(innerComponent);
return getInstance();
}
......@@ -162,23 +143,22 @@ public class EMAComponentBuilder {
////////////////////////// formal type parameters //////////////////////////////////////////////
public static EMAComponentBuilder addFormalTypeParameter(EMAComponentSymbol cs,
ResolvedTypeSymbol formalTypeParameter) {
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)));
ASTType formalTypeParameter) {
if (!formalTypeParameter.isFormalTypeParameter()) {
Log.error(String.format("%s is not a formal type parameter. ResolvedTypeSymbol#isFormalTypeParameter() is false.",
SymbolPrinter.printFormalTypeParameters(formalTypeParameter)));
}
return getInstance();
}
public static EMAComponentBuilder addFormalTypeParameters(EMAComponentSymbol cs, ResolvedTypeSymbol... formalTypeParameter) {
for (ResolvedTypeSymbol f : formalTypeParameter) {
public static EMAComponentBuilder addFormalTypeParameters(EMAComponentSymbol cs, ASTType... formalTypeParameter) {
for (ASTType f : formalTypeParameter) {
addFormalTypeParameter(cs, f);
}
return getInstance();
}
public static EMAComponentBuilder addFormalTypeParameters(EMAComponentSymbol cs, Collection<ResolvedTypeSymbol> formalTypeParameter) {
public static EMAComponentBuilder addFormalTypeParameters(EMAComponentSymbol cs, Collection<ASTType> formalTypeParameter) {
formalTypeParameter.stream().forEachOrdered(f -> addFormalTypeParameter(cs, f));
return getInstance();
}
......
......@@ -58,5 +58,5 @@ public class EMAComponentInstantiationGenericTypeReplacer implements EmbeddedMon
}
handled = true;
}
//TODO IMPLEMENT ME!F Handle other cases
//TODO Handle other cases if required
}
......@@ -52,7 +52,7 @@ public class EMAComponentInstantiationSymbol extends EMAComponentInstantiationSy
protected EMAComponentSymbolLoader type = null;
protected List<GenericReplacement> actualTypeArguments = new ArrayList<>();
protected List<ASTResolutionDeclaration> resolutionDeclarations = new ArrayList<>();//TODO IMPLEMENT ME!F Remove this?
protected List<ASTResolutionDeclaration> resolutionDeclarations = new ArrayList<>();
protected List<EMAVariable> parameters = new ArrayList<>();
protected List<ASTExpression> arguments = new ArrayList<>();
protected List<ASTEMAConnector> connectors = new ArrayList<>();
......@@ -188,6 +188,22 @@ public class EMAComponentInstantiationSymbol extends EMAComponentInstantiationSy
return connectors;
}
/**
* @param target target of the connector to get
* @return a connector with the given target, absent optional, if it does not exist
*/
public Optional<ASTEMAConnector> getConnector(String target) {
// no check for reference required
for (ASTEMAConnector con : getConnectors()) {
Collection<String> targets = con.getTargetsAsString(true);
for (String connectorTarget : targets) {
if (connectorTarget.equals(target)) {
return Optional.of(con);
}
}
}
return Optional.empty();
}
public void setConnectors(
List<ASTEMAConnector> connectors) {
this.connectors = connectors;
......@@ -330,7 +346,6 @@ public class EMAComponentInstantiationSymbol extends EMAComponentInstantiationSy
for (GenericReplacement replacement : actualTypeArguments) {
Log.debug(replacement.toString(), "Replacement:");
//TODO IMPLEMENT ME!F
for (EMAPortArraySymbol portArraySymbol : getPortArrayList()) {
Log.debug("port array to fix size " + portArraySymbol.getName() +
"nameSizeDependsOn: " + portArraySymbol.getNameSizeDependsOn(), "FixInstances:");
......
......@@ -158,12 +158,10 @@ public class EMAComponentInstantiationSymbolBuilder
Collection<EMAPortSymbol> ports, List<ASTType> formalTypeParameters,
List<ASTType> actualTypeArguments) {
List<EMAPortSymbol> pList = ports.stream().collect(Collectors.toList());
//TODO IMPLEMENT ME!D
createMap(formalTypeParameters, actualTypeArguments).forEach((k, v) ->
ports.stream().filter(p -> p.getTypeReference().equals(k))
.forEachOrdered(p -> {
EMAPortSymbol pCloned = EMAPortBuilder.clone(p);
//TODO IMPLEMENT ME!F
pCloned.setTypeReference(v);
Collections.replaceAll(pList, p, pCloned);
})
......@@ -242,7 +240,7 @@ public class EMAComponentInstantiationSymbolBuilder
return this;
}
//TODO IMPLEMENT ME!F Replace Map with List of <new class> that contains replacement mappings like t -> B or N1 n -> N1 n = 6
//Would be better to replace Map with List of <new class> that contains replacement mappings like t -> B or N1 n -> N1 n = 6
protected void exchangeGenerics(EMAComponentInstantiationSymbol inst,
List<GenericReplacement> mapTypeArguments) {
Log.debug("amount of observed generic parameters: " + inst.getGenericParameters().size(),
......@@ -302,7 +300,7 @@ public class EMAComponentInstantiationSymbolBuilder
Log.debug(s.getComponentType().toString(), "ComponentType");
Log.debug(s.getComponentType().getLoadedSymbol().getFormalTypeParameters().toString(),
"FormalTypeParameters");
//TODO IMPLEMENT ME!F
//ActualTypeArguments do not exist anymore
/*exchangeGenerics(s, createMap(s.getComponentType().getFormalTypeParameters(),
s.getActualTypeArguments()));*/
......
......@@ -80,7 +80,7 @@ public class EMAConnectorBuilder {
con.addTargets(this.targets);
}
if (portSymbol.orElse(null) != null) {
//TODO IMPLEMENT ME!D
//only needed if constant ports are to be handed separately in connector
//con.setConstantPortSymbol(portSymbol.get());
}
return con;
......@@ -88,7 +88,6 @@ public class EMAConnectorBuilder {
Log.error("not all parameters have been set before to build the connector symbol");
throw new Error("not all parameters have been set before to build the connector symbol");
}
//TODO IMPLEMENT ME!F
public EMAConnectorBuilder setConstantPortSymbol(EMAPortSymbol portSymbol) {
this.portSymbol = Optional.of(portSymbol);
......@@ -97,7 +96,7 @@ public class EMAConnectorBuilder {
public static ASTEMAConnector instantiate(ASTEMAConnector connector, IEmbeddedMontiArcScope definingScope) {
ASTEMAConnector connectorInstance = new ASTEMAConnector(connector);
//connectorInstance.setIsConstantConnector(connector.isConstant);//TODO IMPLEMENT ME!F
//connectorInstance.setIsConstantConnector(connector.isConstant);//TODO reenable if connector has to be explicitly marked as constant
//connectorInstance.setConstantEMAPortSymbol(connector.constantEmaPortSymbol);
connectorInstance.setDefiningScope(definingScope);
return connectorInstance;
......
......@@ -390,10 +390,6 @@ public class EMAPortHelper {
List<String> sourceNames = getPortName(node.getSource(), symbolTableCreator);
Log.info("" + sourceNames.size(), "SourcePorts");
int counter = 0, targetnum = 0;
/*for(ASTQualifiedNameWithArrayAndStar target :
node.getTargets().getQualifiedNameWithArrayAndStarList()){
Log.debug(target.getQualifedNameAsString(true), "TTTArget");
}*/
for (ASTQualifiedNameWithArrayAndStar target :
node.getTargets().getQualifiedNameWithArrayAndStarList()) {
counter = 0;
......@@ -414,11 +410,9 @@ public class EMAPortHelper {
EMAComponentSymbol emaComponentSymbol = symbolTableCreator.componentStack.peek();
emaComponentSymbol.addConnector(connector);
connector.setDefiningScope(emaComponentSymbol.getSpannedScope());
//TODO IMPLEMENT ME!D Should not be needed anymore
//symbolTableCreator.addToScopeAndLinkWithNode(sym, node);
++counter;
}else{
//Log.error("TODO IMPLEMENT ME!");//TODO IMPLEMENT ME!F This should not be an issue if everything else is handled correctly
//Log.error("TODO IMPLEMENT ME!");//This should not be an issue if everything else is handled correctly
}
}
// TODO enable checking again if it is fixed
......
......@@ -42,7 +42,7 @@ import java.util.stream.Collectors;
*/
public class EMAPortSymbol extends EMAPortSymbolTOP implements EMAElementSymbol {
EMAComponentInstantiationSymbolLoader reference; //TODO IMPLEMENT ME!F set this in symbol
EMAComponentInstantiationSymbolLoader reference;
// table creator!
/**
* Maps direction incoming to true.
......@@ -56,9 +56,6 @@ public class EMAPortSymbol extends EMAPortSymbolTOP implements EMAElementSymbol
private boolean config = false;
//TODO IMPLEMENT ME!D
//private ASTType typeReference;
protected ASTType typeReference;
private IStreamScope locallyDefinedStreams = new StreamScope();
......@@ -162,7 +159,7 @@ public class EMAPortSymbol extends EMAPortSymbolTOP implements EMAElementSymbol
final Collection<NamedStreamSymbol> allStreams = new ArrayList<>();
allStreams.addAll(locallyDefinedStreams.getNamedStreamSymbols().values());
//TODO IMPLEMENT ME!F Streams
//TODO IMPLEMENT ME!F Streams cannot be handled this way anymore
/*allStreams.addAll(this.getEnclosingScope().resolveMany(
this.getFullName(), NamedStreamSymbol.KIND));*/
return allStreams.stream().sorted((e1, e2) -> {
......@@ -261,7 +258,7 @@ public class EMAPortSymbol extends EMAPortSymbolTOP implements EMAElementSymbol
} else if (this.isIncoming()) {
// If the port is incoming then return outgoing ports of connected components
topComponent.getConnectorInstances().stream().filter(s -> s.getTargetPortSymbols().equals(
this)) //TODO IMPLEMENT ME!F is always false as ConnectorSymbol only allowed one to one connections
this)) //is always false as ConnectorSymbol only allowed one to one connections
.forEach(s -> targetPorts.add(s.getSourcePort()));
}
}
......
......@@ -108,12 +108,6 @@ public class EmbeddedMontiArcModelLoader extends EmbeddedMontiArcModelLoaderTOP
protected IEmbeddedMontiArcScope createSymTab(ModelPath modelPath, String mainComponent,
String mainInstantiation) {
//TODO IMPLEMENT ME!F
/*ModelingLanguageFamily fam = new ModelingLanguageFamily();
fam.addModelingLanguage(new EmbeddedMontiArcLanguage());
fam.addModelingLanguage(new StreamLanguage());
fam.addModelingLanguage(new StructLanguage());*/
IEmbeddedMontiArcGlobalScope scope = new EmbeddedMontiArcGlobalScope(modelPath,
new EmbeddedMontiArcLanguage());
......
......@@ -59,8 +59,6 @@ public class EmbeddedMontiArcSymbolTableCreator extends EmbeddedMontiArcSymbolTa
public Stack<EMAComponentSymbol> componentStack = new Stack<>();
public List<ImportStatement> currentImports = new ArrayList<>();
//TODO IMPLEMENT ME!F
//protected MontiCarSymbolFactory jSymbolFactory = new MontiCarSymbolFactory();
public boolean aboartVisitComponent = false;
......@@ -184,10 +182,6 @@ public class EmbeddedMontiArcSymbolTableCreator extends EmbeddedMontiArcSymbolTa
Log.debug(component.toString(), "ComponentPreGeneric");
// generic type parameters
if (node.isPresentGenericTypeParameters()) {
//TODO IMPLEMENT ME!F
/*EMAJavaHelper.addTypeParametersToType(component, node.getGenericTypeParametersOpt()
.get(),
getCurrentScope().get());*/
for (ASTTypeVariableDeclaration2 variableDeclaration : node.getGenericTypeParameters()
.getTypeVariableDeclaration2List()) {
if (variableDeclaration.isPresentResolutionDeclaration()) {
......@@ -218,9 +212,6 @@ public class EmbeddedMontiArcSymbolTableCreator extends EmbeddedMontiArcSymbolTa
EMAComponentSymbolLoader ref = new EMAComponentSymbolLoader(superCompName,
getCurrentScope().get());
// actual type arguments
//TODO IMPLEMENT ME!F
//addTypeArgumentsToTypeSymbol(ref, superCompRef, this);
component.setSuperComponent(Optional.of(ref));
}
......@@ -303,22 +294,14 @@ public class EmbeddedMontiArcSymbolTableCreator extends EmbeddedMontiArcSymbolTa
//componentTypeReference = new EMAComponentSymbolLoader(getCompilationUnitPackage()+ " " + referencedCompName, encScope, this);
}
// set actual Resolution values
//TODO IMPLEMENT ME!F
//setActualResolutionDeclaration(node, componentTypeReference);
// actual type arguments
// TODO enable if needed
//TODO IMPLEMENT ME!F
//addTypeArgumentsToTypeSymbol(componentTypeReference, node.getType(), this);
// ref.setPackageName(refCompPackage);
// TODO internal representation of ValueSymbol ? that was heavily based on CommonValues
// language and its expressions, but we use JavaDSL.
//TODO IMPLEMENT ME!F
/* for (ASTExpression arg : node.getArguments()) { String value = new JavaDSLPrettyPrinter(new
* IndentPrinter()).prettyprint(arg); value = value.replace("\"", "\\\"").replace("\n", "");
* configArgs.add(new ValueSymbol<>(value, Kind.Expression)); } */
for (ASTExpression astExpression : node.getArgumentsList()) {
componentTypeReference.addArgument(astExpression);
}
......@@ -330,6 +313,7 @@ public class EmbeddedMontiArcSymbolTableCreator extends EmbeddedMontiArcSymbolTa
if (!node.getInstancesList().isEmpty()) {
// create instances of the referenced components.
for (ASTEMAComponentInstantiation i : node.getInstancesList()) {
i.setType(node.getType());
// For generic type resolution Example: <N1 n=4> with instance being <6> to change value of
// n accordingly
//TODO IMPLEMENT ME!D
......
......@@ -73,35 +73,6 @@ public class EmbeddedMontiArcSymbolTableHelper {
"SubComponentResolution Number:");
}
}
//TODO IMPLEMENT ME!F
/*
public static void setActualResolutionDeclaration(ASTSubComponent node,
EMAComponentSymbolLoader
emaComponentSymbolReference) {
int index = 0;
int size = EMAPortHelper.handleSizeResolution(node, index);
if (size > 0 && emaComponentSymbolReference.getResolutionDeclarations().size() > 0) {
if (emaComponentSymbolReference.getResolutionDeclarations().get(index)
.getASTResolution() instanceof ASTUnitNumberResolution) {
Log.debug(size + "", "Set new Resolution");
((ASTUnitNumberResolution) emaComponentSymbolReference.getResolutionDeclarations()
.get(index).getASTResolution()).setNumber(Double.valueOf(size));
}
} else {
for (int i = 0; i < emaComponentSymbolReference.getResolutionDeclarations().size();
++i) {
Rational numberToSetTo = doubleToRational(((ASTUnitNumberResolution)
emaComponentSymbolReference
.getLoadedSymbol().getResolutionDeclarations().get(i)
.getASTResolution())
.getNumber().get());
((ASTUnitNumberResolution) emaComponentSymbolReference.getResolutionDeclarations
().get(i)
.getASTResolution()).setNumber(numberToSetTo.doubleValue());
}
}
}*/
public static void createInstance(String name, ASTSubComponent node,
ASTEMAComponentInstantiation astemaComponentInstantiation,
......@@ -112,7 +83,7 @@ public class EmbeddedMontiArcSymbolTableHelper {
.getSpannedScope();
EMAComponentInstantiationSymbol instance = symbolTableCreator.instanceSymbolCreator.
createInstances(componentTypeReference.getLoadedSymbol(), name, configArguments,
enclosingScope);//TODO IMPLEMENT ME! If problem with values reference might be required here instead of symbol
enclosingScope);
if (instance != null) {
instance.setArguments(componentTypeReference.getArguments());
symbolTableCreator.setLinkBetweenSymbolAndNode(instance, astemaComponentInstantiation);
......@@ -166,18 +137,16 @@ public class EmbeddedMontiArcSymbolTableHelper {
for (ASTEMAConnector connector : componentTypeReference.getLoadedSymbol().getConnectors()) {
instance.addConnector(EMAConnectorBuilder.instantiate(connector, instance.getSpannedScope()));
}
//TODO IMPLEMENT ME!F
for (GenericReplacement replacement : configArguments) {
instance.addActualTypeArgument(replacement);
}
// create a subscope for the instance
//TODO IMPLEMENT ME!F Done below! UnComment
//symbolTableCreator.addToScopeAndLinkWithNode(instance, astemaComponentInstantiation);
symbolTableCreator.setLinkBetweenSymbolAndNode(instance, astemaComponentInstantiation);
Log.debug(symbolTableCreator.getCurrentScope().get().toString(), "SubComponentInstance Scope");
// remove the created instance's scope
//symbolTableCreator.removeCurrentEmbeddedMontiArcScope(); //TODO IMPLEMENT ME! check if this is needed
//symbolTableCreator.removeCurrentEmbeddedMontiArcScope();
InstanceInformation instanceInformation = new InstanceInformation();
instanceInformation.setCompName(name);
instanceInformation.setASTSubComponent(node);
......@@ -238,22 +207,6 @@ public class EmbeddedMontiArcSymbolTableHelper {
Log.debug(astParameter.toString(), "ASTParam");
int dimension = TypesHelper.getArrayDimensionIfArrayOrZero(astParameter.getType());
// TODO enable if needed and remove line below
//TODO IMPLEMENT ME!F
/*ResolvedTypeSymbolReference paramTypeSymbol = new MontiCarTypeSymbolReference(
TypesPrinter.printTypeWithoutTypeArgumentsAndDimension(astParameter
.getType()),
symbolTableCreator.currentScope().get(), dimension);
EMATypeHelper.addTypeArgumentsToTypeSymbol(paramTypeSymbol, astParameter.getType(),
symbolTableCreator);
final MCFieldSymbol parameterSymbol = symbolTableCreator.
jSymbolFactory.createFormalParameterSymbol(paramName,
(MontiCarTypeSymbolReference) paramTypeSymbol);
emaComponentSymbol.addConfigParameter(parameterSymbol);
*/
emaComponentSymbol.addParameter(astParameter);
if (astParameter.isPresentAdaptableKeyword()) {
......@@ -287,7 +240,6 @@ public class EmbeddedMontiArcSymbolTableHelper {
return symbolTableCreator.autoInstantiate && (instanceNameGiven || autoCreationPossible);
}
//TODO IMPLEMENT ME!F Replace with visitor to avoid instanceof
public static ASTType calcTypeRef(ASTType astType) {
if (astType instanceof ASTUnitNumberResolution) {
ASTUnitNumberResolution node = (ASTUnitNumberResolution) astType;
......
......@@ -20,7 +20,7 @@
*/
package de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable;
//TODO IMPLEMENT ME! replace with mill overwriting
//TODO IMPLEMENT ME!F replace with mill overwriting
public class EmbeddedScopeBuilder {
public static EmbeddedScopeBuilder instance = null;
......
......@@ -84,7 +84,6 @@ public class GenericsReplacementCalculator implements ResolutionsVisitor, Ranges
//replacement.setNewType((ASTNameArgument)typeArgument);
}
else if (typeArgument instanceof ASTNamedType) {
//TODO IMPLEMENT ME!F
Log.error("Case not handled!" + "GenericsReplacementCalculator:");
} else {
Log.debug("Case not handled: " + typeArgument.getClass().getSimpleName(),
......
......@@ -87,7 +87,7 @@ public class ConstantPortHelper {
/*builder.setConstantValue(
getConstantValue(node.getUnitNumberResolution().getUnitNumberType().getNumberWithUnit()));*/
String typeName = "UnitNumberResolution";
//TODO IMPLEMENT ME!
//TODO IMPLEMENT ME!D
if (node.getUnitNumberResolution().isPresentName() && node.getUnitNumberResolution().getName()
.equals("B")) {
builder.setConstantValue(getConstantValue(node.getBoolLiteral()));
......@@ -105,7 +105,6 @@ public class ConstantPortHelper {
} else if (node.isPresentBoolLiteral()) {
builder.setConstantValue(getConstantValue(node.getBoolLiteral()));
String typeName = "B";
//TODO IMPLEMENT ME!
builder.setTypeReference(new ASTNamedType(typeName));
} else {
Log.info("Case not handled", "ConstantPortInit");
......@@ -116,7 +115,6 @@ public class ConstantPortHelper {
public static EMAConstantValue getEMAConstantValue(ASTEMAConnector node) {
if (node.isPresentUnitNumberResolution()) {
//TODO IMPLEMENT ME!
if (node.getUnitNumberResolution().isPresentName() && node.getUnitNumberResolution().getName()
.equals("B")) {
return getConstantValue(node.getBoolLiteral());
......
......@@ -32,6 +32,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
*
* @author ahaber, Robert Heim
*/
@Deprecated
public class PortCompatibilityChecker {
/**
* Checks whether the sourcePort's type can be connected to the targetPort's type. For example,
......
......@@ -41,50 +41,12 @@ import java.util.stream.Collectors;
public class SymbolPrinter {
/**
* help function for nested type arguments such as List<NewType<String, List<String>>>
*/
/*public static String printTypeParameters(ActualTypeArgument arg) {
// String ret = arg.getType().getLoadedSymbol().getFullName();
String ret = arg.getType().getName();
if (arg.getType().getActualTypeArguments() != null && !arg.getType().getActualTypeArguments()
.isEmpty()) {
ret += "<" + arg.getType().getActualTypeArguments().stream().
map(a -> printWildCardPrefix(a) + printTypeParameters(a) + printArrayDimensions(a))
.collect(Collectors.joining(",")) + ">";
}