edu.bonn.cs.iv.bonnmotion
Class MobileNode

java.lang.Object
  extended by edu.bonn.cs.iv.bonnmotion.MobileNode
Direct Known Subclasses:
GroupNode

public class MobileNode
extends java.lang.Object

Mobile node.


Field Summary
protected  double[] ct
          Times when mobile changes speed or direction.
protected static int debug
           
protected static boolean printAngleStuff
           
protected  java.util.Vector waypoints
           
 
Constructor Summary
MobileNode()
           
 
Method Summary
 boolean add(double time, Position pos)
          Optimised for waypoints coming in with increasing time.
 void add(MobileNode _node)
          Add Waypoint from an other node.
 double[] changeTimes()
           
 void cut(double begin, double end)
           
 Waypoint getWaypoint(int idx)
           
 Waypoint lastElement()
           
 java.lang.String movementString()
           
 java.lang.String[] movementStringGlomo(java.lang.String id)
           
 java.lang.String[] movementStringNS(java.lang.String id, double border)
           
 int numWaypoints()
           
static double[] pairStatistics(MobileNode node1, MobileNode node2, double start, double duration, double range, boolean calculateMobility)
           
static double[] pairStatistics(MobileNode node1, MobileNode node2, double start, double duration, double range, boolean calculateMobility, Building[] buildings)
           
 java.lang.String placementStringGlomo(java.lang.String id)
           
 Position positionAt(double time)
           
 void removeLastElement()
          Remove the latest waypoint (last in the internal list).
static boolean sameBuilding(Building[] buildings, Position pos1, Position pos2)
           
 void shiftPos(double _x, double _y)
          Move all waypoints by a certain offset.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

protected static final int debug
See Also:
Constant Field Values

printAngleStuff

protected static final boolean printAngleStuff
See Also:
Constant Field Values

ct

protected double[] ct
Times when mobile changes speed or direction.


waypoints

protected java.util.Vector waypoints
Constructor Detail

MobileNode

public MobileNode()
Method Detail

add

public boolean add(double time,
                   Position pos)
Optimised for waypoints coming in with increasing time.

Returns:
Success of insertion (will return false iff there is already another waypoint in the list with same time but different position).

add

public void add(MobileNode _node)
Add Waypoint from an other node.

Parameters:
_node - Waypoints of node to add

removeLastElement

public void removeLastElement()
Remove the latest waypoint (last in the internal list).


lastElement

public Waypoint lastElement()
Returns:
the latest waypoint (last in the internal list).

numWaypoints

public int numWaypoints()

getWaypoint

public Waypoint getWaypoint(int idx)

shiftPos

public void shiftPos(double _x,
                     double _y)
Move all waypoints by a certain offset.


changeTimes

public double[] changeTimes()
Returns:
Array with times when this mobile changes speed or direction.

cut

public void cut(double begin,
                double end)

movementString

public java.lang.String movementString()

movementStringNS

public java.lang.String[] movementStringNS(java.lang.String id,
                                           double border)
Parameters:
border - The border we add around the scenario to prevent ns-2 from crashing; this value is added to all x- and y-values.

placementStringGlomo

public java.lang.String placementStringGlomo(java.lang.String id)

movementStringGlomo

public java.lang.String[] movementStringGlomo(java.lang.String id)

positionAt

public Position positionAt(double time)
Returns:
Position of this mobile at a given time.

sameBuilding

public static boolean sameBuilding(Building[] buildings,
                                   Position pos1,
                                   Position pos2)

pairStatistics

public static double[] pairStatistics(MobileNode node1,
                                      MobileNode node2,
                                      double start,
                                      double duration,
                                      double range,
                                      boolean calculateMobility)

pairStatistics

public static double[] pairStatistics(MobileNode node1,
                                      MobileNode node2,
                                      double start,
                                      double duration,
                                      double range,
                                      boolean calculateMobility,
                                      Building[] buildings)