Notice to GitKraken users: A vulnerability has been found in the SSH key generation of GitKraken versions 7.6.0 to 8.0.0 (https://www.gitkraken.com/blog/weak-ssh-key-fix). If you use GitKraken and have generated a SSH key using one of these versions, please remove it both from your local workstation and from your LRZ GitLab profile.

21.10.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit 7abc786b authored by Mario Teixeira Parente's avatar Mario Teixeira Parente
Browse files

Rename 'Processor' base class to 'DataProcessor'

parent a2e6a08b
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"startTime" : 0.0, "startTime" : 0.0,
"endTime" : 1.7976931348623157E308 "endTime" : 1.7976931348623157E308
}, },
"processor" : { "dataProcessor" : {
"pedestrianWaitingTimeProcessor" : { "pedestrianWaitingTimeProcessor" : {
"attributes" : { "attributes" : {
"waitingArea" : { "waitingArea" : {
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
"startTime" : 0.0, "startTime" : 0.0,
"endTime" : 1.7976931348623157E308 "endTime" : 1.7976931348623157E308
}, },
"processor" : { "dataProcessor" : {
"attributes" : { "attributes" : {
"maxEvacuationTime" : 1.0, "maxEvacuationTime" : 1.0,
"maxEvacuationTimeMean" : 1.0, "maxEvacuationTimeMean" : 1.0,
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"startTime" : 0.0, "startTime" : 0.0,
"endTime" : 1.7976931348623157E308 "endTime" : 1.7976931348623157E308
}, },
"processor" : { "dataProcessor" : {
"pedestrianWaitingTimeProcessor" : { "pedestrianWaitingTimeProcessor" : {
"attributes" : { "attributes" : {
"waitingArea" : { "waitingArea" : {
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
"startTime" : 0.0, "startTime" : 0.0,
"endTime" : 1.7976931348623157E308 "endTime" : 1.7976931348623157E308
}, },
"processor" : { "dataProcessor" : {
"attributes" : { "attributes" : {
"maxEvacuationTime" : 1.0, "maxEvacuationTime" : 1.0,
"maxEvacuationTimeMean" : 1.0, "maxEvacuationTimeMean" : 1.0,
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
"startTime" : 0.0, "startTime" : 0.0,
"endTime" : 1.7976931348623157E308 "endTime" : 1.7976931348623157E308
}, },
"processor" : { "dataProcessor" : {
"densityProcessor" : { "densityProcessor" : {
"attributes" : { "attributes" : {
"scale" : 10.0, "scale" : 10.0,
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"startTime" : 0.0, "startTime" : 0.0,
"endTime" : 1.7976931348623157E308 "endTime" : 1.7976931348623157E308
}, },
"processor" : { "dataProcessor" : {
"pedestrianWaitingTimeProcessor" : { "pedestrianWaitingTimeProcessor" : {
"attributes" : { "attributes" : {
"waitingArea" : { "waitingArea" : {
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
"startTime" : 0.0, "startTime" : 0.0,
"endTime" : 1.7976931348623157E308 "endTime" : 1.7976931348623157E308
}, },
"processor" : { "dataProcessor" : {
"attributes" : { "attributes" : {
"maxEvacuationTime" : 1.0, "maxEvacuationTime" : 1.0,
"maxEvacuationTimeMean" : 1.0, "maxEvacuationTimeMean" : 1.0,
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"startTime" : 0.0, "startTime" : 0.0,
"endTime" : 1.7976931348623157E308 "endTime" : 1.7976931348623157E308
}, },
"processor" : { "dataProcessor" : {
"pedestrianWaitingTimeProcessor" : { "pedestrianWaitingTimeProcessor" : {
"attributes" : { "attributes" : {
"waitingArea" : { "waitingArea" : {
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
"startTime" : 0.0, "startTime" : 0.0,
"endTime" : 1.7976931348623157E308 "endTime" : 1.7976931348623157E308
}, },
"processor" : { "dataProcessor" : {
"attributes" : { "attributes" : {
"maxEvacuationTime" : 1.0, "maxEvacuationTime" : 1.0,
"maxEvacuationTimeMean" : 1.0, "maxEvacuationTimeMean" : 1.0,
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"startTime" : 0.0, "startTime" : 0.0,
"endTime" : 1.7976931348623157E308 "endTime" : 1.7976931348623157E308
}, },
"processor" : { "dataProcessor" : {
"pedestrianWaitingTimeProcessor" : { "pedestrianWaitingTimeProcessor" : {
"attributes" : { "attributes" : {
"waitingArea" : { "waitingArea" : {
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
"startTime" : 0.0, "startTime" : 0.0,
"endTime" : 1.7976931348623157E308 "endTime" : 1.7976931348623157E308
}, },
"processor" : { "dataProcessor" : {
"attributes" : { "attributes" : {
"maxEvacuationTime" : 1.0, "maxEvacuationTime" : 1.0,
"maxEvacuationTimeMean" : 1.0, "maxEvacuationTimeMean" : 1.0,
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"startTime" : 0.0, "startTime" : 0.0,
"endTime" : 1.7976931348623157E308 "endTime" : 1.7976931348623157E308
}, },
"processor" : { "dataProcessor" : {
"pedestrianWaitingTimeProcessor" : { "pedestrianWaitingTimeProcessor" : {
"attributes" : { "attributes" : {
"waitingArea" : { "waitingArea" : {
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
"startTime" : 0.0, "startTime" : 0.0,
"endTime" : 1.7976931348623157E308 "endTime" : 1.7976931348623157E308
}, },
"processor" : { "dataProcessor" : {
"attributes" : { "attributes" : {
"maxEvacuationTime" : 1.0, "maxEvacuationTime" : 1.0,
"maxEvacuationTimeMean" : 1.0, "maxEvacuationTimeMean" : 1.0,
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"startTime" : 0.0, "startTime" : 0.0,
"endTime" : 1.7976931348623157E308 "endTime" : 1.7976931348623157E308
}, },
"processor" : { "dataProcessor" : {
"attributes" : { "attributes" : {
"maxEvacuationTime" : 34.0, "maxEvacuationTime" : 34.0,
"maxEvacuationTimeMean" : 34.0, "maxEvacuationTimeMean" : 34.0,
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"startTime" : 0.0, "startTime" : 0.0,
"endTime" : 1.7976931348623157E308 "endTime" : 1.7976931348623157E308
}, },
"processor" : { "dataProcessor" : {
"attributes" : { "attributes" : {
"maxEvacuationTime" : 34.0, "maxEvacuationTime" : 34.0,
"maxEvacuationTimeMean" : 34.0, "maxEvacuationTimeMean" : 34.0,
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"startTime" : 0.0, "startTime" : 0.0,
"endTime" : 1.7976931348623157E308 "endTime" : 1.7976931348623157E308
}, },
"processor" : { "dataProcessor" : {
"attributes" : { "attributes" : {
"maxEvacuationTime" : 70.0, "maxEvacuationTime" : 70.0,
"maxEvacuationTimeMean" : 50.0, "maxEvacuationTimeMean" : 50.0,
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
"startTime" : 0.0, "startTime" : 0.0,
"endTime" : 1.7976931348623157E308 "endTime" : 1.7976931348623157E308
}, },
"processor" : { "dataProcessor" : {
"pedestrianWaitingTimeProcessor" : { "pedestrianWaitingTimeProcessor" : {
"attributes" : { "attributes" : {
"waitingArea" : { "waitingArea" : {
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"startTime" : 0.0, "startTime" : 0.0,
"endTime" : 1.7976931348623157E308 "endTime" : 1.7976931348623157E308
}, },
"processor" : { "dataProcessor" : {
"attributes" : { "attributes" : {
"maxEvacuationTime" : 140.0, "maxEvacuationTime" : 140.0,
"maxEvacuationTimeMean" : 140.0, "maxEvacuationTimeMean" : 140.0,
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"startTime" : 0.0, "startTime" : 0.0,
"endTime" : 1.7976931348623157E308 "endTime" : 1.7976931348623157E308
}, },
"processor" : { "dataProcessor" : {
"columnNames" : [ ], "columnNames" : [ ],
"clazz" : "PedestrianLastPositionProcessor" "clazz" : "PedestrianLastPositionProcessor"
} }
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"startTime" : 0.0, "startTime" : 0.0,
"endTime" : 1.7976931348623157E308 "endTime" : 1.7976931348623157E308
}, },
"processor" : { "dataProcessor" : {
"pedestrianDensityProcessor" : { "pedestrianDensityProcessor" : {
"densityProcessor" : { "densityProcessor" : {
"attributes" : { "attributes" : {
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
"startTime" : 0.0, "startTime" : 0.0,
"endTime" : 1.7976931348623157E308 "endTime" : 1.7976931348623157E308
}, },
"processor" : { "dataProcessor" : {
"pedestrianDensityProcessor" : { "pedestrianDensityProcessor" : {
"densityProcessor" : { "densityProcessor" : {
"attributes" : { "attributes" : {
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
"startTime" : 0.0, "startTime" : 0.0,
"endTime" : 1.7976931348623157E308 "endTime" : 1.7976931348623157E308
}, },
"processor" : { "dataProcessor" : {
"attributes" : { "attributes" : {
"maxEvacuationTime" : 200.0, "maxEvacuationTime" : 200.0,
"maxEvacuationTimeMean" : 150.0, "maxEvacuationTimeMean" : 150.0,
......
...@@ -12,9 +12,9 @@ import com.fasterxml.jackson.databind.node.ArrayNode; ...@@ -12,9 +12,9 @@ import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.ObjectNode;
import org.vadere.simulator.projects.dataprocessing.outputfile.OutputFile; import org.vadere.simulator.projects.dataprocessing.outputfile.OutputFile;
import org.vadere.simulator.projects.dataprocessing.processor.Processor; import org.vadere.simulator.projects.dataprocessing.processor.DataProcessor;
import org.vadere.simulator.projects.dataprocessing.store.DataProcessorStore;
import org.vadere.simulator.projects.dataprocessing.store.OutputFileStore; import org.vadere.simulator.projects.dataprocessing.store.OutputFileStore;
import org.vadere.simulator.projects.dataprocessing.store.ProcessorStore;
import org.vadere.simulator.projects.io.JsonConverter; import org.vadere.simulator.projects.io.JsonConverter;
import org.vadere.state.attributes.processor.AttributesProcessor; import org.vadere.state.attributes.processor.AttributesProcessor;
import org.vadere.util.reflection.DynamicClassInstantiator; import org.vadere.util.reflection.DynamicClassInstantiator;
...@@ -48,19 +48,19 @@ public class DataProcessingJsonManager { ...@@ -48,19 +48,19 @@ public class DataProcessingJsonManager {
public static ObjectWriter writer; public static ObjectWriter writer;
private static final DynamicClassInstantiator<OutputFile<?>> outputFileInstantiator; private static final DynamicClassInstantiator<OutputFile<?>> outputFileInstantiator;
private static final DynamicClassInstantiator<Processor<?, ?>> processorInstantiator; private static final DynamicClassInstantiator<DataProcessor<?, ?>> processorInstantiator;
private List<OutputFile<?>> outputFiles; private List<OutputFile<?>> outputFiles;
private List<Processor<?, ?>> processors; private List<DataProcessor<?, ?>> dataProcessors;
static { static {
mapper = JsonConverter.getMapper(); mapper = JsonConverter.getMapper();
writer = mapper.writerWithDefaultPrettyPrinter(); writer = mapper.writerWithDefaultPrettyPrinter();
SimpleModule sm = new SimpleModule(); SimpleModule sm = new SimpleModule();
sm.addDeserializer(ProcessorStore.class, new JsonDeserializer<ProcessorStore>() { sm.addDeserializer(DataProcessorStore.class, new JsonDeserializer<DataProcessorStore>() {
@Override @Override
public ProcessorStore deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException { public DataProcessorStore deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
return null; return null;
...@@ -74,7 +74,7 @@ public class DataProcessingJsonManager { ...@@ -74,7 +74,7 @@ public class DataProcessingJsonManager {
public DataProcessingJsonManager() { public DataProcessingJsonManager() {
this.outputFiles = new ArrayList<>(); this.outputFiles = new ArrayList<>();
this.processors = new ArrayList<>(); this.dataProcessors = new ArrayList<>();
} }
public void addOutputFile(final OutputFileStore fileStore) { public void addOutputFile(final OutputFileStore fileStore) {
...@@ -88,11 +88,11 @@ public class DataProcessingJsonManager { ...@@ -88,11 +88,11 @@ public class DataProcessingJsonManager {
this.outputFiles.add(file); this.outputFiles.add(file);
} }
public void addProcessor(final ProcessorStore processorStore) { public void addProcessor(final DataProcessorStore dataProcessorStore) {
Processor<?, ?> processor = processorInstantiator.createObject(processorStore.getType()); DataProcessor<?, ?> dataProcessor = processorInstantiator.createObject(dataProcessorStore.getType());
processor.setId(processorStore.getId()); dataProcessor.setId(dataProcessorStore.getId());
processor.setAttributes(processorStore.getAttributes()); dataProcessor.setAttributes(dataProcessorStore.getAttributes());
this.processors.add(processor); this.dataProcessors.add(dataProcessor);
} }
private static JsonNode serializeOutputFile(final OutputFile outputFile) { private static JsonNode serializeOutputFile(final OutputFile outputFile) {
...@@ -110,17 +110,17 @@ public class DataProcessingJsonManager { ...@@ -110,17 +110,17 @@ public class DataProcessingJsonManager {
return node; return node;
} }
private static JsonNode serializeProcessor(final Processor processor) { private static JsonNode serializeProcessor(final DataProcessor dataProcessor) {
ObjectNode node = mapper.createObjectNode(); ObjectNode node = mapper.createObjectNode();
node.put(TYPE_KEY, processor.getClass().getName()); node.put(TYPE_KEY, dataProcessor.getClass().getName());
node.put(PROCESSORID_KEY, processor.getId()); node.put(PROCESSORID_KEY, dataProcessor.getId());
if (processor.getAttributes() != null) { if (dataProcessor.getAttributes() != null) {
node.put(ATTRIBUTESTYPE_KEY, processor.getAttributes().getClass().getName()); node.put(ATTRIBUTESTYPE_KEY, dataProcessor.getAttributes().getClass().getName());
if (!processor.getAttributes().getClass().equals(AttributesProcessor.class)) { if (!dataProcessor.getAttributes().getClass().equals(AttributesProcessor.class)) {
node.set(ATTRIBUTES_KEY, mapper.convertValue(processor.getAttributes(), JsonNode.class)); node.set(ATTRIBUTES_KEY, mapper.convertValue(dataProcessor.getAttributes(), JsonNode.class));
} }
} }
...@@ -143,7 +143,7 @@ public class DataProcessingJsonManager { ...@@ -143,7 +143,7 @@ public class DataProcessingJsonManager {
}); });
// part 2: processor // part 2: processor
this.processors.forEach(proc -> { this.dataProcessors.forEach(proc -> {
processorsArrayNode.add(serializeProcessor(proc)); processorsArrayNode.add(serializeProcessor(proc));
}); });
...@@ -192,15 +192,15 @@ public class DataProcessingJsonManager { ...@@ -192,15 +192,15 @@ public class DataProcessingJsonManager {
// part 2: processor // part 2: processor
if (processorsArrayNode != null) if (processorsArrayNode != null)
for (JsonNode processorNode : processorsArrayNode) { for (JsonNode processorNode : processorsArrayNode) {
ProcessorStore processorStore = deserializeProcessorStore(processorNode); DataProcessorStore dataProcessorStore = deserializeProcessorStore(processorNode);
manager.addProcessor(processorStore); manager.addProcessor(dataProcessorStore);
} }
return manager; return manager;
} }
private static ProcessorStore deserializeProcessorStore(JsonNode node) { private static DataProcessorStore deserializeProcessorStore(JsonNode node) {
ProcessorStore store = new ProcessorStore(); DataProcessorStore store = new DataProcessorStore();
store.setType(node.get(TYPE_KEY).asText()); store.setType(node.get(TYPE_KEY).asText());
store.setId(node.get(PROCESSORID_KEY).asInt()); store.setId(node.get(PROCESSORID_KEY).asInt());
...@@ -221,6 +221,6 @@ public class DataProcessingJsonManager { ...@@ -221,6 +221,6 @@ public class DataProcessingJsonManager {
} }
public ProcessorManager createProcessorManager() { public ProcessorManager createProcessorManager() {
return new ProcessorManager(this, this.processors, this.outputFiles); return new ProcessorManager(this, this.dataProcessors, this.outputFiles);
} }
} }
...@@ -2,7 +2,7 @@ package org.vadere.simulator.projects.dataprocessing; ...@@ -2,7 +2,7 @@ package org.vadere.simulator.projects.dataprocessing;
import org.vadere.simulator.projects.dataprocessing.store.OutputDefinitionStore; import org.vadere.simulator.projects.dataprocessing.store.OutputDefinitionStore;
import org.vadere.simulator.projects.dataprocessing.store.OutputFileStore; import org.vadere.simulator.projects.dataprocessing.store.OutputFileStore;
import org.vadere.simulator.projects.dataprocessing.store.ProcessorStore; import org.vadere.simulator.projects.dataprocessing.store.DataProcessorStore;
import java.util.Arrays; import java.util.Arrays;
...@@ -13,12 +13,12 @@ public final class OutputPresets { ...@@ -13,12 +13,12 @@ public final class OutputPresets {
private OutputPresets() { private OutputPresets() {
this.outputDefinition = new OutputDefinitionStore(); this.outputDefinition = new OutputDefinitionStore();
ProcessorStore processor1 = new ProcessorStore(); DataProcessorStore processor1 = new DataProcessorStore();
processor1.setType("org.vadere.simulator.projects.dataprocessing.processor.PedestrianPositionProcessor"); processor1.setType("org.vadere.simulator.projects.dataprocessing.processor.PedestrianPositionProcessor");
processor1.setId(1); processor1.setId(1);
this.outputDefinition.addProcessor(processor1); this.outputDefinition.addProcessor(processor1);
ProcessorStore processor2 = new ProcessorStore(); DataProcessorStore processor2 = new DataProcessorStore();
processor2.setType("org.vadere.simulator.projects.dataprocessing.processor.PedestrianTargetIdProcessor"); processor2.setType("org.vadere.simulator.projects.dataprocessing.processor.PedestrianTargetIdProcessor");
processor2.setId(2); processor2.setId(2);
this.outputDefinition.addProcessor(processor2); this.outputDefinition.addProcessor(processor2);
......
...@@ -6,7 +6,7 @@ import com.fasterxml.jackson.databind.JsonNode; ...@@ -6,7 +6,7 @@ import com.fasterxml.jackson.databind.JsonNode;
import org.vadere.simulator.control.SimulationState; import org.vadere.simulator.control.SimulationState;
import org.vadere.simulator.models.Model; import org.vadere.simulator.models.Model;
import org.vadere.simulator.projects.dataprocessing.outputfile.OutputFile; import org.vadere.simulator.projects.dataprocessing.outputfile.OutputFile;
import org.vadere.simulator.projects.dataprocessing.processor.Processor; import org.vadere.simulator.projects.dataprocessing.processor.DataProcessor;
import org.vadere.util.io.IOUtils; import org.vadere.util.io.IOUtils;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
...@@ -18,19 +18,19 @@ public class ProcessorManager { ...@@ -18,19 +18,19 @@ public class ProcessorManager {
private Model model; private Model model;
private Map<Integer, Processor<?, ?>> processorMap; private Map<Integer, DataProcessor<?, ?>> processorMap;
private List<OutputFile<?>> outputFiles; private List<OutputFile<?>> outputFiles;
public ProcessorManager(DataProcessingJsonManager jsonManager, List<Processor<?, ?>> processors, List<OutputFile<?>> outputFiles) { public ProcessorManager(DataProcessingJsonManager jsonManager, List<DataProcessor<?, ?>> dataProcessors, List<OutputFile<?>> outputFiles) {
this.jsonManager = jsonManager; this.jsonManager = jsonManager;
this.outputFiles = outputFiles; this.outputFiles = outputFiles;
this.processorMap = new LinkedHashMap<>(); this.processorMap = new LinkedHashMap<>();
for (Processor<?, ?> proc : processors) for (DataProcessor<?, ?> proc : dataProcessors)
this.processorMap.put(proc.getId(), proc); this.processorMap.put(proc.getId(), proc);
processors.forEach(proc -> proc.init(this)); dataProcessors.forEach(proc -> proc.init(this));
} }
public void setModel(Model model) { public void setModel(Model model) {
...@@ -41,7 +41,7 @@ public class ProcessorManager { ...@@ -41,7 +41,7 @@ public class ProcessorManager {
outputFiles.forEach(file -> file.init(this)); outputFiles.forEach(file -> file.init(this));
} }
public Processor<?, ?> getProcessor(int id) { public DataProcessor<?, ?> getProcessor(int id) {
return this.processorMap.containsKey(id) ? this.processorMap.get(id) : null; return this.processorMap.containsKey(id) ? this.processorMap.get(id) : null;
} }
......
package org.vadere.simulator.projects.dataprocessing.outputfile; package org.vadere.simulator.projects.dataprocessing.outputfile;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager; import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.dataprocessing.processor.Processor; import org.vadere.simulator.projects.dataprocessing.processor.DataProcessor;