Boeing Simulation 3.1 API Specification

worldsimulator
Class ComponentizedSimulator

java.lang.Object
  |
  +--worldsimulator.ComponentizedSimulator

public class ComponentizedSimulator
extends Object

This version of the simulator model is designed to use components models of the objects and to directly interact with UAVs and UCAVs via ChannelBundles. This class is designed to act as a representation of the world. In implementaiton, it looks strikingly like a server model. Mutation is done internally through MethodRequest objects. Only appropriate objects are allowed to change the simulation state via internal method calls.

Version:
1.26
Author:
Dave Jurgens
See Also:
Server, SimulatorComponentGenerator, SimulatorUCAV, SimulatorUAV, SocketSimulatorComponentTemplate

Nested Class Summary
private static class ComponentizedSimulator.ThreadSafeBundle
          A multi-threaded bundle class that wraps a supplier channel for writing and a consumer queue for reading in values.
 
Field Summary
private static int BUS
          Identification constant.
private static boolean DEBUG
           
protected  PropertyChangeSupport locationUpdates
          The bean to notify listeners of changes in the locations of any object in the simulator.
private static int OBJECT_DESTROY_TIME
          The amount of time in milliseconds for which an object will be included in the list of world objects as a destroyed object prior to its removal from the list.
protected  Map objectBundles
          A mapping of WhatWheres to the ChannelBundle which can be used to communicate.
protected  Set objects
          A mapping of Buses to Locations.
private static int OTHER
          Identification constant.
private static int SCHOOL
          Identification constant.
static int SIMULATOR_PORT
          The port on which the simulator listens for connections.
protected  ServerSocket ss
          The server socket over which all communication is initially done.
private static int TANK
          Identification constant.
private static int UAV
          Identification constant.
protected  Map uavBundles
          A mapping of UAVs to the ChannelBundle which can be used to communicate.
protected  Set uavs
          A mapping of UAVs to Locations.
private static int UCAV
          Identification constant.
protected  Map ucavBundles
          A mapping of UCAVs to the ChannelBundle which can be used to communicate.
protected  Set ucavs
          A mapping of UCAVs to Locations.
 
Constructor Summary
ComponentizedSimulator()
           
 
Method Summary
protected  boolean allowMethod(util.MethodRequest request)
          Returns true if the simulator allows the request to be invoked.
private  int bound(double x)
           
private  void debug(String s)
           
 Set getConnectableObjects()
          Returns the Set of objects that implement the Component interface thereby allowing other Component objects to connect to them.
private  world.WorldState getCurrentState()
          Returns a WorldState that represent the true positions of all the objects in the simulation.
private  Map getImageMap(objects.Location loc, double viewingRadius)
          Returns an int array that contains a marking of all objects visible with the viewing radius from the provided location.
 worldsimulator.SimulatorImage getSimulatorImage(uav.UAV uav)
          For the UAV, determine its viewing radius, and then construct a SimulatorImage based on its location.
 worldsimulator.SimulatorImage getSimulatorImage(ucav.UCAV ucav)
           
private  int getType(Class c)
          Returns the indentifier tag for an object of the given class.
protected  void handleIncomingConnection(Socket s)
          Starts a new Thread to set up the created ChannelBundle objects.
static void main(String[] args)
           
 void notifyBombDrop(ucav.UCAV ucav)
          Checks to see if an object has been destroyed and then removes it from the listing.
protected  void processObject(connect.ChannelBundle bundle)
          Starts threads to read and write objects to and from this WhatWhere
protected  void processUAV(connect.ChannelBundle bundle)
          Starts a Thread to read and write objects to and from this UAV
protected  void processUCAV(connect.ChannelBundle bundle)
          Starts threads to read and write objects to and from this UCAV
protected  void processVisualizer(connect.ChannelBundle channels)
          Adds a PropertyChangeListener for updates in the current WorldState and then writes out the new value upon update.
 void run()
          Listens for incoming connections from objects, uavs and ucavs.
 void startDestroyThread(objects.Destroyable t)
          Begins a thread that firsts destroys the object in question and then removes it from the list of known objects after a set period of time.
 void updateObjectLocation(objects.WhatWhere w)
          Updates the location of the WhatWhere.
 void updateUAVLocation(uav.UAV uav)
          Updates the location of the uav.
 void updateUCAVLocation(ucav.UCAV ucav)
          Updates the location of the ucav.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SIMULATOR_PORT

public static final int SIMULATOR_PORT
The port on which the simulator listens for connections.

See Also:
Constant Field Values

