Commit 0d810f47 authored by Benedikt Kleinmeier's avatar Benedikt Kleinmeier

Renamed exception "NotSupportedEvent" to "UnsupportedEventException" to...

Renamed exception "NotSupportedEvent" to "UnsupportedEventException" to respect Java's naming convention.
parent 60cc9b0d
Pipeline #92946 failed with stages
in 4 minutes and 15 seconds
{
"name" : "00-NotSupportedEventTest",
"name" : "00-UnsupportedEventExceptionTest",
"description" : "",
"release" : "0.7",
"commithash" : "60cc9b0d70a1925c79a90f3718a9d1867476d321",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
......
......@@ -2,7 +2,7 @@ package org.vadere.simulator.models.bhm;
import org.vadere.state.attributes.models.AttributesBHM;
import org.vadere.state.attributes.scenario.AttributesAgent;
import org.vadere.state.events.exceptions.NotSupportedEvent;
import org.vadere.state.events.exceptions.UnsupportedEventException;
import org.vadere.state.events.types.ElapsedTimeEvent;
import org.vadere.state.events.types.Event;
import org.vadere.state.events.types.WaitEvent;
......@@ -162,7 +162,7 @@ public class PedestrianBHM extends Pedestrian {
} else if (mostImportantEvent instanceof WaitEvent || mostImportantEvent instanceof WaitInAreaEvent) {
timeOfNextStep += durationNextStep;
} else {
throw new NotSupportedEvent(mostImportantEvent, this.getClass());
throw new UnsupportedEventException(mostImportantEvent, this.getClass());
}
getFootSteps().add(new FootStep(position, getPosition(), timeOfNextStep, timeOfNextStep + durationNextStep));
......
......@@ -8,7 +8,7 @@ import org.vadere.state.attributes.Attributes;
import org.vadere.state.attributes.models.AttributesBHM;
import org.vadere.state.attributes.models.AttributesBMM;
import org.vadere.state.attributes.scenario.AttributesAgent;
import org.vadere.state.events.exceptions.NotSupportedEvent;
import org.vadere.state.events.exceptions.UnsupportedEventException;
import org.vadere.state.scenario.DynamicElement;
import org.vadere.state.scenario.Pedestrian;
import org.vadere.state.scenario.Topography;
......@@ -97,7 +97,7 @@ public class BiomechanicsModel implements MainModel {
List<VPoint> positions = pedestriansBMM.stream().map(ped -> ped.getPosition()).collect(Collectors.toList());
NotSupportedEvent.throwExceptionIfNotElapsedTimeEvent(pedestriansBMM, this.getClass());
UnsupportedEventException.throwIfNotElapsedTimeEvent(pedestriansBMM, this.getClass());
for (PedestrianBMM agent : pedestriansBMM) {
agent.update(simTimeInSec, deltaTime);
......
......@@ -14,7 +14,7 @@ import org.vadere.simulator.models.potential.fields.IPotentialFieldTarget;
import org.vadere.state.attributes.Attributes;
import org.vadere.state.attributes.models.AttributesGNM;
import org.vadere.state.attributes.scenario.AttributesAgent;
import org.vadere.state.events.exceptions.NotSupportedEvent;
import org.vadere.state.events.exceptions.UnsupportedEventException;
import org.vadere.state.scenario.DynamicElement;
import org.vadere.state.scenario.Pedestrian;
import org.vadere.state.scenario.Target;
......@@ -148,7 +148,7 @@ public class GradientNavigationModel extends ODEModel<Pedestrian, AttributesAgen
Collection<Pedestrian> pedestrians = topography.getElements(Pedestrian.class);
NotSupportedEvent.throwExceptionIfNotElapsedTimeEvent(pedestrians, this.getClass());
UnsupportedEventException.throwIfNotElapsedTimeEvent(pedestrians, this.getClass());
// set gradient provider and pedestrians
equations.setElements(pedestrians);
......
......@@ -19,7 +19,7 @@ import org.vadere.simulator.models.reynolds.behaviour.Wander;
import org.vadere.state.attributes.Attributes;
import org.vadere.state.attributes.models.AttributesReynolds;
import org.vadere.state.attributes.scenario.AttributesAgent;
import org.vadere.state.events.exceptions.NotSupportedEvent;
import org.vadere.state.events.exceptions.UnsupportedEventException;
import org.vadere.state.scenario.DynamicElement;
import org.vadere.state.scenario.Pedestrian;
import org.vadere.state.scenario.Topography;
......@@ -77,7 +77,7 @@ public class ReynoldsSteeringModel implements MainModel {
public void update(final double simTimeInSec) {
Collection<Pedestrian> pedestrians = topography.getElements(Pedestrian.class);
NotSupportedEvent.throwExceptionIfNotElapsedTimeEvent(pedestrians, this.getClass());
UnsupportedEventException.throwIfNotElapsedTimeEvent(pedestrians, this.getClass());
Iterator<Pedestrian> it = pedestrians.iterator();
double maxSpeed = 3;
......
......@@ -12,7 +12,7 @@ import org.vadere.simulator.models.potential.fields.PotentialFieldObstacle;
import org.vadere.state.attributes.Attributes;
import org.vadere.state.attributes.models.AttributesSFM;
import org.vadere.state.attributes.scenario.AttributesAgent;
import org.vadere.state.events.exceptions.NotSupportedEvent;
import org.vadere.state.events.exceptions.UnsupportedEventException;
import org.vadere.state.scenario.DynamicElement;
import org.vadere.state.scenario.Pedestrian;
import org.vadere.state.scenario.Target;
......@@ -140,7 +140,7 @@ public class SocialForceModel extends ODEModel<Pedestrian, AttributesAgent> {
Collection<Pedestrian> pedestrians = topography.getElements(Pedestrian.class);
NotSupportedEvent.throwExceptionIfNotElapsedTimeEvent(pedestrians, this.getClass());
UnsupportedEventException.throwIfNotElapsedTimeEvent(pedestrians, this.getClass());
// set gradient provider and pedestrians
equations.setElements(pedestrians);
......
......@@ -10,21 +10,21 @@ import java.util.Collection;
/**
* Use this exception if an event-handling class does not support a specific event.
*/
public class NotSupportedEvent extends RuntimeException {
public class UnsupportedEventException extends RuntimeException {
public NotSupportedEvent(@NotNull Event unsupportedEvent, @NotNull Class implementingClass) {
public UnsupportedEventException(@NotNull Event unsupportedEvent, @NotNull Class implementingClass) {
super(String.format("Event \"%s\" not supported by class \"%s\"!",
unsupportedEvent.getClass().getSimpleName(),
implementingClass.getSimpleName())
);
}
public static void throwExceptionIfNotElapsedTimeEvent(Collection<? extends Pedestrian> pedestrians, Class caller) {
public static void throwIfNotElapsedTimeEvent(Collection<? extends Pedestrian> pedestrians, Class caller) {
for (Pedestrian pedestrian : pedestrians) {
Event currentEvent = pedestrian.getMostImportantEvent();
if ((currentEvent instanceof ElapsedTimeEvent) == false) {
throw new NotSupportedEvent(currentEvent, caller);
throw new UnsupportedEventException(currentEvent, caller);
}
}
}
......
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