faa.tg.sp
Class SpCommandResult

java.lang.Object
  extended by faa.tg.sp.SpCommandResult
All Implemented Interfaces:
DelimWritable, MethodMapCombinable, TextWritable, HasAcid, HasName, HasSector, HasSimTime, HasSpCmd, SimEventXmlWritable, XmlWritable, Filterable, Recordable, ManagedObject, CommandFeedback, java.io.Serializable

public class SpCommandResult
extends java.lang.Object
implements HasAcid, HasSector, HasSimTime, HasSpCmd, TextWritable, SimEventXmlWritable, MethodMapCombinable, DelimWritable, CommandFeedback

 SpCommandResult is the object returned upon execution of a SpCommand.
 It contains the original SpCommand, as well as any Command-related
    feedback

 See the source:  SpCommandResult.java 

Version:
$Id: SpCommandResult.java,v 3.17 2008/12/08 18:29:45 lykensj Exp $
Author:
Mike Capito
See Also:
The abstract class for classes that make these, Serialized Form

Field Summary
private  Acid acid
           
private  Aircraft aircraft
           
private  java.lang.String aircraftID
          Deprecated. Use acid instead of aircraftID.
private  SpID assignSpID
           
private  SpCommand cmd
           
static java.lang.String CVS_VERSION_ID
          The CVS Version ID
private  Frequency freq
           
private static MethodMap methodMap
           
private  java.lang.String msg
           
private  java.lang.String name
           
private  SimulationTime resultTime
           
private  Sector sector
           
(package private) static long serialVersionUID
           
private  boolean success
           
 
Constructor Summary
SpCommandResult(SpCommand spCmd, Aircraft ac, boolean success)
          Constructor
SpCommandResult(SpCommand spCmd, Aircraft ac, boolean success, java.lang.String spMsg)
          Constructor
SpCommandResult(SpCommand spCmd, java.lang.String acid, boolean success, java.lang.String spMsg, Sector sector, Frequency freq, SimulationTime time)
          Constructor
 
Method Summary
 java.lang.String frequency()
          If applicable, the frequency of the aircraft the message is relevant to.
 Acid getAcid()
          Returns the Acid of the aircraft acted on.
 Aircraft getAircraft()
          Returns the Aircraft: will return null after deserialization.
 java.lang.String getAircraftID()
          Returns the aircraft's ACID: only ac info once this is deserialized.
 java.lang.String getAssignedSp()
          Returns the simpilot assigned to the aircraft when command was given.
 java.lang.String getBaseCommand()
          If applicable, the command type this message is a response to.
 java.lang.String getCmdLine()
          Returns the command line typed in
 java.lang.String getEventDetail()
          Returns the fix name as other info describing the event.
 java.lang.String getEventName()
          Returns the EventFileCombinable tag for this class of objects.
 Frequency getFrequency()
           
 java.lang.String getMessage()
          A general multi-purpose message field for any listener.
 MethodMap getMethodMap()
          Returns the SpCmdResult information in DelimWritable format.
 java.lang.String getName()
          Returns the unique identifier for the simpilot command.
 Sector getSector()
          This provides the type of this command as an SpCmdType.
 SimulationTime getSimTime()
          Returns the SimulationTime that this aircraft event refers to.
 CommandLineSource getSource()
          returns where the command came from
 SpCmdType getSpCmdType()
          This provides the type of this command as an SpCmdType.
 SpCommand getSpCommand()
          Returns the SP command object.
private static MethodMap makeMethodMap()
          Creates the map of field names and MethodSpecs
