public final class PositionReaderSimulator extends Object
| Constructor and Description |
|---|
PositionReaderSimulator()
Creates a new PositionReaderSimulator.
|
PositionReaderSimulator(Random random)
Creates a new PositionReaderSimulator.
|
| Modifier and Type | Method and Description |
|---|---|
PositionReader |
forArea(Area area)
Creates a new simulated position reader.
|
PositionReader |
forRoute(Position... positions)
Creates a new simulated reader with the specified route.
|
PositionReaderSimulator |
setSpeedFixed(double speed,
SpeedUnit speedUnit)
Sets a fixed speed for the vessel.
|
PositionReaderSimulator |
setSpeedVariable(double minSpeed,
double maxSpeed,
SpeedUnit speedUnit)
Sets a variable speed for the vessel.
|
PositionReaderSimulator |
setTimeSource(java.util.function.LongSupplier timeSource)
Sets the time source that is used to determine how long duration has passed between succint invocations of
PositionReader.getCurrentPosition(). |
PositionReaderSimulator |
setTimeSourceFixedSlice(long milliesIncrement)
Sets a deterministic time source that increment the time with the specified amount of milliseconds every time.
|
public PositionReaderSimulator()
public PositionReaderSimulator(Random random)
random - the random source of datapublic PositionReader forArea(Area area)
area - the area to travel withinNullPointerException - if the specified area is nullpublic PositionReader forRoute(Position... positions)
If the first position and the last position is equivalent the positions will be delivered as if the vessel is sailing in a circle. When the ship reaches the final position it will sail to position number 2 instead of sailing the same route back.
positions - each position for routepublic PositionReaderSimulator setSpeedFixed(double speed, SpeedUnit speedUnit)
If no speed is set the simulated position reader will use a variable speed between 1 and 40 knots.
speed - the speed of the vesselspeedUnit - the unit of speedNullPointerException - if the speed unit is nullIllegalArgumentException - if the specified speed is non positivesetSpeedVariable(double, double, SpeedUnit)public PositionReaderSimulator setSpeedVariable(double minSpeed, double maxSpeed, SpeedUnit speedUnit)
If no speed is set the simulated position reader will use a variable speed between 1 and 40 knots.
minSpeed - the minimum speed of the vesselmaxSpeed - the maximum speed of the vesselspeedUnit - the unit of speedNullPointerException - if the speed unit is nullIllegalArgumentException - if the specified minimum speed is non positive or the max speed is than or equal to minimum speedsetSpeedFixed(double, SpeedUnit)public PositionReaderSimulator setTimeSource(java.util.function.LongSupplier timeSource)
PositionReader.getCurrentPosition(). If no time source is set, System.currentTimeMillis() is
used.timeSource - the time sourceNullPointerException - if the specified time source is nullpublic PositionReaderSimulator setTimeSourceFixedSlice(long milliesIncrement)
milliesIncrement - the number of milliseconds that the ship will sail every time
PositionReader.getCurrentPosition() is invokedCopyright © 2012–2015 Danish Maritime Authority. All rights reserved.