edu.cmu.emulator.world
Class EmuWorld

java.lang.Object
  extended by 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.


Field Summary
private  long curWorldTime
           
private  Emulator emulator
           
private  String[] emuNodeNames
           
private  EmuNode[] emuNodes
           
private  MobilityDef mobilityDef
           
private static long MOVEMENT_INTERVAL
           
protected  LLAPos origin
           
private  boolean running
           
protected  WorldDef worldDef
           
 
Constructor Summary
EmuWorld(EmuNode[] emuNodes, Emulator emulator, WorldDef worldDef)
           
 
Method Summary
 void addNode(String nodeName, double[] pos)
           
 void addRouteDef(RouteDef routeDef)
           
 String[] getEmuNodeNames()
           
 EmuNode getNode(int index)
           
 EmuNode getNode(String name)
           
 int getNodeIndex(EmuNode node)
           
 int getNodeIndex(String nodeName)
          Thread-safe by virtue of the fact that emuNodes never changes during emulation.
 int getNumNodes()
           
 LLAPos getOrigin()
           
 RouteDef[] getRoutes()
          MY METHODS
 WorldDef getWorldDef()
           
 void init()
           
protected  void initNodes()
           
 void run()
           
 void setOrientation(String nodeName, double[][] orientation)
           
 void setPos(String nodeName, double[] pos)
           
 void start()
           
 void startRoute(String nodeName, String routeName)
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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
Constructor Detail

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.
Method Detail

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.