faa.tg.sp.cmd
Class HoldCmd

java.lang.Object
  extended by faa.tg.sp.SpCommand
      extended by faa.tg.sp.SpAlphaCommand
          extended by faa.tg.sp.cmd.HoldCmd
All Implemented Interfaces:
HasSpCmd, HasVoiceResponse, java.io.Serializable

public class HoldCmd
extends SpAlphaCommand
implements HasVoiceResponse

 
 The general format for this command is:
    "hold ponny 180 T2 LEFT"
 or
    "hl ponny 180 T2" (right turn).
 If this is a published fix, the fix is the only required parameter, and
 the published values will be used if not specified.

 Command components:
   [holding command]                      -> "hold" or "hl"
   [holding fix: must be first parameter] -> "ponny"
   [unused: approx. outbound compass dir] -> "N|S|E|W|NW|NE|SW|SE"
   [radial from fix (outbound bearing)]   -> "180" (degrees)
          -- if given as an inbound bearing TO the fix, use reciprocal
   [leg length]                        -> "T2" (minutes) or "D2" (n. miles)
   [turn direction]                    -> "LEFT" for left, right otherwise
 
See the source: HoldCmd.java

Version:
$Id: HoldCmd.java,v 3.18 2008/12/05 23:06:41 lykensj Exp $
Author:
Nick M., Timothy Swantek
See Also:
Serialized Form

Field Summary
private  CompassDirection compassDirection
           
static java.lang.String CVS_VERSION_ID
          The CVS Version ID
static Distance DEFAULT_DISTANCE
           
private  Fix holdingFix
          Deprecated.  
private  java.lang.String holdingFixName
          The name of the fix the aircraft is to hold at.
private  HoldingPattern holdingPattern
          Deprecated.  
private  Distance legDistance
           
private  Time legLength
           
private  Radial radialFromFix
           
(package private) static long serialVersionUID
           
private  TurnDirection turnDirection
           
private  java.lang.String voiceResponse
           
 
Fields inherited from interface faa.tg.sp.cmd.HasVoiceResponse
DEFAULT_VOICE_RESPONSE
 
Constructor Summary
HoldCmd(java.lang.String cmd, java.util.StringTokenizer st, CommandLineSource source)
          Constructor for the command.
 
Method Summary
 SpCommandResult execute(Aircraft ac, java.util.List<SpCommand> cmdList)
          Executes the constructed command.
static CompassDirection extractCompassDirection(java.lang.String str)
          return the CompassDirection in the str, or return null if not applicable
static Distance extractDistance(java.lang.String str)
          Return the Distance in the str, or return null if not applicable.
static Radial extractRadial(java.lang.String str)
          return the Radial in the str, or null if not applicable
static Time extractTime(java.lang.String str)
          return the Time in the str, or return null if not applicable
static TurnDirection extractTurnDirection(java.lang.String str)
          return the TurnDirection in the str, or return null if not applicable
 SpCmdType getSpCmdType()
          This provides the type of this command as an SpCmdType.
static java.lang.String getUsage()
          This method provides the proper usage of this command as a String
 java.lang.String getVoiceResponse()
          Returns the voice response of a command
private  void readObject(java.io.ObjectInputStream in)
          Takes old commands and extracts the String information from the non-String deprecated fields.
 
Methods inherited from class faa.tg.sp.SpCommand
getCmd, getCmdLine, getSource, setCmdLine, toString
 
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

DEFAULT_DISTANCE

public static final Distance DEFAULT_DISTANCE

voiceResponse

private java.lang.String voiceResponse

holdingPattern

private final transient HoldingPattern holdingPattern
Deprecated. 
The Holding pattern the aircraft will perform.

See Also:
Deprecated on 05/30/08

holdingFix

private Fix holdingFix
Deprecated. 
The fix the aircraft is to hold at. Deprecated on 05/30/08


holdingFixName

private java.lang.String holdingFixName
The name of the fix the aircraft is to hold at.


legLength

private Time legLength

legDistance

private Distance legDistance

compassDirection

private CompassDirection compassDirection

turnDirection

private TurnDirection turnDirection

radialFromFix

private Radial radialFromFix
Constructor Detail

HoldCmd

public HoldCmd(java.lang.String cmd,
               java.util.StringTokenizer st,
               CommandLineSource source)
        throws InvalidSyntaxException
Constructor for the command.

Parameters:
cmd - the cmd word
st - the rest of the command line in tokenizer format
source - the object that created the command
Throws:
InvalidSyntaxException - Syntax for the command is invalid.
Method Detail

readObject

private void readObject(java.io.ObjectInputStream in)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException
Takes old commands and extracts the String information from the non-String deprecated fields. Can be removed when those fields are removed. (Added 05/30/08)

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

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.

execute

public SpCommandResult execute(Aircraft ac,
                               java.util.List<SpCommand> cmdList)
Executes the constructed command.

Specified by:
execute in interface HasVoiceResponse
Specified by:
execute in class SpCommand
Parameters:
ac - The Aircraft the command is for, or null.
cmdList - The list of simpilot commands.
Returns:
The result of execution as a SpCommandResult.

extractRadial

public static Radial extractRadial(java.lang.String str)
return the Radial in the str, or null if not applicable


extractTime

public static Time extractTime(java.lang.String str)
return the Time in the str, or return null if not applicable


extractDistance

public static Distance extractDistance(java.lang.String str)
Return the Distance in the str, or return null if not applicable.


extractTurnDirection

public static TurnDirection extractTurnDirection(java.lang.String str)
return the TurnDirection in the str, or return null if not applicable


extractCompassDirection

public static CompassDirection extractCompassDirection(java.lang.String str)
return the CompassDirection in the str, or return null if not applicable


getUsage

public static java.lang.String getUsage()
This method provides the proper usage of this command as a String

Returns:
the proper usage of this command as a String

getVoiceResponse

public java.lang.String getVoiceResponse()
Returns the voice response of a command

Specified by:
getVoiceResponse in interface HasVoiceResponse