edu.cmu.emulator.world
Class EmuWorld
java.lang.Object
edu.cmu.emulator.world.EmuWorld
- All Implemented Interfaces:
- Runnable
public class EmuWorld
- extends Object
- implements Runnable
EmuWorld emulates the virtual world through which emulated
nodes are moving. It deals with node movement alone. Also
implements the methods which are invoked by the Event model.
This class does not deal with issues such as traffic.
We allocate emuNodes during emulator initialization, and
never allow it to change. We also do not allow node definitions
to change. I.e. nodes can never change the number of antennas they
have etc. This allows some mutual exclusion simplifications.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
emuNodes
private EmuNode[] emuNodes
emuNodeNames
private String[] emuNodeNames
running
private boolean running
curWorldTime
private long curWorldTime
emulator
private Emulator emulator
mobilityDef
private MobilityDef mobilityDef
worldDef
protected WorldDef worldDef
origin
protected LLAPos origin
MOVEMENT_INTERVAL
private static final long MOVEMENT_INTERVAL
- See Also:
- Constant Field Values
EmuWorld
public EmuWorld(EmuNode[] emuNodes,
Emulator emulator,
WorldDef worldDef)
- Parameters:
emuNodes
- All nodes that will ever be used in the emulation.
Since this array will never change during the course
of emulation, it can be accessed in a thread-safe manner.
initNodes
protected void initNodes()
init
public void init()
start
public void start()
run
public void run()
- Specified by:
run
in interface Runnable
addNode
public void addNode(String nodeName,
double[] pos)
setPos
public void setPos(String nodeName,
double[] pos)
setOrientation
public void setOrientation(String nodeName,
double[][] orientation)
startRoute
public void startRoute(String nodeName,
String routeName)
stop
public void stop()
getNodeIndex
public int getNodeIndex(EmuNode node)
getNodeIndex
public int getNodeIndex(String nodeName)
- Thread-safe by virtue of the fact that emuNodes never changes during
emulation.
getNode
public EmuNode getNode(String name)
getNode
public EmuNode getNode(int index)
getEmuNodeNames
public String[] getEmuNodeNames()
getNumNodes
public int getNumNodes()
getWorldDef
public WorldDef getWorldDef()
getOrigin
public LLAPos getOrigin()
getRoutes
public RouteDef[] getRoutes()
- MY METHODS
addRouteDef
public void addRouteDef(RouteDef routeDef)
Copyright © 2013. All Rights Reserved.