faa.tg.aidl
Class AidlImporter

java.lang.Object
  extended by faa.tg.aidl.AidlImporter

public class AidlImporter
extends java.lang.Object

Reads in an aidl xml file See the source AidlImporter.java

Version:
$Id: AidlImporter.java,v 1.6 2009/01/28 15:55:29 samf Exp $
Author:
Sam Fullerton, L-3 Titan

Field Summary
static java.lang.String CVS_VERSION_ID
          The CVS Version ID
private  java.util.Vector<AidlObject> fixesAndLines
           
private  java.util.Vector<AidlInstruction> flapsThread
           
private  java.util.Vector<AidlInstruction> landingGearThread
           
private  int lastParamId
           
private  int lastTriggerId
           
private  java.util.Vector<AidlInstruction> lateralThread
           
private  java.util.Vector<AidlInstruction> longitudinalThreads
           
private  java.util.Map<java.lang.Integer,AidlObject> parameters
           
private  java.util.Vector<AidlInstruction> speedBrakeThread
           
private  java.util.Map<java.lang.Integer,AidlTrigger> triggers
           
 
Constructor Summary
AidlImporter(java.io.File file)
          Constructor
 
Method Summary
private  void checkValidity(java.io.File File)
          Validates file against schema and xslt
private  Element getElementNamed(Element element, java.lang.String name, Namespace namespace)
          Get element with the given name
 java.util.Vector<AidlObject> getFixesAndLines()
          Returns the fixes, lines, glide slopes, speed laws, and arcs found
 java.util.Vector<AidlInstruction> getFlapInstructions()
          Returns instructions found for the flap thread
 java.util.Vector<AidlInstruction> getLandingGearInstructions()
          Returns instructions found for the landing gear thread
 int getLastParamId()
          Returns the last Param ID used
 int getLastTriggerId()
          Returns the last Trigger ID used
 java.util.Vector<AidlInstruction> getLateralInstructions()
          Returns instructions found for the lateral thread
private  Latitude getLatitude(java.lang.String str)
          Returns the latitude created from the given string NOTE: Assumes that latitude is in the format HHHMMSS[.S[SSSSSSSSSS]]
private  Longitude getLongitude(java.lang.String str)
          Returns the longitude created from the given string NOTE: Assumes that longitude is in the format HHHMMSS[.S[SSSSSSSSSS]]
 java.util.Vector<AidlInstruction> getLongitudinalInstructions()
          Returns instructions found for the longitudinal threads
 java.util.Map<java.lang.Integer,AidlObject> getParameters()
          Returns a map of all the parameters found stored by index
 java.util.Vector<AidlInstruction> getSpeedBrakeInstructions()
          Returns instructions found for the speed brakes thread
 java.util.Map<java.lang.Integer,AidlTrigger> getTriggers()
          Returns a map of all the triggers found stored by index
private  void importAidl(java.net.URL url)
          Import aidl xml
private  AidlObject importAidlObject(Element paramElement, int id, java.lang.String name)
          Import an AidlObject
private  AidlInstruction importInstruction(Element instructionElement)
          Import an instruction from the given element
private  void importParameters(Element mainParameters)
          Import lines, laws, arcs, glide slopes, and points
private  void importThreads(Element mainThread)
          Import threads
static void main(java.lang.String[] args)
          Main method for testing only
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CVS_VERSION_ID

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

See Also:
Constant Field Values

fixesAndLines

private java.util.Vector<AidlObject> fixesAndLines

parameters

private java.util.Map<java.lang.Integer,AidlObject> parameters

triggers

private java.util.Map<java.lang.Integer,AidlTrigger> triggers

speedBrakeThread

private java.util.Vector<AidlInstruction> speedBrakeThread

landingGearThread

private java.util.Vector<AidlInstruction> landingGearThread

lateralThread

private java.util.Vector<AidlInstruction> lateralThread

longitudinalThreads

private java.util.Vector<AidlInstruction> longitudinalThreads

flapsThread

