Commit c01bc12a authored by Malte Heithoff's avatar Malte Heithoff
Browse files

New Symbols

parent 715d4189
...@@ -10,35 +10,31 @@ ...@@ -10,35 +10,31 @@
<groupId>de.monticore.lang.monticar</groupId> <groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc</artifactId> <artifactId>embedded-montiarc</artifactId>
<version>0.2.12-SNAPSHOT</version> <version>0.4.4-SNAPSHOT</version>
<!-- == PROJECT DEPENDENCIES ============================================= --> <!-- == PROJECT DEPENDENCIES ============================================= -->
<properties> <properties>
<wagon.provider.version>2.6</wagon.provider.version>
<!-- .. EMA-Libraries ................................................. --> <!-- .. EMA-Libraries ................................................. -->
<struct.version>0.2.12-SNAPSHOT</struct.version> <struct.version>0.4.4-SNAPSHOT</struct.version>
<Common-MontiCar.version>0.2.12-SNAPSHOT</Common-MontiCar.version> <Common-MontiCar.version>0.4.4-SNAPSHOT</Common-MontiCar.version>
<tagging.version>0.2.12-SNAPSHOT</tagging.version> <tagging.version>0.4.4-SNAPSHOT</tagging.version>
<!-- .. SE-Libraries .................................................. --> <!-- .. SE-Libraries .................................................. -->
<monticore.version>5.0.0</monticore.version> <monticore.version>5.0.0</monticore.version>
<se-commons.version>1.7.7</se-commons.version> <se-commons.version>1.7.7</se-commons.version>
<mc.grammars.assembly.version>0.0.6-SNAPSHOT</mc.grammars.assembly.version> <mc.grammars.assembly.version>0.0.6-SNAPSHOT</mc.grammars.assembly.version>
<languages.version>4.0.1-SNAPSHOT</languages.version>
<!-- .. Libraries .................................................. --> <!-- .. Libraries .................................................. -->
<guava.version>25.1-jre</guava.version> <guava.version>25.1-jre</guava.version>
<junit.version>4.12</junit.version> <junit.version>4.12</junit.version>
<logback.version>1.1.2</logback.version>
<jscience.version>4.3.1</jscience.version>
<jsr305.version>3.0.0</jsr305.version> <jsr305.version>3.0.0</jsr305.version>
<!-- .. Plugins ....................................................... --> <!-- .. Plugins ....................................................... -->
<monticore.plugin>5.0.0</monticore.plugin> <monticore.plugin>5.0.0</monticore.plugin>
<assembly.plugin>2.5.4</assembly.plugin> <assembly.plugin>2.5.4</assembly.plugin>
<compiler.plugin>3.3</compiler.plugin> <compiler.plugin>3.3</compiler.plugin>
<source.plugin>2.4</source.plugin> <source.plugin>2.4</source.plugin>
<shade.plugin>2.4.3</shade.plugin>
<!-- Classifiers --> <!-- Classifiers -->
<grammars.classifier>grammars</grammars.classifier> <grammars.classifier>grammars</grammars.classifier>
...@@ -54,12 +50,6 @@ ...@@ -54,12 +50,6 @@
<dependencies> <dependencies>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<version>4.7.1</version>
</dependency>
<dependency> <dependency>
<groupId>de.monticore.lang</groupId> <groupId>de.monticore.lang</groupId>
<artifactId>Tagging</artifactId> <artifactId>Tagging</artifactId>
...@@ -94,18 +84,6 @@ ...@@ -94,18 +84,6 @@
<!-- MontiCore Dependencies --> <!-- MontiCore Dependencies -->
<dependency>
<groupId>de.monticore</groupId>
<artifactId>monticore-runtime</artifactId>
<version>${monticore.version}</version>
</dependency>
<dependency>
<groupId>de.monticore</groupId>
<artifactId>monticore-grammar</artifactId>
<version>${monticore.version}</version>
</dependency>
<dependency> <dependency>
<groupId>de.monticore</groupId> <groupId>de.monticore</groupId>
<artifactId>monticore-grammar</artifactId> <artifactId>monticore-grammar</artifactId>
...@@ -120,18 +98,6 @@ ...@@ -120,18 +98,6 @@
<version>${jsr305.version}</version> <version>${jsr305.version}</version>
</dependency> </dependency>
<dependency>
<groupId>de.se_rwth.commons</groupId>
<artifactId>se-commons-groovy</artifactId>
<version>${se-commons.version}</version>
</dependency>
<dependency>
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>common-monticar</artifactId>
<version>${Common-MontiCar.version}</version>
</dependency>
<dependency> <dependency>
<groupId>de.monticore.lang.monticar</groupId> <groupId>de.monticore.lang.monticar</groupId>
...@@ -149,26 +115,6 @@ ...@@ -149,26 +115,6 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>de.monticore</groupId>
<artifactId>monticore-runtime</artifactId>
<version>${monticore.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>org.jscience</groupId>
<artifactId>jscience</artifactId>
<version>${jscience.version}</version>
</dependency>
</dependencies> </dependencies>
<!-- == PROJECT BUILD SETTINGS =========================================== --> <!-- == PROJECT BUILD SETTINGS =========================================== -->
...@@ -188,19 +134,6 @@ ...@@ -188,19 +134,6 @@
<skip>false</skip> <skip>false</skip>
<script>de/monticore/monticore_noemf.groovy</script> <script>de/monticore/monticore_noemf.groovy</script>
</configuration> </configuration>
<dependencies>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4</artifactId>
<version>4.7.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.antlr/antlr4-runtime -->
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<version>4.7.1</version>
</dependency>
</dependencies>
<executions> <executions>
<execution> <execution>
<goals> <goals>
......
...@@ -126,7 +126,7 @@ grammar EmbeddedMontiArc extends de.monticore.lang.monticar.Common2 { ...@@ -126,7 +126,7 @@ grammar EmbeddedMontiArc extends de.monticore.lang.monticar.Common2 {
"instance" "instance"
type:ReferenceType type:ReferenceType
("(" arguments:(Expression || ",")+ ")" )? ("(" arguments:(Expression || ",")+ ")" )?
("{" (InitialGuess || ",")+ "}")? ("{" (PortInitialValueOrGuess || ",")+ "}")?
instances:(SubComponentInstance || ",")+ ";" ; instances:(SubComponentInstance || ",")+ ";" ;
...@@ -146,8 +146,8 @@ grammar EmbeddedMontiArc extends de.monticore.lang.monticar.Common2 { ...@@ -146,8 +146,8 @@ grammar EmbeddedMontiArc extends de.monticore.lang.monticar.Common2 {
Name Name
("[" UnitNumberResolution "]")?; ("[" UnitNumberResolution "]")?;
InitialGuess = PortInitialValueOrGuess =
Name ( "[" UnitNumberResolution "]" )? "=" Expression; Name ( "[" UnitNumberResolution "]" )? (guess:["~"])? "=" Expression;
/** /**
* port1 * port1
......
...@@ -30,6 +30,6 @@ public class EmbeddedMontiArcCoCos { ...@@ -30,6 +30,6 @@ public class EmbeddedMontiArcCoCos {
.addCoCo(new InRosPortRosSender()) .addCoCo(new InRosPortRosSender())
.addCoCo(new ConstantConnectorTargetRangeValid()) .addCoCo(new ConstantConnectorTargetRangeValid())
.addCoCo((new DistinctTargetPorts())) .addCoCo((new DistinctTargetPorts()))
.addCoCo(new InitialGuessIsAssignment()); .addCoCo(new InitialGuessIsNotAssignmentCoCo());
} }
} }
/* (c) https://github.com/MontiCore/monticore */ /* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.embeddedmontiarc.cocos; package de.monticore.lang.embeddedmontiarc.cocos;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._ast.ASTInitialGuess; import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._ast.ASTPortInitialValueOrGuess;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._ast.ASTSubComponent; import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._ast.ASTSubComponent;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._cocos.EmbeddedMontiArcASTSubComponentCoCo; import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._cocos.EmbeddedMontiArcASTSubComponentCoCo;
import de.monticore.mcexpressions._ast.ASTAssignmentExpression; import de.monticore.mcexpressions._ast.ASTAssignmentExpression;
import de.se_rwth.commons.logging.Log; import de.se_rwth.commons.logging.Log;
public class InitialGuessIsAssignment implements EmbeddedMontiArcASTSubComponentCoCo { public class InitialGuessIsNotAssignmentCoCo implements EmbeddedMontiArcASTSubComponentCoCo {
@Override @Override
public void check(ASTSubComponent node) { public void check(ASTSubComponent node) {
for (ASTInitialGuess initialGuess : node.getInitialGuessList()) { for (ASTPortInitialValueOrGuess initialGuess : node.getPortInitialValueOrGuessList()) {
if (initialGuess.getExpression() instanceof ASTAssignmentExpression) { if (initialGuess.getExpression() instanceof ASTAssignmentExpression) {
Log.error(String.format("0x079B7 Initial guess of has to be an assignment"), Log.error(String.format("0x079B7 Initial guess of has to be an assignment"),
node.get_SourcePositionStart()); node.get_SourcePositionStart());
......
...@@ -256,7 +256,7 @@ public class EmbeddedMontiArcSymbolTableCreator extends EmbeddedMontiArcSymbolTa ...@@ -256,7 +256,7 @@ public class EmbeddedMontiArcSymbolTableCreator extends EmbeddedMontiArcSymbolTa
componentTypeReference.setArguments(node.getArgumentsList()); componentTypeReference.setArguments(node.getArgumentsList());
componentTypeReference.fixResolutions(this); componentTypeReference.fixResolutions(this);
// InitialGuesses // InitialGuesses
componentTypeReference.setInitialGuesses(node.getInitialGuessList()); componentTypeReference.setInitialGuesses(node.getPortInitialValueOrGuessList());
// instances // instances
......
...@@ -3,7 +3,7 @@ package de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.cncMode ...@@ -3,7 +3,7 @@ package de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.cncMode
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import de.monticore.expressionsbasis._ast.ASTExpression; import de.monticore.expressionsbasis._ast.ASTExpression;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._ast.ASTInitialGuess; import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._ast.ASTPortInitialValueOrGuess;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ComponentKind; import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ComponentKind;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstantiationSymbol; import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstantiationSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc.types.EMAVariable; import de.monticore.lang.embeddedmontiarc.embeddedmontiarc.types.EMAVariable;
...@@ -57,7 +57,7 @@ public class EMAComponentSymbol extends CommonScopeSpanningSymbol implements EMA ...@@ -57,7 +57,7 @@ public class EMAComponentSymbol extends CommonScopeSpanningSymbol implements EMA
private List<ASTExpression> arguments = new ArrayList<>(); private List<ASTExpression> arguments = new ArrayList<>();
private List<ASTInitialGuess> initalGuesses = new ArrayList<>(); private List<ASTPortInitialValueOrGuess> initalGuesses = new ArrayList<>();
public EMAComponentSymbol(String name) { public EMAComponentSymbol(String name) {
super(name, KIND); super(name, KIND);
...@@ -650,20 +650,20 @@ public class EMAComponentSymbol extends CommonScopeSpanningSymbol implements EMA ...@@ -650,20 +650,20 @@ public class EMAComponentSymbol extends CommonScopeSpanningSymbol implements EMA
return (Optional<EMAComponentSymbol>) getEnclosingScope().getSpanningSymbol(); return (Optional<EMAComponentSymbol>) getEnclosingScope().getSpanningSymbol();
} }
public List<ASTInitialGuess> getInitalGuesses() { public List<ASTPortInitialValueOrGuess> getInitalGuesses() {
if (referencedComponent.isPresent()) if (referencedComponent.isPresent())
return referencedComponent.get().getInitalGuesses(); return referencedComponent.get().getInitalGuesses();
return initalGuesses; return initalGuesses;
} }
public void addInitialGuess(ASTInitialGuess initialGuess) { public void addInitialGuess(ASTPortInitialValueOrGuess initialGuess) {
if (referencedComponent.isPresent()) if (referencedComponent.isPresent())
referencedComponent.get().addInitialGuess(initialGuess); referencedComponent.get().addInitialGuess(initialGuess);
else else
this.initalGuesses.add(initialGuess); this.initalGuesses.add(initialGuess);
} }
public void setInitialGuesses(List<ASTInitialGuess> initalGuesses) { public void setInitialGuesses(List<ASTPortInitialValueOrGuess> initalGuesses) {
this.initalGuesses = initalGuesses; this.initalGuesses = initalGuesses;
} }
} }
...@@ -6,7 +6,7 @@ package de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.cncMode ...@@ -6,7 +6,7 @@ package de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.cncMode
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import de.monticore.expressionsbasis._ast.ASTExpression; import de.monticore.expressionsbasis._ast.ASTExpression;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._ast.ASTInitialGuess; import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._ast.ASTPortInitialValueOrGuess;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.EmbeddedMontiArcSymbolTableCreator; import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.EmbeddedMontiArcSymbolTableCreator;
import de.monticore.lang.monticar.si._symboltable.ResolutionDeclarationSymbol; import de.monticore.lang.monticar.si._symboltable.ResolutionDeclarationSymbol;
import de.monticore.symboltable.MutableScope; import de.monticore.symboltable.MutableScope;
...@@ -32,7 +32,7 @@ public class EMAComponentSymbolReference extends EMAComponentSymbol implements ...@@ -32,7 +32,7 @@ public class EMAComponentSymbolReference extends EMAComponentSymbol implements
private List<ResolutionDeclarationSymbol> resSymbols = new ArrayList<>(); private List<ResolutionDeclarationSymbol> resSymbols = new ArrayList<>();
private List<ASTExpression> arguments = new ArrayList<>(); private List<ASTExpression> arguments = new ArrayList<>();
private List<ASTInitialGuess> initalGuesses = new ArrayList<>(); private List<ASTPortInitialValueOrGuess> initalGuesses = new ArrayList<>();
public EMAComponentSymbolReference(final String name, final Scope definingScopeOfReference) { public EMAComponentSymbolReference(final String name, final Scope definingScopeOfReference) {
super(name); super(name);
...@@ -164,17 +164,17 @@ public class EMAComponentSymbolReference extends EMAComponentSymbol implements ...@@ -164,17 +164,17 @@ public class EMAComponentSymbolReference extends EMAComponentSymbol implements
} }
@Override @Override
public List<ASTInitialGuess> getInitalGuesses() { public List<ASTPortInitialValueOrGuess> getInitalGuesses() {
return this.initalGuesses; return this.initalGuesses;
} }
@Override @Override
public void addInitialGuess(ASTInitialGuess initialGuess) { public void addInitialGuess(ASTPortInitialValueOrGuess initialGuess) {
this.initalGuesses.add(initialGuess); this.initalGuesses.add(initialGuess);
} }
@Override @Override
public void setInitialGuesses(List<ASTInitialGuess> initalGuesses) { public void setInitialGuesses(List<ASTPortInitialValueOrGuess> initalGuesses) {
this.initalGuesses = initalGuesses; this.initalGuesses = initalGuesses;
} }
......
...@@ -3,7 +3,7 @@ package de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanc ...@@ -3,7 +3,7 @@ package de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanc
import de.monticore.expressionsbasis._ast.ASTExpression; import de.monticore.expressionsbasis._ast.ASTExpression;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._ast.ASTComponent; import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._ast.ASTComponent;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._ast.ASTInitialGuess; import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._ast.ASTPortInitialValueOrGuess;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._ast.EmbeddedMontiArcMill; import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._ast.EmbeddedMontiArcMill;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.UnitNumberExpressionSymbol; import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.UnitNumberExpressionSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.cncModel.*; import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.cncModel.*;
...@@ -45,7 +45,7 @@ public class EMAComponentInstanceBuilder { ...@@ -45,7 +45,7 @@ public class EMAComponentInstanceBuilder {
protected List<EMAVariable> parameters = new ArrayList<>(); protected List<EMAVariable> parameters = new ArrayList<>();
protected List<ASTExpression> arguments = new ArrayList<>(); protected List<ASTExpression> arguments = new ArrayList<>();
protected String packageName = ""; protected String packageName = "";
protected List<ASTInitialGuess> initialGuesses = new ArrayList<>(); protected List<ASTPortInitialValueOrGuess> initialGuesses = new ArrayList<>();
protected static Map<MCTypeSymbol, ActualTypeArgument> createMap(List<MCTypeSymbol> keys, protected static Map<MCTypeSymbol, ActualTypeArgument> createMap(List<MCTypeSymbol> keys,
List<ActualTypeArgument> values) { List<ActualTypeArgument> values) {
...@@ -307,14 +307,18 @@ public class EMAComponentInstanceBuilder { ...@@ -307,14 +307,18 @@ public class EMAComponentInstanceBuilder {
} }
for (EMAPortInstanceSymbol port : inst.getPortInstanceList()) { for (EMAPortInstanceSymbol port : inst.getPortInstanceList()) {
if (port.isInitialGuessPresent()) { if (port.isInitialGuessPresent() || port.isInitialValuePresent()) {
ASTExpression initialGuess = port.getInitialGuess(); ASTExpression initial = port.isInitialGuessPresent() ? port.getInitialGuess() : port.getInitialValue();
if (initialGuess instanceof ASTUnitNumberResolutionExpression) { if (initial instanceof ASTUnitNumberResolutionExpression) {
if (((ASTUnitNumberResolutionExpression) initialGuess).getUnitNumberResolution().getNameOpt().isPresent()) { if (((ASTUnitNumberResolutionExpression) initial).getUnitNumberResolution().getNameOpt().isPresent()) {
String par = ((ASTUnitNumberResolutionExpression) initialGuess).getUnitNumberResolution().getName(); String par = ((ASTUnitNumberResolutionExpression) initial).getUnitNumberResolution().getName();
ASTExpression argument = arguments.get(par); ASTExpression argument = arguments.get(par);
if (argument != null) if (argument != null) {
port.setInitialGuess(argument); if (port.isInitialGuessPresent())
port.setInitialGuess(argument);
else
port.setInitialValue(argument);
}
} }
} }
} }
...@@ -409,14 +413,19 @@ public class EMAComponentInstanceBuilder { ...@@ -409,14 +413,19 @@ public class EMAComponentInstanceBuilder {
private void handleInitialGuesses(EMAComponentInstanceSymbol sym) { private void handleInitialGuesses(EMAComponentInstanceSymbol sym) {
Collection<EMAPortInstanceSymbol> portInstanceList = sym.getPortInstanceList(); Collection<EMAPortInstanceSymbol> portInstanceList = sym.getPortInstanceList();
for (ASTInitialGuess initialGuess : initialGuesses) { for (ASTPortInitialValueOrGuess initialGuess : initialGuesses) {
String arrayAccess = ""; String arrayAccess = "";
if (initialGuess.isPresentUnitNumberResolution()) if (initialGuess.isPresentUnitNumberResolution())
arrayAccess += "[" + initialGuess.getUnitNumberResolution().getNumber().get().intValue() + "]"; arrayAccess += "[" + initialGuess.getUnitNumberResolution().getNumber().get().intValue() + "]";
final String portAccessName = initialGuess.getName() + arrayAccess; final String portAccessName = initialGuess.getName() + arrayAccess;
portInstanceList.stream() portInstanceList.stream()
.filter(port -> port.getName().equals(portAccessName)) .filter(port -> port.getName().equals(portAccessName))
.forEachOrdered(port -> port.setInitialGuess(initialGuess.getExpression())); .forEachOrdered(port -> {
if(initialGuess.isGuess())
port.setInitialGuess(initialGuess.getExpression());
else
port.setInitialValue(initialGuess.getExpression());
});
} }
} }
...@@ -609,15 +618,15 @@ public class EMAComponentInstanceBuilder { ...@@ -609,15 +618,15 @@ public class EMAComponentInstanceBuilder {
return this; return this;
} }
public EMAComponentInstanceBuilder addInitialGuesses(List<ASTInitialGuess> initialGuesses) { public EMAComponentInstanceBuilder addInitialGuesses(List<ASTPortInitialValueOrGuess> initialGuesses) {
for (ASTInitialGuess initialGuess : initialGuesses) { for (ASTPortInitialValueOrGuess initialGuess : initialGuesses) {
if (!this.initialGuesses.contains(initialGuess)) if (!this.initialGuesses.contains(initialGuess))
this.initialGuesses.add(initialGuess); this.initialGuesses.add(initialGuess);
} }
return this; return this;
} }
public List<ASTInitialGuess> getInitialGuesses() { public List<ASTPortInitialValueOrGuess> getInitialGuesses() {
return initialGuesses; return initialGuesses;
} }
} }
...@@ -55,6 +55,8 @@ public class EMAPortInstanceSymbol extends EMAPortSymbol implements EMAElementIn ...@@ -55,6 +55,8 @@ public class EMAPortInstanceSymbol extends EMAPortSymbol implements EMAElementIn
private Optional<ASTExpression> initialGuess = Optional.empty(); private Optional<ASTExpression> initialGuess = Optional.empty();
private Optional<ASTExpression> initialValue = Optional.empty();
/** /**
* use {@link #builder()} * use {@link #builder()}
*/ */
...@@ -287,4 +289,19 @@ public class EMAPortInstanceSymbol extends EMAPortSymbol implements EMAElementIn ...@@ -287,4 +289,19 @@ public class EMAPortInstanceSymbol extends EMAPortSymbol implements EMAElementIn
else else
return null; return null;
} }
public boolean isInitialValuePresent() {
return this.initialValue.isPresent();
}
public void setInitialValue(ASTExpression initialGuess) {
this.initialValue = Optional.ofNullable(initialGuess);
}
public ASTExpression getInitialValue() {
if (isInitialValuePresent())
return this.initialValue.get();
else
return null;
}
} }
...@@ -543,6 +543,7 @@ public class ExpandedComponentInstanceTest extends AbstractSymtabTest { ...@@ -543,6 +543,7 @@ public class ExpandedComponentInstanceTest extends AbstractSymtabTest {
@Test @Test
public void testInitialGuesses() { public void testInitialGuesses() {
Scope symTab = createSymTab("src/test/resources"); Scope symTab = createSymTab("src/test/resources");
Log.enableFailQuick(true);
EMAComponentInstanceSymbol inst = symTab.<EMAComponentInstanceSymbol>resolve( EMAComponentInstanceSymbol inst = symTab.<EMAComponentInstanceSymbol>resolve(
"testing.initialGuessTest", EMAComponentInstanceSymbol.KIND).orElse(null); "testing.initialGuessTest", EMAComponentInstanceSymbol.KIND).orElse(null);
......
...@@ -11,7 +11,7 @@ public class InitialValueCoCoTest extends AbstractCoCoTest { ...@@ -11,7 +11,7 @@ public class InitialValueCoCoTest extends AbstractCoCoTest {
ASTEmbeddedMontiArcNode astNode = getAstNode("", model); ASTEmbeddedMontiArcNode astNode = getAstNode("", model);
EmbeddedMontiArcCoCoChecker checker = new EmbeddedMontiArcCoCoChecker(); EmbeddedMontiArcCoCoChecker checker = new EmbeddedMontiArcCoCoChecker();
checker.addCoCo(new InitialGuessIsAssignment()); checker.addCoCo(new InitialGuessIsNotAssignmentCoCo());