Die Migration der Bereiche "Docker Registry" und "Artifiacts" ist fast abgeschlossen. Die letzten Daten werden im Laufe des heutigen Abend (05.08.2021) noch vollständig hochgeladen. Das Anlegen neuer Images und Artifacts funktioniert bereits wieder.

Commit 72b93704 authored by Hengwen Zhang's avatar Hengwen Zhang
Browse files

Add getter for goals

parent 8bfd8723
......@@ -7,6 +7,7 @@ import de.rwth.montisim.simulation.vehicle.task.goal.*;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;
@Typed
public class Task {
......@@ -17,6 +18,9 @@ public class Task {
}
public void addGoal(Goal goal) {
if (goal instanceof PathGoal && getPathGoals().size() > 0){
throw new RuntimeException("Only one path goal per task is allowed");
}
goals.add(goal);
}
......@@ -44,4 +48,17 @@ public class Task {
return goals;
}
public List<PathGoal> getPathGoals() {
return goals.stream()
.filter(g -> g instanceof PathGoal)
.map(g -> (PathGoal) g)
.collect(Collectors.toList());
}
public List<MetricGoal> getMetricGoals() {
return goals.stream()
.filter(g -> g instanceof MetricGoal)
.map(g -> (MetricGoal) g)
.collect(Collectors.toList());
}
}
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