private  void readObject(java.io.ObjectInputStream in)
          Set acid if the version deserialized did not have it defined.
 java.lang.String source()
          Yields a unique String description of the source of the message.
 java.lang.String successful()
          If applicable, a description of the success or failure of the command that this message is a response to.
 java.lang.String time()
          By convention, this returns the current simulation time when the message was issued in a HH:MM:SS format.
 java.lang.String toDraText()
          Returns the SpCommandResult information as a DR&A text String.
 Element toElement()
          Returns the event information as a jdom XML Element with a root element of type SimEvent (if added to a simevent object, a event file can be created duplicating the command(s) in the SimEventObject XML.
 Element toElement(SimulationTime useTime)
          Returns the event information with the specified time as a jdom XML Element with a root element of type SimEvent (if added to a simevent object, a event file can be created duplicating the command(s) in the SimEventObject XML.
 java.lang.String toString()
          This toString method returns the command text that was executed as well as weather or not it was succesful and the msg (if any)
 boolean wasSuccessful()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

CVS_VERSION_ID

public static final java.lang.String CVS_VERSION_ID
The CVS Version ID

See Also:
Constant Field Values

cmd

private SpCommand cmd

msg

private java.lang.String msg

success

private boolean success

resultTime

private SimulationTime resultTime

acid

private Acid acid

aircraftID

private java.lang.String aircraftID
Deprecated. Use acid instead of aircraftID.

sector

private Sector sector

freq

private Frequency freq

assignSpID

private SpID assignSpID

name

private java.lang.String name

aircraft

private transient Aircraft aircraft

methodMap

private static MethodMap methodMap
Constructor Detail

SpCommandResult

public SpCommandResult(SpCommand spCmd,
                       Aircraft ac,
                       boolean success)
Constructor

Parameters:
spCmd - The SpCommand that was issued.
ac - The Aircraft the command was executed upon.
success - If the command succeeded, as a boolean.

SpCommandResult

public SpCommandResult(SpCommand spCmd,
                       Aircraft ac,
                       boolean success,
                       java.lang.String spMsg)
Constructor

Parameters:
spCmd - The SpCommand that was issued.
ac - The Aircraft the command was executed upon.
success - If the command succeeded, as a boolean.
spMsg - Any command related feedback, as a String.

SpCommandResult

public SpCommandResult(SpCommand spCmd,
                       java.lang.String acid,
                       boolean success,
                       java.lang.String spMsg,
                       Sector sector,
                       Frequency freq,
                       SimulationTime time)
Constructor

Parameters:
spCmd - The SpCommand that was issued.
acid - The acid of the Aircraft the command was executed upon.
success - If the command succeeded, as a boolean.
spMsg - Any command related feedback, as a String.
sector - Sector that the aircraft was in when the command was given
time - SimulationTime that the command was given
Method Detail

readObject

private void readObject(java.io.ObjectInputStream in)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException
Set acid if the version deserialized did not have it defined.

Throws:
java.io.IOException
java.lang.ClassNotFoundException

getName

public java.lang.String getName()
Returns the unique identifier for the simpilot command.

Specified by:
getName in interface MethodMapCombinable
Specified by:
getName in interface ManagedObject
Returns:
A unique identifier for the simpilot command.

getAcid

public Acid getAcid()
Returns the Acid of the aircraft acted on.

Specified by:
getAcid in interface MethodMapCombinable
Specified by:
getAcid in interface HasAcid
Returns:
The Acid of the aircraft acted on.

getCmdLine

public final java.lang.String getCmdLine()
Returns the command line typed in

Specified by:
getCmdLine in interface CommandFeedback
Returns:
the text of the typed command or an empty string if it is not relevant.

getEventName

public final java.lang.String getEventName()
Returns the EventFileCombinable tag for this class of objects.

Specified by:
getEventName in interface MethodMapCombinable

getEventDetail

public final java.lang.String getEventDetail()
Returns the fix name as other info describing the event.

Specified by:
getEventDetail in interface MethodMapCombinable

getSource

public CommandLineSource getSource()
returns where the command came from

Specified by:
getSource in interface HasSpCmd

source

public java.lang.String source()
Description copied from interface: CommandFeedback
Yields a unique String description of the source of the message. This is a causative relation; if the message is in direct response to a command, the source will be the sender of the command, not actual device that executes the code.

Specified by:
source in interface CommandFeedback
Returns:
an identifier for the message

getSector

public Sector getSector()
This provides the type of this command as an SpCmdType.

Specified by:
getSector in interface HasSector
Returns:
The type of simpilot command as an SpCmdType.

getSpCmdType

public SpCmdType getSpCmdType()
This provides the type of this command as an SpCmdType.

Specified by:
getSpCmdType in interface HasSpCmd
Returns:
The type of simpilot command as an SpCmdType.

toElement

public Element toElement()
Returns the event information as a jdom XML Element with a root element of type SimEvent (if added to a simevent object, a event file can be created duplicating the command(s) in the SimEventObject XML.

Specified by:
toElement in interface SimEventXmlWritable
Specified by:
toElement in interface XmlWritable
Returns:
Returns information as an XML Element that creates a simevent.

toElement

public Element toElement(SimulationTime useTime)
Returns the event information with the specified time as a jdom XML Element with a root element of type SimEvent (if added to a simevent object, a event file can be created duplicating the command(s) in the SimEventObject XML. Since SpCommandResults can occur before and after the updateState, and executed SimEvents always occur before the update state, this allows the time to be specified to convert the simTime for SimEvents.

Parameters:
useTime - Allows the Element's simulation time to be specified.
Returns:
Returns information as an XML Element that creates a simevent.

toDraText

public java.lang.String toDraText()
Returns the SpCommandResult information as a DR&A text String.

Specified by:
toDraText in interface TextWritable
Returns:
Returns the SpCommandResult information in TextWritable format.

toString

public java.lang.String toString()
This toString method returns the command text that was executed as well as weather or not it was succesful and the msg (if any)

Overrides:
toString in class java.lang.Object

getSpCommand

public SpCommand getSpCommand()
Returns the SP command object.


getBaseCommand

public java.lang.String getBaseCommand()
Description copied from interface: CommandFeedback
If applicable, the command type this message is a response to.

Specified by:
getBaseCommand in interface CommandFeedback
Returns:
the command type, or an empty string if it is not relevant.

getAircraft

public Aircraft getAircraft()
Returns the Aircraft: will return null after deserialization.


getAssignedSp

public java.lang.String getAssignedSp()
Returns the simpilot assigned to the aircraft when command was given.


getMessage

public java.lang.String getMessage()
Description copied from interface: CommandFeedback
A general multi-purpose message field for any listener.

Specified by:
getMessage in interface CommandFeedback
Returns:
the detailed description of addition information not reflected in the other generalized fields.

getSimTime

public SimulationTime getSimTime()
Description copied from interface: MethodMapCombinable
Returns the SimulationTime that this aircraft event refers to.

Specified by:
getSimTime in interface MethodMapCombinable
Specified by:
getSimTime in interface HasSimTime
Returns:
Returns the simulation time.

wasSuccessful

public boolean wasSuccessful()

getAircraftID

public java.lang.String getAircraftID()
Returns the aircraft's ACID: only ac info once this is deserialized.

Specified by:
getAircraftID in interface CommandFeedback
Returns:
the TGF ECO aircraftID as string that was targeted by the command, generally equivalent to the aircraft name, or the empty string if not relevant.

makeMethodMap

private static MethodMap makeMethodMap()
Creates the map of field names and MethodSpecs

Returns:
the map of field names and MethodSpecs

getMethodMap

public MethodMap getMethodMap()
Returns the SpCmdResult information in DelimWritable format.

Specified by:
getMethodMap in interface DelimWritable
Returns:
Returns fields as a map of MethodSpec objects.

getFrequency

public Frequency getFrequency()

frequency

public java.lang.String frequency()
Description copied from interface: CommandFeedback
If applicable, the frequency of the aircraft the message is relevant to. This value is potentially not linked to any particular value--it could be a frequency wide message.

Specified by:
frequency in interface CommandFeedback
Returns:
a description of the frequency of the objects the message is applicable to, or an empty string if it is not relevant.

successful

public java.lang.String successful()
Description copied from interface: CommandFeedback
If applicable, a description of the success or failure of the command that this message is a response to. Generally, "failure" or "success".

Specified by:
successful in interface CommandFeedback
Returns:
a description of whether the command was a success or failure, or an empty string if it is not relevant.

time

public java.lang.String time()
Description copied from interface: CommandFeedback
By convention, this returns the current simulation time when the message was issued in a HH:MM:SS format. When this message is response to a command, this field generally represents when the command was received.

Specified by:
time in interface CommandFeedback
Returns:
a description of when the message was issued.