uavs

protected final transient Set uavs
A mapping of UAVs to Locations.


ucavs

protected final transient Set ucavs
A mapping of UCAVs to Locations.


objects

protected final transient Set objects
A mapping of Buses to Locations.


uavBundles

protected final transient Map uavBundles
A mapping of UAVs to the ChannelBundle which can be used to communicate.


ucavBundles

protected final transient Map ucavBundles
A mapping of UCAVs to the ChannelBundle which can be used to communicate.


objectBundles

protected final transient Map objectBundles
A mapping of WhatWheres to the ChannelBundle which can be used to communicate.


ss

protected final transient ServerSocket ss
The server socket over which all communication is initially done.


locationUpdates

protected final transient PropertyChangeSupport locationUpdates
The bean to notify listeners of changes in the locations of any object in the simulator.


DEBUG

private static final boolean DEBUG
See Also:
Constant Field Values

TANK

private static final int TANK
Identification constant.

See Also:
Constant Field Values

BUS

private static final int BUS
Identification constant.

See Also:
Constant Field Values

SCHOOL

private static final int SCHOOL
Identification constant.

See Also:
Constant Field Values

UAV

private static final int UAV
Identification constant.

See Also:
Constant Field Values

UCAV

private static final int UCAV
Identification constant.

See Also:
Constant Field Values

OTHER

private static final int OTHER
Identification constant.

See Also:
Constant Field Values

OBJECT_DESTROY_TIME

private static final int OBJECT_DESTROY_TIME
The amount of time in milliseconds for which an object will be included in the list of world objects as a destroyed object prior to its removal from the list.

See Also:
Constant Field Values
Constructor Detail

ComponentizedSimulator

public ComponentizedSimulator()
Method Detail

allowMethod

protected boolean allowMethod(util.MethodRequest request)
Returns true if the simulator allows the request to be invoked.


debug

private void debug(String s)

handleIncomingConnection

protected void handleIncomingConnection(Socket s)
Starts a new Thread to set up the created ChannelBundle objects.


processUAV

protected void processUAV(connect.ChannelBundle bundle)
Starts a Thread to read and write objects to and from this UAV


processUCAV

protected void processUCAV(connect.ChannelBundle bundle)
Starts threads to read and write objects to and from this UCAV


processObject

protected void processObject(connect.ChannelBundle bundle)
Starts threads to read and write objects to and from this WhatWhere


processVisualizer

protected void processVisualizer(connect.ChannelBundle channels)
Adds a PropertyChangeListener for updates in the current WorldState and then writes out the new value upon update.


getConnectableObjects

public Set getConnectableObjects()
Returns the Set of objects that implement the Component interface thereby allowing other Component objects to connect to them. This set will include zero or more of the following types of components: SimulatorTank, SimulatorBus, and SimulatorSchool.

See Also:
TargetControl

run

public void run()
Listens for incoming connections from objects, uavs and ucavs.


updateUAVLocation

public void updateUAVLocation(uav.UAV uav)
Updates the location of the uav.


updateUCAVLocation

public void updateUCAVLocation(ucav.UCAV ucav)
Updates the location of the ucav.


updateObjectLocation

public void updateObjectLocation(objects.WhatWhere w)
Updates the location of the WhatWhere.


getCurrentState

private world.WorldState getCurrentState()
Returns a WorldState that represent the true positions of all the objects in the simulation.

See Also:
PerspectiveUnifier, Server.currentState

notifyBombDrop

public void notifyBombDrop(ucav.UCAV ucav)
Checks to see if an object has been destroyed and then removes it from the listing.


startDestroyThread

public void startDestroyThread(objects.Destroyable t)
Begins a thread that firsts destroys the object in question and then removes it from the list of known objects after a set period of time.


getSimulatorImage

public worldsimulator.SimulatorImage getSimulatorImage(uav.UAV uav)
For the UAV, determine its viewing radius, and then construct a SimulatorImage based on its location.

See Also:
UAVImage

getSimulatorImage

public worldsimulator.SimulatorImage getSimulatorImage(ucav.UCAV ucav)

getImageMap

private Map getImageMap(objects.Location loc,
                        double viewingRadius)
Returns an int array that contains a marking of all objects visible with the viewing radius from the provided location.


bound

private int bound(double x)

getType

private int getType(Class c)
Returns the indentifier tag for an object of the given class.


main

public static void main(String[] args)

Boeing Simulation 3.1 API Specification

To submit a bug or feature email the author of that class. Funding for this research was provided by Boeing and DARPA.