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
7fc458be
Commit
7fc458be
authored
Aug 10, 2017
by
Björn Richerzhagen
Browse files
Inform listeners if the end of the trajectory is reached
parent
84fd4c1b
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/movement/local/RealWorldStreetsMovement.java
View file @
7fc458be
...
...
@@ -196,6 +196,10 @@ public class RealWorldStreetsMovement extends AbstractLocalMovementStrategy {
routeSensor
.
setNewRoute
(
trajectory
);
}
newPosition
=
trajectory
.
updateCurrentLocation
(
comp
,
getMovementSpeed
(
comp
),
tolerance
);
if
(
trajectory
.
reachedDestination
())
{
routeSensor
.
reachedDestination
();
}
}
return
new
Left
<
PositionVector
,
Boolean
>(
newPosition
);
}
...
...
src/de/tud/kom/p2psim/impl/topology/movement/local/RouteImpl.java
View file @
7fc458be
...
...
@@ -70,6 +70,8 @@ public class RouteImpl implements Route {
private
int
routeSegmentsLength
;
private
boolean
reachedTarget
;
/**
*
* @param start
...
...
@@ -182,9 +184,25 @@ public class RouteImpl implements Route {
* TODO Segment handling (also inform listeners!)
*/
/*
* Reached target flag
*/
if
(
currentIndex
>=
routeLength
)
{
reachedTarget
=
true
;
}
return
newPosition
;
}
/**
* True, if the trajectory is done and the node reached the target.s
*
* @return
*/
public
boolean
reachedDestination
()
{
return
reachedTarget
;
}
@Override
public
String
toString
()
{
return
"\n\tfrom "
+
start
.
toString
()
+
" to "
+
destination
.
toString
()
...
...
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