Commit b8d08abe authored by Alexander Diewald's avatar Alexander Diewald

DSE: Fixup the return type handling

* Actually set the expected return type during IExplorationTarget
  creation.
* Improve the return type handling of the DseML to SMT transformation.
* Fixup the BusBandwidthMinimization.
* Fix several warnings.

Issue-Ref: 3365
Issue-Url: https://af3-developer.fortiss.org/issues/3365Signed-off-by: Alexander Diewald's avatarAlexander Diewald <diewald@fortiss.org>
parent bfd6290e
......@@ -4,7 +4,7 @@ BasicScheduleConstraint.java 8b054b5ad961295b97936e26240eb33a10a1ee9a YELLOW
ConstraintDefinitionUtils.java 8a709a9cd10edd36d1ac3ed0ded0c938aa010f12 GREEN
ConstraintTransformationAdapter.java 8806164d71491c7d1af665990dd154f2275cad8c GREEN
DSMLTransformationService.java 2c19395bffa10cdaf2e7f38fdb592254289e659c GREEN
DSMLtoSMTTransformator.java 4640bb316d3c8392f03b6ddfe8880094e921be41 YELLOW
DSMLtoSMTTransformator.java 81ef8c9fc1598a7d28907fe9b165b4667bdeafb1 YELLOW
DefaultExpressionTransformator.java 9f572be21d1d96bc3d7604695678e57035a1b82e GREEN
DeploScheduleRun.java 2b07bd6b40cf4ce2eabc12198f6db3b9655bed25 GREEN
DeploymentRun.java 4b2d0a6d64bb5a6efabc2ee9bf933cc523843ac8 GREEN
......@@ -15,5 +15,5 @@ NonQuantifiedExpressionTransformator.java 9ee437aeaf518d94b81e34a275cd01b87cfca1
QuantifiedExpressionTransformator.java 01e7162b24d16adb23f646cf02340879e8a18205 GREEN
SMTTransformationUtils.java 376da0f5dafb350b49004c7d75fb8858b53d3b7d GREEN
ScheduleRun.java 43d869a9adfbebe34c34f1ebb0bc8e0600f45b9d GREEN
SolverRun.java 343f6265dd340293a612f999e7a749e15a576d8a YELLOW
SolverRun.java d0707217f6f63ee19e09848d3706fd3714978cfc YELLOW
TimingConstraintDefinition.java 92281277d99bb52b72c1cb898bba944b3b9a24f7 YELLOW
......@@ -180,6 +180,11 @@ public class DSMLtoSMTTransformator {
} else if(explorationTgt instanceof IExplorationObjective) {
IExplorationObjective<?> smtObjective =
(IExplorationObjective<?>)explorationTgt;
for(IExplorationTarget<?> t : smtObjective.getContainedTargets()) {
IExplorationConstraint<?> subCon = (IExplorationConstraint<?>)t;
Expr smtExpr = extractSMTExpr(subCon);
addExpression(smtExpr, subCon);
}
IExpression expression = smtObjective.getExpression();
ArithExpr arithExpr = (ArithExpr)extractObjective(smtObjective);
......@@ -408,7 +413,7 @@ public class DSMLtoSMTTransformator {
Set<ExecutionUnit> ecuSet = ExpressionFactory.eINSTANCE.createSet();
ecuSet.getEntries().add((ExecutionUnit)modelElement);
// TODO (#3554)
FrequencyAssigned fa = createFrequencyAssigned(ecuSet);
@SuppressWarnings("deprecation") FrequencyAssigned fa = createFrequencyAssigned(ecuSet);
Expr frequencyExpr =
transformationService.getZ3FunctionDecl(fa).apply(instance.getValue());
RatNum frequencyNum = (RatNum)model.eval(frequencyExpr, true);
......
......@@ -17,7 +17,6 @@ package org.fortiss.af3.exploration.smt.modeltransformation;
import static com.microsoft.z3.Z3javaAPIWrapper.createBoolConst;
import static com.microsoft.z3.Z3javaAPIWrapper.createOptimize;
import static java.lang.Double.valueOf;
import static java.lang.System.currentTimeMillis;
import static org.eclipse.core.runtime.Assert.isTrue;
import static org.eclipse.core.runtime.Platform.getLocation;
......@@ -31,6 +30,9 @@ import static org.fortiss.af3.exploration.util.ExplorationModelElementFactory.cr
import static org.fortiss.af3.exploration.util.ExplorationModelElementFactory.createExplorationSolution;
import static org.fortiss.af3.exploration.util.ExplorationModelElementFactory.createSingleExplorationSolution;
import static org.fortiss.af3.exploration.util.ExplorationUtils.isDebugVerboseEnabled;
import static org.fortiss.tooling.base.utils.BaseMathUtils.convertNumber;
import static org.fortiss.tooling.base.utils.BaseMathUtils.isFloatNumber;
import static org.fortiss.tooling.base.utils.BaseMathUtils.isIntegerNumber;
import static org.fortiss.tooling.common.util.LambdaUtils.filterByType;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickInstanceOf;
import static org.fortiss.tooling.kernel.utils.LoggingUtils.error;
......@@ -57,9 +59,9 @@ import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.emf.common.util.EList;
import org.fortiss.af3.exploration.ExplorationActivator;
import org.fortiss.af3.exploration.dseml.model.expression.SuperSet;
import org.fortiss.af3.exploration.model.ExplorationSpecification;
import org.fortiss.af3.exploration.model.IExplorationConstraint;
import org.fortiss.af3.exploration.model.IExplorationObjective;
import org.fortiss.af3.exploration.model.ExplorationSpecification;
import org.fortiss.af3.exploration.model.project.RuleSet;
import org.fortiss.af3.exploration.model.solutions.ExplorationResult;
import org.fortiss.af3.exploration.model.solutions.ExplorationSolution;
......@@ -391,6 +393,7 @@ public abstract class SolverRun {
expSolution.getSolutions().add(singleSolution);
} catch(Exception e) {
singleSolution.setSolutionState(UNKNOWN);
throw new Z3Exception("The back-conversation of the Z3 Model failed.", e);
}
if(monitor != null) {
......@@ -555,30 +558,37 @@ public abstract class SolverRun {
Map<Expr, IExplorationObjective<?>> objectiveMapping) {
try {
for(Entry<Expr, IExplorationObjective<?>> entry : objectiveMapping.entrySet()) {
@SuppressWarnings("unchecked") IExplorationObjective<Number> castedObjective =
(IExplorationObjective<Number>)entry.getValue();
@SuppressWarnings("unchecked") Class<Number> expectedType =
(Class<Number>)entry.getValue().getResultType();
ExplorationResult<Number> result = null;
Expr z3EvalResult = z3Model.eval(entry.getKey(), true);
if(!entry.getValue().getResultType().equals(Double.class)) {
error(getDefault(), "Could not transform " + z3EvalResult +
" into double value. Not" + " supported.");
continue;
}
ExplorationResult<Double> result = createExplorationResult();
if(z3EvalResult instanceof IntNum) {
result.setResult(valueOf(((IntNum)z3EvalResult).getInt()));
} else if(z3EvalResult instanceof RatNum) {
if(z3EvalResult instanceof IntNum && isIntegerNumber(expectedType)) {
Number value = convertNumber(
(Number)Integer.valueOf(((IntNum)z3EvalResult).getInt()), expectedType);
result = createExplorationResult(expectedType, value);
} else if(z3EvalResult instanceof RatNum && isFloatNumber(expectedType)) {
RatNum ratnum = (RatNum)z3EvalResult;
IntNum denominator = ratnum.getDenominator();
IntNum numerator = ratnum.getNumerator();
if(denominator.getInt() == 1) {
result.setResult(valueOf(numerator.getInt()));
Number value = convertNumber((Number)Integer.valueOf(numerator.getInt()),
expectedType);
result = createExplorationResult(expectedType, value);
} else {
// not supported yet
error(getDefault(),
"Could not transform " + z3EvalResult + " into integer value. The" +
" returned value from the solver is not an integer value.");
}
} else {
error(getDefault(), "Could not transform " + z3EvalResult +
" to the exptected type " + expectedType.getSimpleName() + ".");
continue;
}
@SuppressWarnings("unchecked") IExplorationObjective<Double> castedObjective =
(IExplorationObjective<Double>)entry.getValue();
singleSolution.put(castedObjective, result);
}
} catch(Z3Exception e) {
......
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.RadioButton?>
<?import javafx.scene.control.TreeTableView?>
<?import javafx.scene.control.TreeView?>
<?import javafx.scene.layout.Pane?>
<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
<children>
<TreeTableView fx:id="taskView" layoutX="26.0" layoutY="3.0" prefHeight="390.0" prefWidth="200.0" />
<TreeTableView fx:id="ecuView" layoutX="386.0" layoutY="7.0" prefHeight="390.0" prefWidth="200.0" />
<TreeView fx:id="taskView" layoutX="26.0" layoutY="3.0" prefHeight="390.0" prefWidth="200.0" />
<TreeView fx:id="ecuView" layoutX="386.0" layoutY="7.0" prefHeight="390.0" prefWidth="200.0" />
<RadioButton fx:id="allocationButton" layoutX="257.0" layoutY="170.0" mnemonicParsing="false" text="Allocation -&gt;" />
<RadioButton fx:id="dislocationButton" layoutX="257.0" layoutY="200.0" mnemonicParsing="false" text="Dislocation -/&gt;" />
</children>
......
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.RadioButton?>
<?import javafx.scene.control.TreeTableView?>
<?import javafx.scene.control.TreeView?>
<?import javafx.scene.layout.Pane?>
<Pane fx:id="pane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
<children>
<TreeTableView fx:id="view" layoutX="28.0" layoutY="7.0" prefHeight="385.0" prefWidth="230.0" />
<TreeView fx:id="view" prefHeight="385.0" prefWidth="230.0" />
<RadioButton fx:id="couplingButton" layoutX="323.0" layoutY="112.0" mnemonicParsing="false" text="Coupling" />
<RadioButton fx:id="decouplingButton" layoutX="323.0" layoutY="145.0" mnemonicParsing="false" text="Decoupling" />
</children>
......
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.RadioButton?>
<?import javafx.scene.control.TreeTableView?>
<?import javafx.scene.control.TreeView?>
<?import javafx.scene.layout.Pane?>
<Pane fx:id="pane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
<children>
<TreeTableView fx:id="view" layoutX="28.0" layoutY="7.0" prefHeight="385.0" prefWidth="230.0" />
<TreeView fx:id="view" prefHeight="400.0" prefWidth="241.0" />
<RadioButton fx:id="minButton" layoutX="323.0" layoutY="112.0" mnemonicParsing="false" text="Minimize" />
<RadioButton fx:id="maxButton" layoutX="323.0" layoutY="145.0" mnemonicParsing="false" text="Maximize" />
</children>
......
AllocationPatternFXController.java cf617ac315413df0990435904d304806baa42336 YELLOW
CouplingPatternFXController.java 99a5afcbb98168498092e02100295afab4e24c58 YELLOW
AllocationPatternFXController.java 7c3ba677a9b14857d20140d48d321cd4b41d0fda YELLOW
CouplingPatternFXController.java b8270aaddefdde9d845bb2c6624bb850384b4aad YELLOW
MemoryPatternFXController.java a15b2a0bb69681e4ae675dcc23fc9aaf44558728 YELLOW
SafetyPatternFXController.java 440af5d6bdd5ce26b4d77461f8b34271fadfc637 YELLOW
......@@ -21,14 +21,15 @@ import org.fortiss.af3.exploration.ui.perspective.generic.SuperSetContentProvide
import org.fortiss.af3.exploration.ui.perspective.service.IDSEPerspectiveManager;
import org.fortiss.af3.platform.model.ExecutionUnit;
import org.fortiss.af3.task.model.Task;
import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeTableUIProviderBase;
import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeTableViewer;
import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeUIProviderBase;
import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeViewer;
import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.control.RadioButton;
import javafx.scene.control.ToggleGroup;
import javafx.scene.control.TreeTableView;
import javafx.scene.control.TreeView;
/**
* {@link PatternFXControllerBase} that allows the user to define allocation/dislocation
......@@ -42,13 +43,13 @@ public class AllocationPatternFXController extends PatternFXControllerBase {
* {@link TreeTableView} displaying the list of tasks.
*/
@FXML
private TreeTableView<EObject> taskView;
private TreeView<EObject> taskView;
/**
* {@link TreeTableView} displaying the list of ECUs.
*/
@FXML
private TreeTableView<EObject> ecuView;
private TreeView<EObject> ecuView;
/**
* {@link RadioButton} to select the coupling option.
......@@ -151,19 +152,17 @@ public class AllocationPatternFXController extends PatternFXControllerBase {
SuperSet<ExecutionUnit> ecus =
dse.getCurrentStep().getSuperSetMap().get(ExecutionUnit.class);
DynamicTreeTableUIProviderBase uiProvider = createNameProvider();
@SuppressWarnings("unchecked") DynamicTreeUIProviderBase<EObject> uiProvider =
(DynamicTreeUIProviderBase<EObject>)(DynamicTreeUIProviderBase<?>)createNameProvider();
// add a viewer for the tasks
DynamicTreeTableViewer<EObject> taskViewer = new DynamicTreeTableViewer<EObject>(
taskView, tasks, false, 0, new SuperSetContentProvider<Task>(), uiProvider);
// add a column with tasks
taskViewer.addColumn("Task", 200, true);
// The constructed Object is not needed. It is called from the passed TreeView.
new DynamicTreeViewer<EObject>(taskView, tasks, false, 0,
new SuperSetContentProvider<Task>(), uiProvider);
// add a viewer for the ECUs
DynamicTreeTableViewer<EObject> ecuViewer = new DynamicTreeTableViewer<EObject>(ecuView,
ecus, false, 0, new SuperSetContentProvider<ExecutionUnit>(), uiProvider);
// add a column with ECUs
ecuViewer.addColumn("ECU", 200, true);
// The constructed Object is not needed. It is called from the passed TreeView.
new DynamicTreeViewer<EObject>(ecuView, ecus, false, 0,
new SuperSetContentProvider<ExecutionUnit>(), uiProvider);
// add the radio buttons for switching from allocation to dislocation
final ToggleGroup group = new ToggleGroup();
......
......@@ -35,14 +35,15 @@ import org.fortiss.af3.exploration.ui.perspective.generic.PatternFXControllerBas
import org.fortiss.af3.exploration.ui.perspective.generic.SuperSetContentProvider;
import org.fortiss.af3.exploration.ui.perspective.service.IDSEPerspectiveManager;
import org.fortiss.af3.task.model.Task;
import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeTableUIProviderBase;
import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeTableViewer;
import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeUIProviderBase;
import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeViewer;
import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.control.RadioButton;
import javafx.scene.control.ToggleGroup;
import javafx.scene.control.TreeTableView;
import javafx.scene.control.TreeView;
/**
* {@link PatternFXControllerBase} that allows the user to define coupling/decoupling constraints.
......@@ -55,7 +56,7 @@ public class CouplingPatternFXController extends PatternFXControllerBase {
* {@link TreeTableView} displaying the list of tasks.
*/
@FXML
private TreeTableView<EObject> view;
private TreeView<EObject> view;
/**
* {@link RadioButton} to select the coupling option.
......@@ -142,12 +143,12 @@ public class CouplingPatternFXController extends PatternFXControllerBase {
DSE dse = IDSEPerspectiveManager.INSTANCE.getCurrentlySelectedDSE();
SuperSet<Task> tasks = dse.getCurrentStep().getSuperSetMap().get(Task.class);
DynamicTreeTableUIProviderBase uiProvider = createNameProvider();
@SuppressWarnings("unchecked") DynamicTreeUIProviderBase<EObject> uiProvider =
(DynamicTreeUIProviderBase<EObject>)(DynamicTreeUIProviderBase<?>)createNameProvider();
DynamicTreeTableViewer<EObject> viewer = new DynamicTreeTableViewer<EObject>(view,
tasks, false, 0, new SuperSetContentProvider<Task>(), uiProvider);
// add a column with tasks
viewer.addColumn("Task", 230, true);
// The constructed Object is not needed. It is called from the passed TreeView.
new DynamicTreeViewer<EObject>(view, tasks, false, 0,
new SuperSetContentProvider<Task>(), uiProvider);
// add the radio buttons for switching from coupling to decoupling
final ToggleGroup group = new ToggleGroup();
......
BusBandwidthOptimizationPatternFXController.java 8ee6391675096d25f9763f88f62d01ab1565e9b9 RED
BusBandwidthOptimizationPatternFXController.java dc024a9c06cd730f839f06cfcbb72def27d0b99c RED
HardwareOptimizationPatternFXController.java f2893d1a205d8126af11ff98e055e32223e50aa6 YELLOW
......@@ -26,15 +26,14 @@ import static org.fortiss.af3.exploration.util.PatternFactoryUtils.createBusWeig
import static org.fortiss.af3.exploration.util.PatternFactoryUtils.createRouteUsesBusConstraintPatternExpression;
import static org.fortiss.af3.exploration.util.PatternFactoryUtils.createRouteWeightConstraintPatternExpression;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.af3.exploration.dseml.model.expression.IExpression;
import org.fortiss.af3.exploration.dseml.model.expression.SuperSet;
import org.fortiss.af3.exploration.model.ExplorationObjective;
import org.fortiss.af3.exploration.model.IExplorationConstraint;
import org.fortiss.af3.exploration.model.IExplorationTarget;
import org.fortiss.af3.exploration.model.project.DSE;
import org.fortiss.af3.exploration.ui.perspective.generic.PatternFXControllerBase;
......@@ -42,8 +41,8 @@ import org.fortiss.af3.exploration.ui.perspective.generic.SuperSetContentProvide
import org.fortiss.af3.exploration.ui.perspective.service.IDSEPerspectiveManager;
import org.fortiss.af3.platform.model.Route;
import org.fortiss.af3.platform.model.TransmissionUnit;
import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeTableUIProviderBase;
import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeTableViewer;
import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeUIProviderBase;
import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeViewer;
import javafx.fxml.FXML;
import javafx.scene.Node;
......@@ -51,6 +50,7 @@ import javafx.scene.control.RadioButton;
import javafx.scene.control.SelectionMode;
import javafx.scene.control.ToggleGroup;
import javafx.scene.control.TreeTableView;
import javafx.scene.control.TreeView;
/**
* {@link PatternFXControllerBase} that allows the user to define objectives for optimization of bus
......@@ -64,7 +64,7 @@ public class BusBandwidthOptimizationPatternFXController extends PatternFXContro
* {@link TreeTableView} displaying the list of transmission units.
*/
@FXML
private TreeTableView<EObject> view;
private TreeView<EObject> view;
/**
* {@link RadioButton} to select the minimize option.
......@@ -92,7 +92,7 @@ public class BusBandwidthOptimizationPatternFXController extends PatternFXContro
if(selectedBus == null) {
return null;
}
Collection<IExplorationConstraint<?>> constraints = new HashSet<>();
List<IExplorationTarget<Boolean>> constraints = new ArrayList<>();
IExpression routeWeightExpression = createRouteWeightConstraintPatternExpression(dse);
constraints.add(createExplorationConstraint(Boolean.class, createResourceDimension(),
routeWeightExpression, "BandwidthWeight", false));
......@@ -110,6 +110,10 @@ public class BusBandwidthOptimizationPatternFXController extends PatternFXContro
minButton.isSelected());
ExplorationObjective<?> objective = createExplorationObjective(Double.class,
createUserDefinedDimension(getCategory()), expr, getExplorationTargetName());
constraints
.forEach(c -> ((List<IExplorationTarget>)(List<?>)objective.getContainedTargets())
.add((IExplorationTarget<?>)c));
// objective.getContainedTargets().addAll(constraints);
// TODO(AD): How to return constraints?
return objective;
......@@ -172,13 +176,14 @@ public class BusBandwidthOptimizationPatternFXController extends PatternFXContro
SuperSet<TransmissionUnit> transmissionUnits =
dse.getCurrentStep().getSuperSetMap().get(TransmissionUnit.class);
DynamicTreeTableUIProviderBase uiProvider = createNameProvider();
@SuppressWarnings("unchecked") DynamicTreeUIProviderBase<EObject> uiProvider =
(DynamicTreeUIProviderBase<EObject>)(DynamicTreeUIProviderBase<?>)createNameProvider();
DynamicTreeTableViewer<EObject> viewer =
new DynamicTreeTableViewer<EObject>(view, transmissionUnits, false, 0,
new SuperSetContentProvider<TransmissionUnit>(), uiProvider);
// The constructed Object is not needed. It is called from the passed TreeView.
new DynamicTreeViewer<EObject>(view, transmissionUnits, false, 0,
new SuperSetContentProvider<TransmissionUnit>(), uiProvider);
// add a column with transmission units
viewer.addColumn("Transmission Unit", 230, true);
// viewer.addColumn("Transmission Unit", 230, true);
// add the radio buttons for switching from minimize to maximize
final ToggleGroup group = new ToggleGroup();
......
ExplorationSolutionVisualizationUtils.java 089540ba52f75b4a5024fa2ed7826d906e4ddde0 YELLOW
ExplorationUiUtils.java 8e4d9a1095f5ef5fc7de5685b5b7f8c59ee325c1 GREEN
ExplorationUiUtils.java 01eb41fba9d1188925fe1bcf0184faa5185581ea YELLOW
SpiderChartUtils.java 885d37e537db3b6128c08a4c98247f3a9613d9bf GREEN
......@@ -18,7 +18,7 @@ package org.fortiss.af3.exploration.ui.util;
import org.eclipse.jface.viewers.ComboViewer;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeTableUIProviderBase;
import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeUIProviderBase;
import org.fortiss.tooling.kernel.model.INamedElement;
/**
......@@ -48,12 +48,12 @@ public class ExplorationUiUtils {
* Creates a provider for a simple {@TreeTableView} where only names of elements need to be
* displayed.
*/
public static DynamicTreeTableUIProviderBase createNameProvider() {
return new DynamicTreeTableUIProviderBase() {
public static DynamicTreeUIProviderBase<INamedElement> createNameProvider() {
return new DynamicTreeUIProviderBase<INamedElement>() {
/** {@inheritDoc} */
@Override
public String getLabel(Object element, int column) {
return (element instanceof INamedElement) ? ((INamedElement)element).getName() : "";
public String getLabel(INamedElement element) {
return element.getName();
}
};
}
......
......@@ -2,7 +2,7 @@ DSEProjectModelElementFactory.java a56e2cd564383726898336469ebc3203186e992f GREE
DSESolutionConversionUtils.java a6ccbba92864c653d1518a92455e87c17f7cc72b GREEN
DSMLModelElementFactory.java 8081a2d7e2a1ee311b830305854bb60bb7572d91 GREEN
DSMLUtils.java c07eeef09787cea9db98533d346e3e384a232593 GREEN
ExplorationModelElementFactory.java 8a99b80df81bd80eafd1f332c017e63b4732ec2b YELLOW
ExplorationModelElementFactory.java 2c1c16a25b94002738be9a0576879b360e75a8db YELLOW
ExplorationReflectionUtils.java 62731e1cef32fe93f2c2017f93f5ba1f054d5197 GREEN
ExplorationUtils.java c25fb91b735472c9bb1149571aa28926e2f71906 YELLOW
ModelSnapshotExtractUtils.java 4f023e1247701c0e8f329575caddbbcac0066200 GREEN
......
......@@ -72,6 +72,7 @@ public class ExplorationModelElementFactory {
IProblemDimension probDim, IExpression expr, String name) {
ExplorationObjective<T> objective =
ExplorationFactory.eINSTANCE.createExplorationObjective();
objective.setResultType(returnType);
objective.setExpression(expr);
objective.setProblemDimension(probDim);
objective.setName(name);
......@@ -98,6 +99,7 @@ public class ExplorationModelElementFactory {
IProblemDimension probDim, IExpression expr, String name, boolean isImplicit) {
ExplorationConstraint<T> constraint =
ExplorationFactory.eINSTANCE.createExplorationConstraint();
constraint.setResultType(returnType);
constraint.setExpression(expr);
constraint.setProblemDimension(probDim);
constraint.setName(name);
......@@ -169,11 +171,26 @@ public class ExplorationModelElementFactory {
return singleSolution;
}
/**
* Creates an {@link ExplorationResult} with the given value.
*
* @param valueType
* type of the passed value.
* @param value
* value.
* @return the created {@link ExplorationResult}.
*/
public static <T> ExplorationResult<T> createExplorationResult(Class<T> valueType, T value) {
ExplorationResult<T> result = createExplorationResult();
result.setResult(value);
return result;
}
/**
* Creates an {@link ExplorationResult} that wraps a metric value obtained from the DSE for a
* particular {@link IExplorationTarget}.
*/
public static <T> ExplorationResult<T> createExplorationResult() {
private static <T> ExplorationResult<T> createExplorationResult() {
return SolutionsFactory.eINSTANCE.createExplorationResult();
}
......
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