Commit 696cffc9 authored by Stefan Schuhbaeck's avatar Stefan Schuhbaeck

add new Processor key and file class for new overlap processor

parent 281c9ee1
package org.vadere.simulator.projects.dataprocessing.datakey;
import org.jetbrains.annotations.NotNull;
import org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOverlapOutputFile;
import java.util.Objects;
@OutputFileMap(outputFileClass = TimestepPedestrianIdOverlapOutputFile.class)
public class TimestepPedestrianIdOverlap implements DataKey<TimestepPedestrianIdOverlap> {
private final int timeStep;
private final int pedId1;
private final int pedId2;
public TimestepPedestrianIdOverlap(int timeStep, int pedId1, int pedId2) {
this.timeStep = timeStep;
this.pedId1 = pedId1;
this.pedId2 = pedId2;
}
public static String[] getHeaders(){
return new String[]{TimestepKey.getHeader(), PedestrianIdKey.getHeader(), "overlapedWithPedestrianId"};
}
public int getTimeStep() {
return timeStep;
}
public int getPedId1() {
return pedId1;
}
public int getPedId2() {
return pedId2;
}
public String[] toStrings(){
return new String[]{Integer.toString(timeStep), Integer.toString(pedId1), Integer.toString(pedId1)};
}
@Override
public int compareTo(@NotNull TimestepPedestrianIdOverlap o) {
int result = Integer.compare(this.timeStep, o.timeStep);
if (result == 0) {
result = Integer.compare(this.pedId1, o.pedId1);
if (result == 0){
result = Integer.compare(this.pedId2, o.pedId2);
}
}
return result;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TimestepPedestrianIdOverlap that = (TimestepPedestrianIdOverlap) o;
return timeStep == that.timeStep &&
pedId1 == that.pedId1 &&
pedId2 == that.pedId2;
}
@Override
public int hashCode() {
return Objects.hash(timeStep, pedId1, pedId2);
}
@Override
public String toString() {
return "TimestepPedestrianIdOverlap{" +
"timeStep=" + timeStep +
", pedId1=" + pedId1 +
", pedId2=" + pedId2 +
'}';
}
}
package org.vadere.simulator.projects.dataprocessing.outputfile;
import org.vadere.annotation.factories.outputfiles.OutputFileClass;
import org.vadere.simulator.projects.dataprocessing.datakey.TimestepPedestrianIdOverlap;
@OutputFileClass(dataKeyMapping = TimestepPedestrianIdOverlap.class)
public class TimestepPedestrianIdOverlapOutputFile extends OutputFile<TimestepPedestrianIdOverlap>{
public TimestepPedestrianIdOverlapOutputFile() {
super(TimestepPedestrianIdOverlap.getHeaders());
}
@Override
public String[] toStrings(final TimestepPedestrianIdOverlap key){
return key.toStrings();
}
}
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