Global Positioning System Reference
In-Depth Information
concrete implementation of motion impossible. The only constraint so far,
is that the GPSunit has to reflect every change of motion with
final protected void move( double direction, double speed )
{
gpsUnit.move(direction, speed);
}
Although this move is moving the gpsUnit , the RO programmer has to care-
fully distinguish real and simulated motion. The method is final to force
every object to report the result (or return value) of a simulated motion rel-
ative to the external environment with .getGPSinfo() . Consequently, this
method is used to write (and log) the result of a simulation (or playback,
or live trace) step and the RealObject can be moved with
... protected void move()
{
// 1. simulation calculates next move ...
// or 2. retrieve move from trace replay ...
// or 3. retrieve move from a real object ...
//
=> finally execute move with values
move(direction, speed);
:
}
}
Thus, the move will be logged to the RO history and, externally, the coor-
dinates can be retrieved at any point in time.
By repeatedly calling the move method, the object can be guided along
any path in space and time: a person walking, a jet plane flying or a fish
swimming. This usage of move adheres to the mathematical description of
motion:
distance= time = s=t:
Since the ROAF is meant to be a real-world simulator for every existing
object, it is impossible, at this point, to implement a concrete way to move.
In object-oriented programming, this problem can be overcome by adding
an abstract method:
abstract protected void move() { /* no implementation! */ }
Abstract methods do not have an implementation and as soon as a class
has an abstract method the whole class has to be declared abstract :
public abstract class RealObject
In general, Java allows three kinds of classes: full implementation, par-
tial implementation, and no implementation. The Position interface is a
class without implementation, GeoPoint is a class with full implementation.
 
Search WWH ::




Custom Search