Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
vadere
vadere
Commits
0117e14f
Commit
0117e14f
authored
Jun 22, 2018
by
Stefan Schuhbaeck
Browse files
#78
Test for null and replace with -1 and log this as warning
parent
c8667eba
Changes
2
Hide whitespace changes
Inline
Side-by-side
VadereSimulator/src/org/vadere/simulator/projects/dataprocessing/datakey/TimestepPedestrianIdKey.java
View file @
0117e14f
...
...
@@ -38,6 +38,14 @@ public class TimestepPedestrianIdKey implements DataKey<TimestepPedestrianIdKey>
return
new
String
[]
{
TimestepKey
.
getHeader
(),
PedestrianIdKey
.
getHeader
()
};
}
@Override
public
String
toString
()
{
return
"TimestepPedestrianIdKey{"
+
"timestep="
+
timestep
+
", pedestrianId="
+
pedestrianId
+
'}'
;
}
@Override
public
int
hashCode
()
{
final
int
prime
=
31
;
...
...
VadereSimulator/src/org/vadere/simulator/projects/dataprocessing/processor/PedestrianGroupIDProcessor.java
View file @
0117e14f
package
org.vadere.simulator.projects.dataprocessing.processor
;
import
org.apache.log4j.LogManager
;
import
org.apache.log4j.Logger
;
import
org.vadere.annotation.factories.dataprocessors.DataProcessorClass
;
import
org.vadere.simulator.control.SimulationState
;
import
org.vadere.simulator.models.MainModel
;
...
...
@@ -9,10 +11,13 @@ import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import
org.vadere.simulator.projects.dataprocessing.datakey.TimestepPedestrianIdKey
;
import
java.util.Optional
;
import
java.util.Random
;
@DataProcessorClass
public
class
PedestrianGroupIDProcessor
extends
DataProcessor
<
TimestepPedestrianIdKey
,
Integer
>{
private
static
Logger
logger
=
LogManager
.
getLogger
(
PedestrianGroupIDProcessor
.
class
);
public
PedestrianGroupIDProcessor
(){
super
(
"groupId"
);
}
...
...
@@ -42,6 +47,12 @@ public class PedestrianGroupIDProcessor extends DataProcessor<TimestepPedestrian
public
String
[]
toStrings
(
TimestepPedestrianIdKey
key
){
Integer
i
=
this
.
getValue
(
key
);
if
(
i
==
null
)
{
logger
.
warn
(
String
.
format
(
"PedestrianGroupIDProcessor does not has Data for Key: %s"
,
key
.
toString
()));
i
=
-
1
;
}
return
new
String
[]{
Integer
.
toString
(
i
)};
}
}
Stefan Schuhbaeck
@stsc
mentioned in issue
#78 (closed)
·
Jun 22, 2018
mentioned in issue
#78 (closed)
mentioned in issue #78
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment