Boeing Simulation 3.1 API Specification

ucavmanager
Class SimulatorUCAVManager

java.lang.Object
  |
  +--connect.socket.SocketComponentTemplate
        |
        +--ucavmanager.SimulatorUCAVManager
All Implemented Interfaces:
Component, UCAVManager

public class SimulatorUCAVManager
extends SocketComponentTemplate
implements UCAVManager

A socket-based implementation of UCAVManager that communicates to SimulatorUCAV components.

Version:
$Revision: 1.17 $
Author:
James Brodman
, David Jurgens
See Also:
UCAV, SimulatorUAVManager, ComponentizedSimulator

Nested Class Summary
protected static class SimulatorUCAVManager.BasicUCAVInfo
           
 
Field Summary
private static boolean debug
           
private  Map idToUCAV
          Maps the unique ID of the ucav to the ucav itself.
private  int nextID
           
private  Set permittedConnections
           
private  boolean serverConnected
           
private  util.ConsumerQueue serverQueue
          The queue structure that will hold objects sent by the Server.
private  connect.CreatesConnection toServer
           
private  Map ucavInfoToConnection
           
private  util.SinglePermitMap ucavToChannels
          Map linking UCAV to ChannelBundle.
 
Fields inherited from class connect.socket.SocketComponentTemplate
portNumber
 
Constructor Summary
SimulatorUCAVManager(int port)
           
 
Method Summary
protected  boolean accept(Class requestingType)
          Returns whether this component will accept a connection from the the requesting object of the speicifed type.
protected  boolean allowMethod(util.MethodRequest request)
          Returns true if this component allows the MethodRequest to be invoked upon itself.
 void attackWithUCAV(ucav.UCAV ucavObject, objects.Targetable t)
          Acquires the channel resources when available, and then sends out set location request to the ucav.
private  ucav.UCAV bind(ucav.UCAV ucavObject)
          Returns the SimulatorUCAV associated with this UCAVObject.
private  void debug(String s)
          Emits a debug message if the debug flag is enabled.
 List getAvailableUCAVs()
          Return a list of all UCAVs that are not currently assigned to a mission.
protected  int getMaxPoints()
          Returns 1 so that a single RelayPoint may be created.
 int getNextConnection()
           
 int getSourceType()
           
 List getUCAVConnections()
          Return a list containing the CreatesConnections for all UCAVs connected to this manager.
static void main(String[] args)
           
 void moveUnit(ucav.UCAV ucavObject, objects.Locatable loc)
          Acquires the channel resources for the ucav, and then sends a request that the ucav for the ucav to begin moving to the location.
private  int nextUCAVID()
           
protected  void processAcceptedConnection(Class hostType, connect.ChannelBundle channels)
          Handles transactions with the Server.
protected  void processRequestingConnection(connect.ComponentEmissary requesting, connect.ChannelBundle channels)
          All implementers should extends this method to define their behavior when another component connects.
 connect.CreatesConnection provideConnection(ucav.UCAVInfo uav)
          For a specific (@link UCAV}, return the CreatesConnection that will connect to it.
 
Methods inherited from class connect.socket.SocketComponentTemplate
connect, getComponentEmissary, getConnection, processRelayPoint, spawnRelayPoint
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ucavInfoToConnection

private final Map ucavInfoToConnection

permittedConnections

private final Set permittedConnections

ucavToChannels

private final util.SinglePermitMap ucavToChannels
Map linking UCAV to ChannelBundle. A single permit map is used to control access to a ucav between threads.


idToUCAV

private final Map idToUCAV
Maps the unique ID of the ucav to the ucav itself.


nextID

private int nextID

serverConnected

private boolean serverConnected

toServer

private connect.CreatesConnection toServer

debug

private static boolean debug

serverQueue

private util.ConsumerQueue serverQueue
The queue structure that will hold objects sent by the Server.

Constructor Detail

SimulatorUCAVManager

public SimulatorUCAVManager(int port)
Method Detail

accept

protected boolean accept(Class requestingType)
Description copied from class: SocketComponentTemplate
Returns whether this component will accept a connection from the the requesting object of the speicifed type.

Specified by:
accept in class SocketComponentTemplate

getSourceType

public int getSourceType()

allowMethod

protected boolean allowMethod(util.MethodRequest request)
Description copied from class: SocketComponentTemplate
Returns true if this component allows the MethodRequest to be invoked upon itself.

Specified by:
allowMethod in class SocketComponentTemplate

attackWithUCAV

public void attackWithUCAV(ucav.UCAV ucavObject,
                           objects.Targetable t)
Acquires the channel resources when available, and then sends out set location request to the ucav. Following the request, the thread periodically checks the ucav's location and the issues a UCAV.dropBomb request when the ucav is in the appropriate position. An attack request is viewed as an atomic action that cannot be int1errupted.


bind

private ucav.UCAV bind(ucav.UCAV ucavObject)
Returns the SimulatorUCAV associated with this UCAVObject. This method is necessary to bind the Server representation of the UCAV to the ComponentizedSimulator representation of the object. The UCAVManager can only communicate with the simulator version of the object. Note that this method looks for the SimulatorUCAV that is closest to the UCAVObject.


getAvailableUCAVs

public List getAvailableUCAVs()
Description copied from interface: UCAVManager
Return a list of all UCAVs that are not currently assigned to a mission.

Specified by:
getAvailableUCAVs in interface UCAVManager

getMaxPoints

protected int getMaxPoints()
Returns 1 so that a single RelayPoint may be created.

Overrides:
getMaxPoints in class SocketComponentTemplate
See Also:
SocketComponentTemplate.spawnRelayPoint(int)

getNextConnection

public int getNextConnection()

getUCAVConnections

public List getUCAVConnections()
Description copied from interface: UCAVManager
Return a list containing the CreatesConnections for all UCAVs connected to this manager.

Specified by:
getUCAVConnections in interface UCAVManager

moveUnit

public void moveUnit(ucav.UCAV ucavObject,
                     objects.Locatable loc)
Acquires the channel resources for the ucav, and then sends a request that the ucav for the ucav to begin moving to the location. Requests are not guaranteed to finish, due to a movement request being interruptable by an attack request.


nextUCAVID

private int nextUCAVID()

processAcceptedConnection

protected void processAcceptedConnection(Class hostType,
                                         connect.ChannelBundle channels)
Handles transactions with the Server.

Specified by:
processAcceptedConnection in class SocketComponentTemplate

processRequestingConnection

protected void processRequestingConnection(connect.ComponentEmissary requesting,
                                           connect.ChannelBundle channels)
Description copied from class: SocketComponentTemplate
All implementers should extends this method to define their behavior when another component connects.

Specified by:
processRequestingConnection in class SocketComponentTemplate

debug

private void debug(String s)
Emits a debug message if the debug flag is enabled.


provideConnection

public connect.CreatesConnection provideConnection(ucav.UCAVInfo uav)
Description copied from interface: UCAVManager
For a specific (@link UCAV}, return the CreatesConnection that will connect to it.

Specified by:
provideConnection in interface UCAVManager

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.