private java.util.Vector<AidlInstruction> flapsThread

lastTriggerId

private int lastTriggerId

lastParamId

private int lastParamId
Constructor Detail

AidlImporter

public AidlImporter(java.io.File file)
             throws java.io.IOException,
                    XmlUrlException
Constructor

Parameters:
file - - the File for the AIDL XML file to import
Throws:
java.io.IOException - - is thrown if an I/O error occurs
XmlUrlException - - is thrown if unable to read file or its xsd
Method Detail

importAidl

private void importAidl(java.net.URL url)
                 throws java.io.IOException
Import aidl xml

Parameters:
url - - the url of the file to import
Throws:
java.io.IOException - - is thrown if an I/O error occurs

getElementNamed

private Element getElementNamed(Element element,
                                java.lang.String name,
                                Namespace namespace)
Get element with the given name

Parameters:
element - - the element to look under
name - - the name of the element to look for
namespace - - the namespace of the element to look for
Returns:
The element with the given namespace and name, or null if unable to find

importThreads

private void importThreads(Element mainThread)
Import threads

Parameters:
mainThread - - the main thread element
Throws:
java.io.IOException - - is thrown if an I/O error occurs

importInstruction

private AidlInstruction importInstruction(Element instructionElement)
Import an instruction from the given element

Parameters:
instructionElement - - the instruction element to import
Returns:
Returns the instruction imported or null if unable to find

importParameters

private void importParameters(Element mainParameters)
                       throws java.io.IOException
Import lines, laws, arcs, glide slopes, and points

Parameters:
mainParameters - - the main parameters element
Throws:
java.io.IOException - - is thrown if an I/O error occurs

importAidlObject

private AidlObject importAidlObject(Element paramElement,
                                    int id,
                                    java.lang.String name)
Import an AidlObject

Parameters:
paramElement - - the parameter element that contains the object
id - - the id of the parameter
name - - the name of the paramter
Returns:
Returns the aidl object imported from the given parameter element or null if unable to find

getLatitude

private Latitude getLatitude(java.lang.String str)
Returns the latitude created from the given string NOTE: Assumes that latitude is in the format HHHMMSS[.S[SSSSSSSSSS]]

Parameters:
str - - the string to make into a latitude

getLongitude

private Longitude getLongitude(java.lang.String str)
Returns the longitude created from the given string NOTE: Assumes that longitude is in the format HHHMMSS[.S[SSSSSSSSSS]]

Parameters:
str - - the string to make into a longitude

checkValidity

private void checkValidity(java.io.File File)
Validates file against schema and xslt

Parameters:
File - - the File of the file to check

getParameters

public java.util.Map<java.lang.Integer,AidlObject> getParameters()
Returns a map of all the parameters found stored by index


getTriggers

public java.util.Map<java.lang.Integer,AidlTrigger> getTriggers()
Returns a map of all the triggers found stored by index


getFixesAndLines

public java.util.Vector<AidlObject> getFixesAndLines()
Returns the fixes, lines, glide slopes, speed laws, and arcs found


getLongitudinalInstructions

public java.util.Vector<AidlInstruction> getLongitudinalInstructions()
Returns instructions found for the longitudinal threads


getLateralInstructions

public java.util.Vector<AidlInstruction> getLateralInstructions()
Returns instructions found for the lateral thread


getSpeedBrakeInstructions

public java.util.Vector<AidlInstruction> getSpeedBrakeInstructions()
Returns instructions found for the speed brakes thread


getLandingGearInstructions

public java.util.Vector<AidlInstruction> getLandingGearInstructions()
Returns instructions found for the landing gear thread


getFlapInstructions

public java.util.Vector<AidlInstruction> getFlapInstructions()
Returns instructions found for the flap thread


getLastTriggerId

public int getLastTriggerId()
Returns the last Trigger ID used


getLastParamId

public int getLastParamId()
Returns the last Param ID used


main

public static void main(java.lang.String[] args)
Main method for testing only

Parameters:
args - - the command line arguments