Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Simonstrator
PeerfactSim.KOM
Commits
5c5b4b62
Commit
5c5b4b62
authored
Mar 20, 2020
by
Julian Zobel
🦄
Browse files
Added component step size list to tracefile movement (required for metrics)
parent
6445bb20
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/movement/TracefileMovementModel.java
View file @
5c5b4b62
...
...
@@ -75,13 +75,14 @@ public class TracefileMovementModel implements MovementModel, EventHandler {
protected
boolean
initialized
=
false
;
private
final
LinkedHashMap
<
SimLocationActuator
,
LinkedList
<
Step
>>
components
;
private
final
static
LinkedHashMap
<
SimLocationActuator
,
Integer
>
componentToStepSize
=
new
LinkedHashMap
<
SimLocationActuator
,
Integer
>();
private
LinkedList
<
File
>
tracefiles
;
private
boolean
first
=
true
;
public
TracefileMovementModel
()
{
components
=
new
LinkedHashMap
<
SimLocationActuator
,
LinkedList
<
Step
>>();
tracefiles
=
new
LinkedList
<
File
>();
tracefiles
=
new
LinkedList
<
File
>();
}
public
void
initialize
()
{
...
...
@@ -147,10 +148,16 @@ public class TracefileMovementModel implements MovementModel, EventHandler {
shutdownComponent
(
component
);
}
// do nothing for smoothing?
// TODO
else
{
int
stepcount
=
componentToStepSize
.
get
(
component
);
stepcount
++;
componentToStepSize
.
put
(
component
,
stepcount
);
}
}
else
{
if
(
DefaultTopology
.
isWithinWorldBoundaries
(
component
.
getRealPosition
()))
{
// TODO
long
delta
=
step
.
timestamp
-
currentTime
+
GPS_MISSING_TRACE_THRESHOLD
;
if
(
delta
>
0
&&
delta
<=
2
)
{
...
...
@@ -187,6 +194,11 @@ public class TracefileMovementModel implements MovementModel, EventHandler {
}
else
{
step
=
steps
.
pop
();
// TODO
int
stepcount
=
componentToStepSize
.
get
(
component
);
stepcount
++;
componentToStepSize
.
put
(
component
,
stepcount
);
if
(!
DefaultTopology
.
isWithinWorldBoundaries
(
component
.
getRealPosition
()))
{
component
.
updateCurrentLocation
(
new
PositionVector
(
step
.
x
,
step
.
y
));
...
...
@@ -319,6 +331,17 @@ public class TracefileMovementModel implements MovementModel, EventHandler {
// System.out.println(actuator.getHost().getId() + " <> " + tracefile.getName());
components
.
put
(
actuator
,
stepQueue
);
componentToStepSize
.
put
(
actuator
,
0
);
}
public
static
int
getComponentStepSize
(
SimLocationActuator
component
)
{
if
(!
componentToStepSize
.
containsKey
(
component
))
{
return
-
1
;
}
return
componentToStepSize
.
get
(
component
);
}
@Override
...
...
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