Commit 7f73d9e2 authored by Alexander Diewald's avatar Alexander Diewald
Browse files

Common: LambdaUtils: Add a more general filter by type method.

* The current filterByType methods has fairly strict expectations
  towards inheritance which restricts the use of the method.
* Add a more generic filterType method that has less restrictions
  w.r.t. the generics.
* Rename the existing method to filterTypeSafe.
refs 3203
parent 93cb901b
...@@ -5,5 +5,5 @@ DSMLModelElementFactory.java d28f1c71099bf995fe1db6b94c57ed3c2fa2be51 RED ...@@ -5,5 +5,5 @@ DSMLModelElementFactory.java d28f1c71099bf995fe1db6b94c57ed3c2fa2be51 RED
DSMLUtils.java 7bf9604b175565be9ec7d99f127ad77f32cd1f1a YELLOW DSMLUtils.java 7bf9604b175565be9ec7d99f127ad77f32cd1f1a YELLOW
DesignSpaceExplorationModelElementFactory.java 9ac2ca7f75e0ad9bc5405a25ffba24e695fbe777 RED DesignSpaceExplorationModelElementFactory.java 9ac2ca7f75e0ad9bc5405a25ffba24e695fbe777 RED
ExplorationReflectionUtils.java 840eed89abdf4bed7a555738af37f0db05178d72 YELLOW ExplorationReflectionUtils.java 840eed89abdf4bed7a555738af37f0db05178d72 YELLOW
ExplorationSolutionVisualizationTransformation.java b7fecb365e1800452a254a8a9231b4bb41f1a0e6 YELLOW ExplorationSolutionVisualizationTransformation.java 7860b0721f357e717a02402f932f1239e144c021 RED
ExplorationUtils.java 30f207ce0a2a13bb68bd80562a72474f4c478019 YELLOW ExplorationUtils.java 30f207ce0a2a13bb68bd80562a72474f4c478019 YELLOW
...@@ -19,7 +19,7 @@ import static org.fortiss.af3.exploration.util.ExplorationUtils.getReturnTypeOf; ...@@ -19,7 +19,7 @@ import static org.fortiss.af3.exploration.util.ExplorationUtils.getReturnTypeOf;
import static org.fortiss.tooling.base.utils.VisualizationModelElementFactory.createAxis; import static org.fortiss.tooling.base.utils.VisualizationModelElementFactory.createAxis;
import static org.fortiss.tooling.base.utils.VisualizationModelElementFactory.createDataSet; import static org.fortiss.tooling.base.utils.VisualizationModelElementFactory.createDataSet;
import static org.fortiss.tooling.base.utils.VisualizationModelElementFactory.createDataSetCollection; import static org.fortiss.tooling.base.utils.VisualizationModelElementFactory.createDataSetCollection;
import static org.fortiss.tooling.common.util.LambdaUtils.filterByType; import static org.fortiss.tooling.common.util.LambdaUtils.filterTypeSafe;
import javax.management.modelmbean.InvalidTargetObjectTypeException; import javax.management.modelmbean.InvalidTargetObjectTypeException;
...@@ -78,7 +78,7 @@ public class ExplorationSolutionVisualizationTransformation { ...@@ -78,7 +78,7 @@ public class ExplorationSolutionVisualizationTransformation {
public static <T> void addVisualizationFor(SingleExplorationSolutionMap expSolution, public static <T> void addVisualizationFor(SingleExplorationSolutionMap expSolution,
DataSetCollection dataSetCol) throws InvalidTargetObjectTypeException { DataSetCollection dataSetCol) throws InvalidTargetObjectTypeException {
DataSet dataSet = createDataSet(); DataSet dataSet = createDataSet();
for(ExplorationObjective<?> expObjective : filterByType(expSolution.keySet(), for(ExplorationObjective<?> expObjective : filterTypeSafe(expSolution.keySet(),
ExplorationObjective.class)) { ExplorationObjective.class)) {
@SuppressWarnings("unchecked") ExplorationObjective<T> castedObjective = @SuppressWarnings("unchecked") ExplorationObjective<T> castedObjective =
(ExplorationObjective<T>)expObjective; (ExplorationObjective<T>)expObjective;
......
Supports Markdown
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