first commit
This commit is contained in:
211
CS1322/p4/Aircraft.java
Normal file
211
CS1322/p4/Aircraft.java
Normal file
@@ -0,0 +1,211 @@
|
||||
/**
|
||||
* <PRE>
|
||||
* Aircraft.java
|
||||
*
|
||||
* Revisions: 1.0 Oct. 16, 2002
|
||||
* Created the Aircraft class
|
||||
* 1.1 Oct. 27, 2002
|
||||
* Compiled, Commented
|
||||
*
|
||||
* </PRE>
|
||||
*
|
||||
* Collaboration Statement:
|
||||
* I worked on the homework assignment alone, using only
|
||||
* course materials.
|
||||
*
|
||||
* Created with JCreatorLE, some indents are off when viewed through notepad
|
||||
* or EMACS
|
||||
*
|
||||
* @author <A HREF="mailto:gtg184g@mail.gatech.edu">Jose Manuel Caban</A>
|
||||
* @version Version 1.1, Oct. 27, 2002
|
||||
*/
|
||||
|
||||
public class Aircraft implements Comparable{
|
||||
|
||||
//hey what happened to Hungarian Notation?
|
||||
private String model ;
|
||||
private String nickname ;
|
||||
private String role ;
|
||||
private Integer launchPriority;
|
||||
|
||||
private Comparable comparator = nickname;
|
||||
|
||||
////////////////
|
||||
//Constructors//
|
||||
////////////////
|
||||
|
||||
/**
|
||||
*Constructor for Aircraft
|
||||
*@param model, the model
|
||||
*@param nickname, the nickname
|
||||
*@param role, the role
|
||||
*@param launchPriority, the launchPriority
|
||||
*/
|
||||
public Aircraft(String model, String nickname,
|
||||
String role, Integer launchPriority){
|
||||
this.model = model;
|
||||
this.nickname = nickname;
|
||||
this.comparator = nickname;
|
||||
this.role = role;
|
||||
this.launchPriority = launchPriority;
|
||||
}
|
||||
|
||||
/**
|
||||
*Constructor for Aircraft
|
||||
*@param nickname, the nickname
|
||||
*sets all other params to default
|
||||
*/
|
||||
public Aircraft(String nickname){
|
||||
this("default",nickname,"default",new Integer(0));
|
||||
}
|
||||
|
||||
/**
|
||||
*Constructor for Aircraft
|
||||
*@param model, the model
|
||||
*@param nickname, the nickname
|
||||
*@param role, the role
|
||||
*@param launchPriority, the launchPriority
|
||||
*/
|
||||
public Aircraft(String model, String nickname,
|
||||
String role, int launchPriority){
|
||||
this(model,nickname,role,new Integer(launchPriority));
|
||||
}
|
||||
|
||||
///////////////////////
|
||||
//Accessors/Modifiers//
|
||||
///////////////////////
|
||||
|
||||
/**
|
||||
*Accessor for Model
|
||||
*@return value of model
|
||||
*/
|
||||
public String getModel(){
|
||||
return model;
|
||||
}
|
||||
|
||||
/**
|
||||
*Modifier for model
|
||||
*@param the new value for model
|
||||
*/
|
||||
public void setModel(String model){
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
/**
|
||||
*Accessor for nickname
|
||||
*@return the value of nickname
|
||||
*/
|
||||
public String getNickname(){
|
||||
return nickname;
|
||||
}
|
||||
|
||||
/**
|
||||
*Modifier for nickname
|
||||
*@param the new value of nickname
|
||||
*/
|
||||
public void setNickname(String nickname){
|
||||
this.nickname = nickname;
|
||||
this.comparator = nickname;
|
||||
}
|
||||
|
||||
/**
|
||||
*Accessor for role
|
||||
*@return the role of the aircraft
|
||||
*/
|
||||
public String getRole(){
|
||||
return role;
|
||||
}
|
||||
|
||||
/**
|
||||
*Modifier for role
|
||||
*@param the new value for role
|
||||
*/
|
||||
public void setRole(String role){
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
/**
|
||||
*Accessor for launchPriority
|
||||
*@return the value of launchPriority
|
||||
*/
|
||||
public Integer getLaunchPriority(){
|
||||
return launchPriority;
|
||||
}
|
||||
|
||||
/**
|
||||
*Modifier for launchPriority
|
||||
*@param the new value for launchPriority
|
||||
*/
|
||||
public void setLaunchPriority(Integer launchPriority){
|
||||
this.launchPriority = launchPriority;
|
||||
}
|
||||
|
||||
///////////
|
||||
//Methods//
|
||||
///////////
|
||||
|
||||
/**
|
||||
*switches the comparators from the nickname to launchPriority
|
||||
*/
|
||||
public void switchComparators(){
|
||||
if(comparator == nickname){
|
||||
comparator = launchPriority;
|
||||
}
|
||||
else{//otherwise
|
||||
comparator = nickname;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*compareTo, returns >,<,or ==
|
||||
*@param obj, the Object to compare with
|
||||
*/
|
||||
public int compareTo(Object obj){
|
||||
if(!(obj instanceof Aircraft)){
|
||||
return -5;
|
||||
}
|
||||
|
||||
Aircraft temp = (Aircraft)obj;
|
||||
|
||||
if(comparator instanceof String && temp.comparator instanceof String){
|
||||
return(comparator.compareTo(temp.comparator));
|
||||
}
|
||||
else if(comparator instanceof Integer &&
|
||||
temp.comparator instanceof Integer)
|
||||
{
|
||||
return(comparator.compareTo(temp.comparator));
|
||||
}
|
||||
else{
|
||||
System.err.println("Comparing apples and oranges doesn't work");
|
||||
return -5;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*@return String representation of Aircraft
|
||||
*/
|
||||
public String toString(){
|
||||
return (model + " " + nickname + " of Type " + role + " with launch " +
|
||||
"priority " + launchPriority);
|
||||
}
|
||||
|
||||
/**
|
||||
* Debugging main for class Aircraft.
|
||||
* This method will rigorously test my code.
|
||||
*
|
||||
* <br><br>
|
||||
* @param args a String array of command line arguments.
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
Aircraft air = new Aircraft("F-14","Tomcat","Interceptor",8);
|
||||
System.out.println(air);
|
||||
|
||||
System.out.println(air.compareTo(new Integer(8)));
|
||||
System.out.println(air.compareTo(new Aircraft("Eagle")));
|
||||
System.out.println(air.compareTo(air));
|
||||
System.out.println(air.compareTo(new Aircraft("Zebra")));
|
||||
|
||||
|
||||
}// end of main(String[] args)
|
||||
|
||||
}// end of class Aircraft
|
||||
422
CS1322/p4/AircraftCarrier.java
Normal file
422
CS1322/p4/AircraftCarrier.java
Normal file
@@ -0,0 +1,422 @@
|
||||
/**
|
||||
* <PRE>
|
||||
* AircraftCarrier.java
|
||||
*
|
||||
* Revisions: 1.0 Oct. 18, 2002
|
||||
* Created the AircraftCarrier class
|
||||
* 1.1 Oct. 27, 2002
|
||||
* Compiled, Finished, Commented
|
||||
* 1.2 Oct. 28,2002
|
||||
* Whoever writes these stupid .nfo's needs to be more specific
|
||||
* added recode to fix the way launchLog.txt is written
|
||||
*
|
||||
*
|
||||
* </PRE>
|
||||
*
|
||||
* Collaboration Statement:
|
||||
* I worked on the homework assignment alone, using only
|
||||
* course materials.
|
||||
*
|
||||
* Created with JCreatorLE, some indents are off when viewed through notepad
|
||||
* or EMACS
|
||||
*
|
||||
* @author <A HREF="mailto:gtg184g@mail.gatech.edu">Jose Manuel Caban</A>
|
||||
* @version Version 1.1, Oct. 27, 2002
|
||||
*/
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
public class AircraftCarrier {
|
||||
|
||||
private final String FILE_NAME = "aircraftFile.txt";
|
||||
private BST aircraftBST;
|
||||
private boolean StrikePackageReady;
|
||||
private static final String MENU = (
|
||||
"1) Create New Strike Package\n"+
|
||||
"2) Find Aircraft\n"+
|
||||
"3) Throw Aircraft Overboard\n"+
|
||||
"4) Print Strike Package to file\n"+
|
||||
"5) Launch Aircraft\n"+
|
||||
"6) Quit\n");
|
||||
|
||||
private BufferedReader KB_IN=
|
||||
new BufferedReader(new InputStreamReader(System.in));
|
||||
|
||||
private Heap launchQueue; //holds the aircraft ordered by LaunchPriority
|
||||
|
||||
//change to false to remove prettiness of console
|
||||
private static final boolean bPretty = true;
|
||||
|
||||
////////////////
|
||||
//Constructors//
|
||||
////////////////
|
||||
|
||||
/**
|
||||
*Default Constructor
|
||||
*starts menu
|
||||
*/
|
||||
public AircraftCarrier(){
|
||||
aircraftBST = new BST();
|
||||
StrikePackageReady = false;
|
||||
doMenu();
|
||||
}
|
||||
|
||||
///////////
|
||||
//Methods//
|
||||
///////////
|
||||
|
||||
/**
|
||||
*Read Input
|
||||
*/
|
||||
private String readLine(){
|
||||
String KB_INPUT ="";
|
||||
|
||||
try{
|
||||
KB_INPUT = KB_IN.readLine();
|
||||
}
|
||||
catch(IOException ioe){
|
||||
System.err.println("IOException in readLine()");
|
||||
}
|
||||
|
||||
return KB_INPUT;
|
||||
|
||||
}//end readText(String,int)
|
||||
|
||||
/**
|
||||
*Prompt user for Aircraft and then output its specifics
|
||||
*/
|
||||
public void findAircraft(){
|
||||
|
||||
if(!StrikePackageReady){
|
||||
System.out.println("Strike Package not Ready");
|
||||
return;
|
||||
}
|
||||
|
||||
String KB_INPUT;
|
||||
|
||||
System.out.println("Please enter the a plane to search for: ");
|
||||
KB_INPUT = readLine();
|
||||
|
||||
Aircraft craft = new Aircraft(KB_INPUT);
|
||||
|
||||
if(aircraftBST.find(craft) == null){
|
||||
System.out.println("No Aircraft Found");
|
||||
}
|
||||
else{
|
||||
System.out.println(aircraftBST.find(craft));
|
||||
}
|
||||
}//end findAircraft()
|
||||
|
||||
/**
|
||||
*Throws a given aircraft overboard
|
||||
*/
|
||||
private void throwAircraftOverboard(){
|
||||
//On a side note, did you guys consult the Navy about this program?
|
||||
//I really don't think it behooves the Navy to throw their aircraft
|
||||
//overboard
|
||||
//but I could be going out on a limb here too
|
||||
String KB_INPUT;
|
||||
|
||||
if(!StrikePackageReady){
|
||||
System.out.println("Strike Package not Ready");
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println("Please enter the a plane to throw overboard: ");
|
||||
KB_INPUT = readLine();
|
||||
|
||||
Comparable temp = aircraftBST.remove(new Aircraft(KB_INPUT));
|
||||
|
||||
if(temp == null){
|
||||
System.out.println("No removal made");
|
||||
}
|
||||
else{
|
||||
System.out.println((Aircraft)temp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*Reads the aircraft from file and adds them to the program
|
||||
*/
|
||||
private void createNewStrikePackage(){
|
||||
BufferedReader br;
|
||||
try{
|
||||
br = new BufferedReader(new FileReader(FILE_NAME));
|
||||
}
|
||||
catch(FileNotFoundException fnfe){
|
||||
System.err.println(FILE_NAME + " not found");
|
||||
return;
|
||||
}
|
||||
catch(Exception e){
|
||||
System.err.println(e);
|
||||
return;
|
||||
}
|
||||
|
||||
String aircraft = "";
|
||||
try{
|
||||
boolean bDone = false;
|
||||
while(!bDone){
|
||||
String temp = br.readLine();
|
||||
|
||||
if(temp == null){
|
||||
bDone = true;
|
||||
}
|
||||
else{
|
||||
aircraft+=" "+temp;
|
||||
}
|
||||
}
|
||||
/*aircraft += br.readLine() while <- br.readLine() != null*/
|
||||
}
|
||||
catch(IOException ioe){
|
||||
System.err.println(ioe);
|
||||
return;
|
||||
}
|
||||
|
||||
StringTokenizer st = new StringTokenizer(aircraft);
|
||||
while(st.hasMoreTokens()){
|
||||
aircraftBST.add(new Aircraft(
|
||||
st.nextToken(),
|
||||
st.nextToken(),
|
||||
st.nextToken(),
|
||||
Integer.parseInt(st.nextToken())
|
||||
));
|
||||
}
|
||||
try{
|
||||
br.close();
|
||||
}
|
||||
catch(IOException ioe){
|
||||
System.err.println(ioe);
|
||||
return;
|
||||
}
|
||||
|
||||
StrikePackageReady = true;
|
||||
}//end createNewStrikePackage()
|
||||
|
||||
/**
|
||||
*Writes the current aircraft to file
|
||||
*/
|
||||
private void printStrikePackage(){
|
||||
FileWriter fw;
|
||||
PrintWriter pw;
|
||||
|
||||
//init fw
|
||||
try{
|
||||
fw = new FileWriter("strikePackage.txt");
|
||||
}
|
||||
catch(FileNotFoundException fnfe){
|
||||
System.err.println(fnfe);
|
||||
return;
|
||||
}
|
||||
catch(IOException ioe){
|
||||
System.err.println(ioe);
|
||||
return;
|
||||
}
|
||||
|
||||
//init pw
|
||||
pw = new PrintWriter(fw);
|
||||
|
||||
|
||||
aircraftBST.writeAircraft(aircraftBST,pw);
|
||||
|
||||
try{
|
||||
pw.flush();
|
||||
fw.close();
|
||||
}
|
||||
catch(IOException ioe){
|
||||
System.err.println(ioe);
|
||||
}
|
||||
}//end printStrikePackage()
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
/***************/
|
||||
//Phase 5 stuff//
|
||||
/***************/
|
||||
|
||||
//private Heap launchQueue //restated for coherency
|
||||
|
||||
/**
|
||||
*writes the aircraft to launchLog.txt and sends them off to battle
|
||||
*/
|
||||
private void launchAircraft(){
|
||||
launchQueue = new Heap();
|
||||
|
||||
aircraftBST.createLaunchQueue(aircraftBST,launchQueue);
|
||||
aircraftBST = null;
|
||||
|
||||
FileWriter fw;
|
||||
PrintWriter pw;
|
||||
|
||||
//init fw
|
||||
try{
|
||||
fw = new FileWriter("launchLog.txt");
|
||||
}
|
||||
catch(FileNotFoundException fnfe){
|
||||
System.err.println(fnfe);
|
||||
return;
|
||||
}
|
||||
catch(IOException ioe){
|
||||
System.err.println(ioe);
|
||||
return;
|
||||
}
|
||||
|
||||
//init pw
|
||||
pw = new PrintWriter(fw);
|
||||
|
||||
while(!launchQueue.isEmpty()){
|
||||
Aircraft temp = (Aircraft)(((BSTNode)launchQueue.remove()).getData());
|
||||
|
||||
//old code for the printing of file
|
||||
/*String strTemp = temp.getModel() + " " + temp.getNickname() + " " +
|
||||
temp.getRole() + " " + temp.getLaunchPriority();
|
||||
pw.println(strTemp);*/
|
||||
|
||||
//new code
|
||||
pw.println(temp);
|
||||
|
||||
/*
|
||||
to be honest, I feel the way I did this, the old code, makes more
|
||||
sense than writing "An Aircraft of type blah balh blah" to a file
|
||||
you can reload the file just as easily as aircraftFile.txt.
|
||||
For future TA meetings, please bring up the fact that its annoying
|
||||
to rely on the newgroups (not .announce, the other ones) to find
|
||||
things that should be clear in the instructions to begin with.*/
|
||||
}
|
||||
|
||||
try{
|
||||
pw.flush();
|
||||
fw.close();
|
||||
}
|
||||
catch(IOException ioe){
|
||||
System.err.println(ioe);
|
||||
}
|
||||
StrikePackageReady = false;
|
||||
}//end launchAircraft()
|
||||
|
||||
/**
|
||||
*Writes a menu to screen that runs until the user chooses to quit
|
||||
*/
|
||||
private void doMenu(){
|
||||
boolean quit = false;
|
||||
do{
|
||||
System.out.println(MENU);
|
||||
try{
|
||||
|
||||
int temp = Integer.parseInt(readLine());
|
||||
switch(temp){
|
||||
case 1:
|
||||
if(bPretty){
|
||||
System.out.println("\n\n\n\n/************************");
|
||||
System.out.println(" * Creating new StikePackage...");
|
||||
}
|
||||
createNewStrikePackage();
|
||||
if(bPretty){
|
||||
System.out.println(" * Done.\n\n");
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if(bPretty){
|
||||
System.out.println("\n\n\n\n/************************");
|
||||
System.out.println(" * Find Aircraft v1.1:");
|
||||
}
|
||||
findAircraft();
|
||||
if(bPretty){
|
||||
System.out.println(" * Done.\n\n");
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if(bPretty){
|
||||
System.out.println("\n\n\n\n/************************");
|
||||
System.out.println(" * Throw Aircraft Overboard v1.1:");
|
||||
}
|
||||
throwAircraftOverboard();
|
||||
if(bPretty){
|
||||
System.out.println(" * Done.\n\n");
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
if(bPretty){
|
||||
System.out.println("\n\n\n\n/************************");
|
||||
System.out.println(" * Writing StikePackage to File...");
|
||||
}
|
||||
printStrikePackage();
|
||||
if(bPretty){
|
||||
System.out.println(" * Done.\n\n");
|
||||
}
|
||||
break;
|
||||
|
||||
case 5:
|
||||
if(bPretty){
|
||||
System.out.println("\n\n\n\n/************************");
|
||||
System.out.println(" * Launching Aircraft...");
|
||||
}
|
||||
launchAircraft();
|
||||
if(bPretty){
|
||||
System.out.println(" * Done.\n\n");
|
||||
}
|
||||
break;
|
||||
|
||||
case 6:
|
||||
if(bPretty){
|
||||
System.out.println("\n\n\n\n/************************");
|
||||
}
|
||||
System.out.println("Thank you for using pseudo-Aircraft"+
|
||||
"Carrier Version 1.1, send $20 to gtg184g for the"+
|
||||
" full version.\n");
|
||||
if(bPretty){
|
||||
System.out.println(" * Done.");
|
||||
}
|
||||
quit = true;
|
||||
break;
|
||||
default:
|
||||
System.out.println("Try Again, 1-6");
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch(NumberFormatException nfe){
|
||||
System.out.println("Please try again");
|
||||
}
|
||||
}while(!quit);
|
||||
}//end doMenu()
|
||||
|
||||
|
||||
/**
|
||||
* Debugging main for class AircraftCarrier.
|
||||
* This method will rigorously test my code.
|
||||
*
|
||||
* <br><br>
|
||||
* @param args a String array of command line arguments.
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
AircraftCarrier bob = new AircraftCarrier();
|
||||
|
||||
/*bob.aircraftBST = new BST();
|
||||
bob.aircraftBST.add(new Aircraft("F-14","Tomcat","Interceptor",8));
|
||||
|
||||
bob.StrikePackageReady = false;
|
||||
bob.findAircraft();
|
||||
|
||||
bob.StrikePackageReady = true;
|
||||
bob.findAircraft();
|
||||
bob.throwAircraftOverboard();
|
||||
bob.aircraftBST.outputTree();
|
||||
|
||||
System.out.println("\nTesting createNewStrikePackage()\n");
|
||||
bob.createNewStrikePackage();
|
||||
|
||||
bob.aircraftBST.outputTree();
|
||||
bob.findAircraft();
|
||||
bob.printStrikePackage();
|
||||
|
||||
bob.launchAircraft();
|
||||
System.out.println(bob.aircraftBST);
|
||||
System.out.println(bob.launchQueue);*/
|
||||
|
||||
|
||||
}// end of main(String[] args)
|
||||
|
||||
}// end of class AircraftCarrier
|
||||
414
CS1322/p4/BST.java
Normal file
414
CS1322/p4/BST.java
Normal file
@@ -0,0 +1,414 @@
|
||||
/**
|
||||
* <PRE>
|
||||
* BST.java
|
||||
*
|
||||
* Revisions: 1.0 Oct. 16, 2002
|
||||
* Created the BST class
|
||||
* 1.1 Oct. 16, 2002
|
||||
* Compiled, Finished, Tested
|
||||
* 2.0 Oct. 26, 2002
|
||||
* Added code to fix problem with remove(), neither autograder
|
||||
* nor me caught it until after working on
|
||||
* AircraftCarrier.java
|
||||
*
|
||||
*
|
||||
* </PRE>
|
||||
*
|
||||
* @author <A HREF="mailto:gtg184g@mail.gatech.edu">Jose Manuel Caban</A>
|
||||
* @version Version 2.0, Oct. 26, 2002
|
||||
*/
|
||||
|
||||
import java.io.*;
|
||||
|
||||
public class BST {
|
||||
|
||||
public static final boolean bDebug = false;
|
||||
|
||||
private BSTNode root;
|
||||
|
||||
///////////
|
||||
//Methods//
|
||||
///////////
|
||||
|
||||
/**
|
||||
*Add data to tree
|
||||
*@param data, data to add
|
||||
*/
|
||||
public void add(Comparable data){
|
||||
if(root == null){
|
||||
root = new BSTNode(data);
|
||||
}
|
||||
|
||||
else{
|
||||
add(data,root);
|
||||
}
|
||||
}//end add(Comparable)
|
||||
|
||||
/**
|
||||
*Add data to tree helper
|
||||
*@param data, the data to add
|
||||
*@param current, the current spot on the tree
|
||||
*/
|
||||
private void add(Comparable data, BSTNode current){
|
||||
if(current.getData().compareTo(data) > 0){
|
||||
if(current.getLeft() == null){
|
||||
current.setLeft(new BSTNode(data));
|
||||
}
|
||||
else{
|
||||
add(data,current.getLeft());
|
||||
}
|
||||
}
|
||||
else if(current.getData().compareTo(data) < 0){
|
||||
if(current.getRight() == null){
|
||||
current.setRight(new BSTNode(data));
|
||||
}
|
||||
else{
|
||||
add(data,current.getRight());
|
||||
}
|
||||
}
|
||||
else{/*do nothing*/}//current.compareTo() == 0
|
||||
}//end add(Comparable,BSTNode)
|
||||
|
||||
/**
|
||||
*Add data with Iteration
|
||||
*I did this for my own enjoyment and mental enrichment
|
||||
*plus those nested ?: look soooooo advanced
|
||||
*/
|
||||
public void addItr(Comparable data){
|
||||
if(root == null){
|
||||
root = new BSTNode(data);
|
||||
}
|
||||
|
||||
if(data.compareTo(root.getData()) == 0){
|
||||
return;
|
||||
}
|
||||
|
||||
//assumes data is not already in tree
|
||||
BSTNode bTraverse =
|
||||
(data.compareTo(root.getData())>0?root.getRight():root.getLeft());
|
||||
BSTNode bPrevTraverse = root;
|
||||
|
||||
while(bTraverse != null){
|
||||
bPrevTraverse = bTraverse;
|
||||
bTraverse =
|
||||
(data.compareTo(bTraverse.getData())>0?
|
||||
bTraverse.getRight():bTraverse.getLeft());
|
||||
|
||||
}
|
||||
|
||||
if(data.compareTo(bPrevTraverse.getData())>0){
|
||||
bPrevTraverse.setRight(new BSTNode(data));
|
||||
}
|
||||
else{
|
||||
bPrevTraverse.setLeft(new BSTNode(data));
|
||||
}
|
||||
}//end addItr(Comparable)
|
||||
|
||||
/**
|
||||
*Check to see if data is in Tree
|
||||
*@return null if not, the data if true
|
||||
*/
|
||||
public Comparable find(Comparable toFind){
|
||||
BSTNode current = root;
|
||||
|
||||
for(;;){
|
||||
if(current == null){
|
||||
return null;
|
||||
}
|
||||
|
||||
else if(toFind.compareTo(current.getData()) == 0){
|
||||
return current.getData();
|
||||
}
|
||||
else if(toFind.compareTo(current.getData()) < 0){
|
||||
current = current.getLeft();
|
||||
}
|
||||
else{
|
||||
current = current.getRight();
|
||||
}
|
||||
}
|
||||
}//end find(Comparable)
|
||||
|
||||
|
||||
/**
|
||||
*Remove a piece of data from Tree
|
||||
*@param toDie, the piece of data to be removed
|
||||
*/
|
||||
public Comparable remove(Comparable toDie){
|
||||
BSTNode bLocation = root;
|
||||
BSTNode bPrevLocation = null;
|
||||
|
||||
boolean bDone = false;
|
||||
while(bDone != true && bLocation != null){
|
||||
|
||||
if(toDie.compareTo(bLocation.getData()) == 0){
|
||||
bDone = true;
|
||||
}
|
||||
else if(toDie.compareTo(bLocation.getData()) < 0){
|
||||
bPrevLocation = bLocation;
|
||||
bLocation = bLocation.getLeft();
|
||||
}
|
||||
else{
|
||||
bPrevLocation = bLocation;
|
||||
bLocation = bLocation.getRight();
|
||||
}
|
||||
}
|
||||
|
||||
if(bLocation == null){
|
||||
return null;
|
||||
}
|
||||
|
||||
if(bDebug){ //ya know. having a built in Debugger is why I love
|
||||
//Visual Studio
|
||||
System.out.println("bDebug Start");
|
||||
System.out.println(bLocation.getData());
|
||||
System.out.println("bDebug End");
|
||||
}
|
||||
Comparable data = bLocation.getData();
|
||||
remove(bLocation,bPrevLocation);
|
||||
return data;
|
||||
}//end remove(Comparable)
|
||||
|
||||
|
||||
/**
|
||||
*Recurse Method for removing a node
|
||||
*@param bLocation, the location of the node
|
||||
*@param bPrevLocation, the Parent of bLocation
|
||||
*/
|
||||
private void remove(BSTNode bLocation,BSTNode bPrevLocation){
|
||||
|
||||
//if no kids
|
||||
if(bLocation.getLeft() == null && bLocation.getRight() == null){
|
||||
if(bPrevLocation == null){
|
||||
root = null;
|
||||
return;
|
||||
}
|
||||
|
||||
if(bPrevLocation.getLeft() == bLocation){
|
||||
bPrevLocation.setLeft(null);
|
||||
}
|
||||
else{//bPrevLocation.getRight() == bLocation
|
||||
bPrevLocation.setRight(null);
|
||||
}
|
||||
}
|
||||
|
||||
//one or two kids, gotta kill its parent, how sad
|
||||
else{
|
||||
BSTNode bTraverse;
|
||||
BSTNode bPrevTraverse;
|
||||
|
||||
if(bLocation.getRight() != null){
|
||||
bTraverse = bLocation.getRight();
|
||||
bPrevTraverse = bLocation;
|
||||
|
||||
while(bTraverse.getLeft() != null){
|
||||
bPrevTraverse = bTraverse;
|
||||
bTraverse = bTraverse.getLeft();
|
||||
}
|
||||
|
||||
bLocation.setData(bTraverse.getData());
|
||||
remove(bTraverse,bPrevTraverse);
|
||||
}
|
||||
else if(bLocation.getLeft() != null){
|
||||
bTraverse = bLocation.getLeft();
|
||||
bPrevTraverse = bLocation;
|
||||
|
||||
while(bTraverse.getRight() != null){
|
||||
bPrevTraverse = bTraverse;
|
||||
bTraverse = bTraverse.getRight();
|
||||
}
|
||||
|
||||
bLocation.setData(bTraverse.getData());
|
||||
remove(bTraverse,bPrevTraverse);
|
||||
}
|
||||
else{}
|
||||
}
|
||||
}//end remove(BSTNode,BSTNode)
|
||||
|
||||
|
||||
/**
|
||||
*Traverse tree output
|
||||
*/
|
||||
public void outputTree(){
|
||||
outputTree(root);
|
||||
}
|
||||
|
||||
/**
|
||||
*Traverse current
|
||||
*/
|
||||
public void outputTree(BSTNode current){
|
||||
if(current == null){
|
||||
return;
|
||||
}
|
||||
outputTree(current.getLeft());
|
||||
System.out.println(current);
|
||||
outputTree(current.getRight());
|
||||
}
|
||||
|
||||
/**
|
||||
*Clear Tree
|
||||
*/
|
||||
private void clearTree(){
|
||||
root = null;
|
||||
}
|
||||
|
||||
/**
|
||||
*Writes BST data to file
|
||||
*@param oos, the stream to write with
|
||||
*@param tree, the BST to get data from
|
||||
*/
|
||||
public void writeAircraft(BST tree,PrintWriter pw){
|
||||
writeAircraft(root,pw);
|
||||
}
|
||||
|
||||
/**
|
||||
*Writes BST data to file
|
||||
*@param oos, the stream to write with
|
||||
*@param current, the current node
|
||||
*/
|
||||
private void writeAircraft(BSTNode current,PrintWriter pw){
|
||||
if(current == null){
|
||||
return;
|
||||
}
|
||||
writeAircraft(current.getLeft(),pw);
|
||||
|
||||
Aircraft air = (Aircraft)current.getData();
|
||||
String temp = air.getModel() + " " + air.getNickname() + " " +
|
||||
air.getRole() + " " + air.getLaunchPriority();
|
||||
pw.println(temp);
|
||||
|
||||
writeAircraft(current.getRight(),pw);
|
||||
}
|
||||
|
||||
/**
|
||||
*creates the launchQueue for th aircraft carrier
|
||||
*/
|
||||
public void createLaunchQueue(BST bst,Heap toAdd){
|
||||
createLaunchQueue(bst.root,toAdd);
|
||||
}
|
||||
|
||||
/**
|
||||
*Helper method for createLaunchQueue(BST,Heap)
|
||||
*/
|
||||
private void createLaunchQueue(BSTNode current,Heap toAdd){
|
||||
if(current == null){
|
||||
return;
|
||||
}
|
||||
|
||||
createLaunchQueue(current.getRight(),toAdd);
|
||||
|
||||
((Aircraft)current.getData()).switchComparators();
|
||||
toAdd.insert(current);
|
||||
|
||||
createLaunchQueue(current.getLeft(),toAdd);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Debugging main for class BST.
|
||||
* This method will rigorously test my code.
|
||||
*
|
||||
* <br><br>
|
||||
* @param args a String array of command line arguments.
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
//lets test this sucker out
|
||||
BST bst = new BST();
|
||||
bst.addItr(new Integer(10));
|
||||
bst.addItr(new Integer(5));
|
||||
bst.addItr(new Integer(1));
|
||||
bst.addItr(new Integer(8));
|
||||
bst.addItr(new Integer(9));
|
||||
bst.addItr(new Integer(15));
|
||||
bst.addItr(new Integer(13));
|
||||
bst.addItr(new Integer(18));
|
||||
|
||||
bst.outputTree();
|
||||
|
||||
Integer five = new Integer(5);
|
||||
|
||||
System.out.println("\nTesting find()...");
|
||||
System.out.println(bst.find(five));
|
||||
System.out.println("Done.\n");
|
||||
|
||||
//remove w/0 kids
|
||||
bst.clearTree();
|
||||
bst.add(new Integer(10));
|
||||
bst.add(new Integer(5));
|
||||
bst.add(new Integer(1));
|
||||
bst.add(new Integer(8));
|
||||
bst.add(new Integer(9));
|
||||
bst.add(new Integer(15));
|
||||
bst.add(new Integer(13));
|
||||
bst.add(new Integer(18));
|
||||
|
||||
System.out.println("\nTesting remove(0 kids)...");
|
||||
bst.remove(new Integer(1));
|
||||
bst.outputTree();
|
||||
System.out.println("Done\n");
|
||||
|
||||
|
||||
//remove w/1 kid
|
||||
bst.clearTree();
|
||||
bst.add(new Integer(10));
|
||||
bst.add(new Integer(5));
|
||||
bst.add(new Integer(1));
|
||||
bst.add(new Integer(8));
|
||||
bst.add(new Integer(9));
|
||||
bst.add(new Integer(15));
|
||||
bst.add(new Integer(13));
|
||||
bst.add(new Integer(18));
|
||||
|
||||
System.out.println("\nTesting remove(1 kid)...");
|
||||
bst.remove(new Integer(8));
|
||||
bst.outputTree();
|
||||
System.out.println("Done\n");
|
||||
|
||||
//remove w/2 kids
|
||||
bst.clearTree();
|
||||
bst.add(new Integer(10));
|
||||
bst.add(new Integer(5));
|
||||
bst.add(new Integer(1));
|
||||
bst.add(new Integer(8));
|
||||
bst.add(new Integer(9));
|
||||
bst.add(new Integer(15));
|
||||
bst.add(new Integer(13));
|
||||
bst.add(new Integer(18));
|
||||
|
||||
System.out.println("\nTesting remove(2 kids)...");
|
||||
bst.remove(new Integer(5));
|
||||
bst.outputTree();
|
||||
System.out.println("Done\n");
|
||||
|
||||
//remove root
|
||||
bst.clearTree();
|
||||
bst.add(new Integer(10));
|
||||
bst.add(new Integer(5));
|
||||
bst.add(new Integer(1));
|
||||
bst.add(new Integer(8));
|
||||
bst.add(new Integer(9));
|
||||
bst.add(new Integer(15));
|
||||
bst.add(new Integer(13));
|
||||
bst.add(new Integer(18));
|
||||
|
||||
System.out.println("\nTesting remove(root)...");
|
||||
bst.remove(new Integer(10));
|
||||
bst.outputTree();
|
||||
System.out.println("Done\n");
|
||||
|
||||
//remove nothing single thing tree
|
||||
bst.clearTree();
|
||||
bst.add(new Integer(10));
|
||||
bst.remove(new Integer(10));
|
||||
bst.outputTree();
|
||||
|
||||
System.out.println("\nTesting remove(nothing but root tree)...");
|
||||
bst.remove(new Integer(10));
|
||||
bst.outputTree();
|
||||
System.out.println("Done\n");
|
||||
|
||||
|
||||
|
||||
|
||||
}// end of main(String[] args)
|
||||
|
||||
}// end of class BST
|
||||
150
CS1322/p4/BSTNode.java
Normal file
150
CS1322/p4/BSTNode.java
Normal file
@@ -0,0 +1,150 @@
|
||||
/**
|
||||
* <PRE>
|
||||
* BSTNode.java
|
||||
*
|
||||
* Revisions: 1.0 Oct. 16, 2002
|
||||
* Created the BSTNode class
|
||||
* 1.1 Oct. 19, 2002
|
||||
* Compiled, Finished
|
||||
* 1.2 Oct. 27, 2002
|
||||
* Commented
|
||||
*
|
||||
* </PRE>
|
||||
*
|
||||
* Collaboration Statement:
|
||||
* I worked on the homework assignment alone, using only
|
||||
* course materials.
|
||||
*
|
||||
* Created with JCreatorLE, some indents are off when viewed through notepad
|
||||
* or EMACS
|
||||
*
|
||||
* @author <A HREF="mailto:gtg184g@mail.gatech.edu">Jose Manuel Caban</A>
|
||||
* @version Version 1.2, Oct. 27, 2002
|
||||
*/
|
||||
|
||||
public class BSTNode implements Comparable{
|
||||
|
||||
public static final boolean bDebug = false; //nothing to debug
|
||||
|
||||
private Comparable data;
|
||||
private BSTNode left;
|
||||
private BSTNode right;
|
||||
|
||||
////////////////
|
||||
//Constructors//
|
||||
////////////////
|
||||
|
||||
/**
|
||||
*Default Constructor
|
||||
*/
|
||||
public BSTNode(){
|
||||
this(null);
|
||||
}
|
||||
|
||||
/**
|
||||
*@param data, the value of data
|
||||
*/
|
||||
public BSTNode(Comparable data){
|
||||
this.data = data;
|
||||
left = null;
|
||||
right = null;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////
|
||||
//Accessors/Modifiers//
|
||||
///////////////////////
|
||||
|
||||
/**
|
||||
*Accessor for data
|
||||
*@return value of data
|
||||
*/
|
||||
public Comparable getData(){
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
*Modifier for data
|
||||
*@param the value of data
|
||||
*/
|
||||
public void setData(Comparable data){
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
/**
|
||||
*Accessor for left
|
||||
*@return value of left
|
||||
*/
|
||||
public BSTNode getLeft(){
|
||||
return left;
|
||||
}
|
||||
|
||||
/**
|
||||
*Modifier for left
|
||||
*@param the value ofleft
|
||||
*/
|
||||
public void setLeft(BSTNode left){
|
||||
this.left = left;
|
||||
}
|
||||
|
||||
/**
|
||||
*Accessor for right
|
||||
*@return value of right
|
||||
*/
|
||||
public BSTNode getRight(){
|
||||
return right;
|
||||
}
|
||||
|
||||
/**
|
||||
*Modifier for right
|
||||
*@param the value ofright
|
||||
*/
|
||||
public void setRight(BSTNode right){
|
||||
this.right = right;
|
||||
}
|
||||
|
||||
///////////
|
||||
//Methods//
|
||||
///////////
|
||||
|
||||
/**
|
||||
*compareTo method
|
||||
*@return the value of data's compareTo()
|
||||
*/
|
||||
public int compareTo(Object o){
|
||||
if(o instanceof BSTNode){
|
||||
BSTNode temp = (BSTNode)o;
|
||||
return data.compareTo(temp.getData());
|
||||
}
|
||||
else{
|
||||
throw new ClassCastException();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*toString() method
|
||||
*@return data's toString()
|
||||
*/
|
||||
public String toString(){
|
||||
return data.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Debugging main for class BSTNode.
|
||||
* This method will rigorously test my code.
|
||||
*
|
||||
* <br><br>
|
||||
* @param args a String array of command line arguments.
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
BSTNode bob = new BSTNode(new Integer(7));
|
||||
BSTNode rob = new BSTNode(new Integer(7));
|
||||
BSTNode tod = new BSTNode(new Integer(6));
|
||||
|
||||
System.out.println(bob.compareTo(rob));
|
||||
System.out.println(bob.compareTo(tod));
|
||||
System.out.println(bob.toString());
|
||||
|
||||
}// end of main(String[] args)
|
||||
|
||||
}// end of class BSTNode
|
||||
175
CS1322/p4/Heap.java
Normal file
175
CS1322/p4/Heap.java
Normal file
@@ -0,0 +1,175 @@
|
||||
/**
|
||||
* <PRE>
|
||||
* Heap.java
|
||||
*
|
||||
* Revisions: 1.0 Oct. 27, 2002
|
||||
* Created the Heap class
|
||||
* 1.1 Oct. 27, 2002
|
||||
* Compiled, Finished
|
||||
* 1.2 Oct. 27, 2002
|
||||
* Commented
|
||||
*
|
||||
* </PRE>
|
||||
*
|
||||
* Collaboration Statement:
|
||||
* I worked on the homework assignment alone, using only
|
||||
* course materials.
|
||||
*
|
||||
* Created with JCreatorLE, some indents are off when viewed through notepad
|
||||
* or EMACS
|
||||
*
|
||||
* @author <A HREF="mailto:gtg184g@mail.gatech.edu">Jose Manuel Caban</A>
|
||||
* @version Version 1.2, Oct. 27, 2002
|
||||
*/
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class Heap {
|
||||
|
||||
private Vector data;
|
||||
|
||||
////////////////
|
||||
//Constructors//
|
||||
////////////////
|
||||
|
||||
/**
|
||||
*Default Constructor for Heap
|
||||
*@done sets the first element to null
|
||||
*/
|
||||
public Heap(){
|
||||
data = new Vector();
|
||||
data.add(null);
|
||||
}
|
||||
|
||||
///////////
|
||||
//Methods//
|
||||
///////////
|
||||
|
||||
/**
|
||||
*Swaps the elements at the given locations
|
||||
*@param a and b, the elements to be swapped
|
||||
*/
|
||||
private void swap(int a,int b){
|
||||
Comparable temp = (Comparable)data.elementAt(a);
|
||||
data.setElementAt(data.elementAt(b),a);
|
||||
data.setElementAt(temp,b);
|
||||
}
|
||||
|
||||
/**
|
||||
*Insert a piece of data into the Heap
|
||||
*@param toAdd, the data to be added
|
||||
*/
|
||||
public void insert(Comparable toAdd){//i changed this to toAdd because
|
||||
//the bright guy who decided to make us
|
||||
//use this.data.INSERTHERE() is a sadist
|
||||
int i = data.size();
|
||||
data.setElementAt(new Integer(i),0);
|
||||
data.add(toAdd);
|
||||
|
||||
while(i>1 &&
|
||||
((Comparable)data.elementAt(i)).compareTo(data.elementAt(i/2))<0){
|
||||
swap(i,(i/2));
|
||||
i /= 2;
|
||||
}
|
||||
}//end insert(Comparable)
|
||||
|
||||
/**
|
||||
*Arranges heap to be a heap
|
||||
*@param node, the node to be tested for heapitude
|
||||
*/
|
||||
private void heapify(int node){
|
||||
int iLeft = (node*2),iRight = ((node*2)+1),iMin = iLeft;
|
||||
int iSize = data.size()-1;
|
||||
|
||||
if(iLeft <= iSize &&
|
||||
((Comparable)data.elementAt(iLeft)).compareTo(data.elementAt(node))<0){
|
||||
iMin = iLeft;
|
||||
}
|
||||
else{
|
||||
iMin = node;
|
||||
}
|
||||
|
||||
if(iRight <= iSize &&
|
||||
((Comparable)data.elementAt(iRight)).compareTo(data.elementAt(iMin))<0){
|
||||
iMin = iRight;
|
||||
}
|
||||
|
||||
if(iMin != node){
|
||||
swap(iMin,node);
|
||||
heapify(iMin);
|
||||
}
|
||||
}//end heapify(int)
|
||||
|
||||
/**
|
||||
*Removes the largest piece of data from the heap
|
||||
*/
|
||||
public Comparable remove(){
|
||||
Comparable removed=null;
|
||||
|
||||
if(data.size()-1 > 0) {
|
||||
removed = (Comparable)data.elementAt(1);
|
||||
data.setElementAt(data.elementAt(data.size()-1), 1);
|
||||
|
||||
//reduce size
|
||||
Integer temp = (Integer)data.elementAt(0);
|
||||
temp = new Integer(temp.intValue()-1);
|
||||
data.setElementAt(temp,0);
|
||||
data.remove(temp.intValue()+1);
|
||||
heapify(1);
|
||||
}
|
||||
|
||||
|
||||
return removed;
|
||||
}//end remove()
|
||||
|
||||
/**
|
||||
*@return true if the heap is empty, false otherwise
|
||||
*/
|
||||
public boolean isEmpty(){
|
||||
if(data.size()>1){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*String representation of the Heap
|
||||
*/
|
||||
public String toString(){
|
||||
return data.toString();
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
|
||||
/**
|
||||
* Debugging main for class Heap.
|
||||
* This method will rigorously test my code.
|
||||
*
|
||||
* <br><br>
|
||||
* @param args a String array of command line arguments.
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
Heap heap = new Heap();
|
||||
System.out.println(heap.isEmpty());
|
||||
|
||||
heap.insert(new Integer(5));
|
||||
System.out.println(heap.isEmpty());
|
||||
heap.insert(new Integer(21));
|
||||
heap.insert(new Integer(1));
|
||||
heap.insert(new Integer(322));
|
||||
heap.insert(new Integer(12));
|
||||
heap.insert(new Integer(3252));
|
||||
heap.insert(new Integer(0));
|
||||
heap.insert(new Integer(223));
|
||||
System.out.println(heap.data);
|
||||
|
||||
heap.remove();
|
||||
System.out.println(heap.data);
|
||||
heap.remove();
|
||||
System.out.println(heap.data);
|
||||
|
||||
|
||||
|
||||
}// end of main(String[] args)
|
||||
|
||||
}// end of class Heap
|
||||
39
CS1322/p4/P4.java
Normal file
39
CS1322/p4/P4.java
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* <PRE>
|
||||
* P4.java
|
||||
*
|
||||
* Revisions: 1.0 Oct. 27, 2002
|
||||
* Created the P4 class
|
||||
* 1.1 Oct. 27, 2002
|
||||
* Compiled, tested, Commented
|
||||
*
|
||||
* </PRE>
|
||||
*
|
||||
* Collaboration Statement:
|
||||
* I worked on the homework assignment alone, using only
|
||||
* course materials.
|
||||
*
|
||||
* Created with JCreatorLE, some indents are off when viewed through notepad
|
||||
* or EMACS
|
||||
*
|
||||
* @author <A HREF="mailto:gtg184g@mail.gatech.edu">Jose Manuel Caban</A>
|
||||
* @version Version 1.1, Oct. 27, 2002
|
||||
*/
|
||||
|
||||
public class P4 {
|
||||
|
||||
/**
|
||||
* Debugging main for class P4.
|
||||
* This method will rigorously test my code.
|
||||
*
|
||||
* <br><br>
|
||||
* @param args a String array of command line arguments.
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
//Approx. Coding time for this file
|
||||
//3.2 Hours
|
||||
|
||||
AircraftCarrier USS_JOSE_RULES = new AircraftCarrier();
|
||||
}// end of main(String[] args)
|
||||
|
||||
}// end of class P4
|
||||
649
CS1322/p4/P4.nfo.txt
Normal file
649
CS1322/p4/P4.nfo.txt
Normal file
@@ -0,0 +1,649 @@
|
||||
CS1322 - Fall 2002 - Program 4
|
||||
|
||||
*** NOTE: THIS FILE IS BEST VIEWED IN AN EDITOR WITH 80 CHARACTER
|
||||
COLUMNS PER ROW ***
|
||||
|
||||
Assigned: Tuesday, October 15th, 2002
|
||||
Due: Monday, October 28th, 2002 at 23:59:59
|
||||
Stop Accepting: Tuesday, October 29th, 2002 at 08:00:00
|
||||
Phase II Instant Feedback Deadline: Monday, October 21st, 2002 at 23:59:59
|
||||
Phase IV Instant Feedback Deadline: Monday, October 28th, 2002 at 23:59:59
|
||||
|
||||
Title: "Java Goes to Sea"
|
||||
|
||||
|
||||
TOPICS
|
||||
======================================================================
|
||||
|
||||
Topics you should already understand that are relevant to this project:
|
||||
|
||||
o .equals method
|
||||
o Polymorphism/Dynamic Binding
|
||||
o Linked Lists
|
||||
o Object I/O
|
||||
o Useful Tools (Vector, StringTokenizer)
|
||||
|
||||
Topics you will learn from this project:
|
||||
|
||||
o Comparable
|
||||
o Binary Search Trees
|
||||
o Heaps
|
||||
o File I/O
|
||||
|
||||
Files provided to you for this project:
|
||||
|
||||
o P4.nfo.txt This file
|
||||
o aircraftFile.txt An input data file for this project
|
||||
|
||||
*NOTE: You are strongly encouraged to read this nfo file completely
|
||||
before starting on the project.
|
||||
|
||||
|
||||
|
||||
PROJECT OVERVIEW
|
||||
======================================================================
|
||||
|
||||
Welcome to the 4th programming assignment! After hearing about your
|
||||
prowess with programming data structures in Java, the United States Navy
|
||||
has asked you to develop a program to manage aircraft carrier flight
|
||||
operations. Aircraft storage in the hangar deck has become extremely
|
||||
disorganized and badly needs a data structure to maintain order
|
||||
efficiently. At the same time, the aircraft launched off a carrier
|
||||
must be deployed in a specific order to properly protect the
|
||||
ship as well as complete mission objectives. The Navy will provide
|
||||
you a text file containing aircraft. It is up to you to maintain a
|
||||
representation of these aircraft in alphabetical order by aircraft
|
||||
nickname while they are waiting in the hangar deck. The skipper of
|
||||
the carrier also wants to be able to locate an aircraft by nickname as
|
||||
well as throw an aircraft overboard (delete it) if need be. We will
|
||||
call a group of aircraft a "Strike Package". When the captain is
|
||||
ready to launch the strike package, he needs the aircraft ordered no
|
||||
longer by nickname but by their launch priority. The Navy also wants
|
||||
you to log (write to a file) the alphabetically ordered aircraft as
|
||||
well as the launch of the strike package. You will need a simple menu
|
||||
system to control the Navy's new software.
|
||||
|
||||
|
||||
|
||||
PHASE I - Aircraft (Approximate Coding Time: 1 hour)
|
||||
======================================================================
|
||||
|
||||
Comparable
|
||||
-----------------------------------
|
||||
|
||||
So...why was the .equals method so great anyway? It's great because
|
||||
it allows the programmer to customize the notion of equality. It was
|
||||
up to him or her to decide whether or not certain attributes of an
|
||||
object were relevant or not when determining the equality of two
|
||||
instances of that class. We will now take that concept one step
|
||||
further by allowing the programmer to customize the notion of not just
|
||||
equality but also "greater than" and "less than". We are no longer
|
||||
limited to saying that two instances are simply unequal. We can now
|
||||
say that this instance is "less than" that instance and that some
|
||||
other instance is "greater than" yet another instance. In order to
|
||||
provide the ability for instances of a class to compare themselves to
|
||||
each other, we need to have that class implement a special interface:
|
||||
Comparable. As in:
|
||||
|
||||
public class BabySeal implements Comparable {
|
||||
|
||||
Comparable has one method:
|
||||
|
||||
public int compareTo(Object o)
|
||||
|
||||
which is used in a similar manner to .equals. The int return value of
|
||||
compareTo represents our "less than", "greater than", or "equals"
|
||||
concepts. Lets say that objects A and B are both instances of the
|
||||
same class.
|
||||
|
||||
If A is LESS than B, the method call
|
||||
A.compareTo(B)
|
||||
will return an int LESS than zero.
|
||||
|
||||
If A is GREATER than B, the method call
|
||||
A.compareTo(B)
|
||||
will return an int GREATER than zero.
|
||||
|
||||
If A is EQUAL TO B, the method call
|
||||
A.compareTo(B)
|
||||
will return an int EQUAL TO zero.
|
||||
|
||||
|
||||
So how do we figure out what constitutes a "less than" or "greater
|
||||
than" relationship. That's up to you and the demands of the problem
|
||||
we're trying to solve just as what constituted equality with .equals
|
||||
was up to the demands of the problem. The guts of a compareTo method
|
||||
will remind you of .equals.
|
||||
|
||||
1. We first must check to see that the object passed in is, in
|
||||
fact, an instance of the same class to which we are comparing it.
|
||||
2. We then must cast the parameter (since it came in as an Object
|
||||
parameter) to the correct class.
|
||||
3. We then perform the necessary operation to decide the
|
||||
relationship and return an int representing that relationship.
|
||||
|
||||
See the lecture slides for more help
|
||||
|
||||
|
||||
Aircraft.java
|
||||
-----------------------------------
|
||||
|
||||
Create a class called Aircraft. The instances of this class will
|
||||
represent the aircraft we're managing for our aircraft carrier. We
|
||||
are going to be sorting these Aircraft instances in a couple different
|
||||
ways: alphabetically by nickname and by launch priority. Since we are sorting
|
||||
them, we will need to determine whether any given Aircraft is greater
|
||||
than or less than another Aircraft. Sounds like we're going to need
|
||||
to have Aircraft implement Comparable.
|
||||
|
||||
Your Aircraft class should have the following:
|
||||
|
||||
o A private instance variable called "model" of type String
|
||||
o A private instance variable called "nickname" of type String
|
||||
o A private instance variable called "role" of type String
|
||||
o A private instance variable called "launchPriority" of type Integer
|
||||
o All accessors and modifiers
|
||||
o A public Constructor taking in all four above instance variables
|
||||
o A public Constructor taking in only the nickname and chaining to the
|
||||
first Constructor
|
||||
|
||||
o A fifth private instance variable called "comparator" of type
|
||||
Comparable. This variable is what we will use to determine the
|
||||
greater than/less than relationship between Aircraft. It will
|
||||
hold a duplicate of either the nickname or the launchPriority.
|
||||
Remember, we want to order the Aircraft by nickname while they are
|
||||
waiting and we want to order them by launchPriority when they are
|
||||
being deployed from the carrier. This variable should initially be
|
||||
set to the nickname.
|
||||
|
||||
o A public method called switchComparators which takes in no parameters
|
||||
and returns void. This method will toggle the comparator
|
||||
variable between the nickname and the launchPriority. If the
|
||||
comparator is currently holding the nickname when this method is
|
||||
called, switch it to the launchPriority and vice versa.
|
||||
|
||||
o the public compareTo method which will compare the comparator
|
||||
variables of the two Aircraft instances and return this
|
||||
comparison. (HINT: String and Integer also implement Comparable)
|
||||
|
||||
How you choose to handle the case where the parameter is not the
|
||||
same class as "this" is up to you. Your means of handling such a
|
||||
case should be for debugging purposes only. You should never
|
||||
allow such a case to actually occur.
|
||||
|
||||
o A public toString method which prints out the following:
|
||||
|
||||
<model> <nickname> of Type <role> with launch priority <launchPriority>
|
||||
(i.e. F-14 Tomcat of Type Interceptor with launch priority 8)
|
||||
|
||||
NOTE: All instance variables should be private
|
||||
|
||||
|
||||
|
||||
PHASE II - Binary Search Trees - INSTANT FEEDBACK
|
||||
(Approximate Coding Time: 2 hours)
|
||||
======================================================================
|
||||
|
||||
So what exactly _is_ a Binary Tree? A Binary Tree is a dynamic data
|
||||
structure that is similar to a linked list, except that each node has two
|
||||
"nexts" instead of just one. We don't call them "next1" and "next2";
|
||||
instead we call them "left" and "right". Any nodes to the left or right
|
||||
of a node are it's children.
|
||||
|
||||
So what exactly _is_ a Binary Search Tree (BST)? A BST is a special Binary
|
||||
Tree that takes on a certain structure based on the ordering (values) of
|
||||
the nodes. This structure dictates that all children on the left of a node
|
||||
are "less than" that node and all children on the right are "greater than"
|
||||
that node. The ordering (the concept of "greater than" and "less than") is
|
||||
whatever we define it to be for certain data.
|
||||
|
||||
For example, the simplest BST is the empty BST. In this case, the "root"
|
||||
reference would be null.
|
||||
|
||||
_|_
|
||||
---
|
||||
|
||||
Suppose we have a Binary Search Tree (BST) with just one node in it. In
|
||||
this case, root would refer to a node, and that node's left and right
|
||||
references would be null. Let's say its value is 5.
|
||||
|
||||
+-----+
|
||||
| 5 |
|
||||
+-----+
|
||||
_/_ _\_
|
||||
--- ---
|
||||
|
||||
If we add 3 to this tree, the BST would determine whether 3 is less than 5.
|
||||
Since it is, the BST would add 3 to the left. This maintains the order of
|
||||
the BST.
|
||||
|
||||
+-----+
|
||||
| 5 |
|
||||
+-----+
|
||||
/
|
||||
+-----+
|
||||
| 3 |
|
||||
+-----+
|
||||
|
||||
If we add 7 to the tree, the BST would add it to the right since 7 is
|
||||
greater than 5.
|
||||
|
||||
+-----+
|
||||
| 5 |
|
||||
+-----+
|
||||
/ \
|
||||
+-----+ +-----+
|
||||
| 3 | | 7 |
|
||||
+-----+ +-----+
|
||||
|
||||
If we add 4 to the tree, the BST would go the left since 4 is less than 5,
|
||||
then it would compare 4 to 3 and add 4 to the right since 4 is greater
|
||||
than 3.
|
||||
|
||||
+-----+
|
||||
| 5 |
|
||||
+-----+
|
||||
/ \
|
||||
/ \
|
||||
+-----+ +-----+
|
||||
| 3 | | 7 |
|
||||
+-----+ +-----+
|
||||
\
|
||||
+-----+
|
||||
| 4 |
|
||||
+-----+
|
||||
|
||||
That was a quick intro to Binary Trees. This program will require you to
|
||||
implement some more sophisticated algorithms.
|
||||
|
||||
Traversals
|
||||
---------------------------------------------
|
||||
|
||||
A traversal is the examination of each node in the BST
|
||||
|
||||
Pre-order traversal- 15
|
||||
perform action->go left->go right / \
|
||||
(15,8,4,12,37,31,97) 8 3
|
||||
/ \ / \
|
||||
In-order traversal- 4 12 31 97
|
||||
go left->perform action->go right
|
||||
(4,8,12,15,31,37,97)
|
||||
|
||||
Post-order traversal-
|
||||
go left->go right->perform action
|
||||
(4,12,8,31,97,37,15)
|
||||
|
||||
|
||||
A few Algorithms for your viewing pleasure...
|
||||
---------------------------------------------
|
||||
Below are a few Algorithms that should prove useful.
|
||||
|
||||
ADDING
|
||||
------
|
||||
1) Check and see if your root is null.
|
||||
a) If your root is null, then go ahead and set the root to a new
|
||||
Node containing the data passed in.
|
||||
b) If the root isn't null, then pass the data and root to the
|
||||
helper.
|
||||
2) Compare the value in current to the value passed in. If the value
|
||||
of the new data is greater than that of the data already in current,
|
||||
then we want to go right. Otherwise we want to recurse left.
|
||||
a) Before going left or right, check and see if that direction is
|
||||
null. If it is, then go ahead and do a current.setLeft() or
|
||||
current.setRight() with a new Node. Otherwise, even when you
|
||||
change the value of current passed in, it's parent is still
|
||||
pointing to null.
|
||||
3) Recurse in the direction you decided, and continue doing the checks
|
||||
until a null value is found.
|
||||
|
||||
FIND
|
||||
----
|
||||
|
||||
1) Check and see if your root is null.
|
||||
a) If your root is null, return null - the value wasn't found
|
||||
b) If the root isn't null, then pass the data and root to the
|
||||
helper.
|
||||
2) Compare the value in current to the value passed in. If the
|
||||
value in current is equal to the value passed in, we found
|
||||
our target. If the value of the new data is greater than
|
||||
that of the data already in current, then we want to go
|
||||
right. Otherwise we want to recurse left.
|
||||
a) Before going left or right, check and see if that direction is
|
||||
null. If it is, then go ahead and return null - the value
|
||||
isn't present.
|
||||
3) Recurse in the direction you decided, and continue doing the checks
|
||||
until a null value is found.
|
||||
|
||||
|
||||
DELETE
|
||||
------
|
||||
|
||||
The exact algorithm of deletion from a list is left up to you.
|
||||
Here are a few guidelines though. There are three cases of node
|
||||
deletion to consider:
|
||||
|
||||
- Deleting a node with no children (i.e. a leaf node): Simply
|
||||
set this node's parent to null.
|
||||
|
||||
- Deleting a node with one child: Have the parent of the node to
|
||||
delete point to the child of the node to delete effectively
|
||||
skipping over the target node
|
||||
|
||||
- Deleting a node with two children: This case is significantly
|
||||
more involved. You must replace the target node with the node
|
||||
from the left subtree with the greatest value or replace the
|
||||
target node with the node from the right subtree with the
|
||||
least value. As an example:
|
||||
|
||||
|
||||
10 <- 10 is the root and the node to delete
|
||||
/ \
|
||||
5 15
|
||||
/ \ / \
|
||||
3 7 12 18
|
||||
/ \ / \ /\ / \
|
||||
1 4 6 9 11 14 17 19
|
||||
|
||||
|
||||
9 is the greatest node of the left subtree
|
||||
11 is the least node of the right subtree
|
||||
|
||||
The resulting tree would be: (we could have used 11 too.
|
||||
It's up to you)
|
||||
|
||||
9
|
||||
/ \
|
||||
5 15
|
||||
/ \ / \
|
||||
3 7 12 18
|
||||
/ \ / /\ / \
|
||||
1 4 6 11 14 17 19
|
||||
|
||||
If we were deleting 15, 14 would be the greatest node of
|
||||
the left subtree and 17 would be the least node of the
|
||||
right subtree.
|
||||
|
||||
Replacing the target node with the appropriate node ensures we
|
||||
maintain the proper BST structure
|
||||
|
||||
|
||||
Now for the project ....
|
||||
|
||||
Create a class called BSTNode. We want to be able to compare our
|
||||
BSTNodes to each other to determine where they would go in a Binary
|
||||
Search Tree. So make sure your BSTNode implements Comparable.
|
||||
|
||||
Your BSTNode class should include the following:
|
||||
|
||||
o A private instance variable called "data" of type Comparable
|
||||
o A private instance variable called "left" of type BSTNode
|
||||
o A private instance variable called "right" of type BSTNode
|
||||
o All accessors and modifiers
|
||||
o The public compareTo method which should return the value of the
|
||||
compareTo method of the "data" instance variable
|
||||
o A public toString method which should return the value of the
|
||||
toString method of the "data" instance variable
|
||||
|
||||
Create a class called BST. This class will arrange BSTNode instances
|
||||
in the proper "left < parent < right" order.
|
||||
|
||||
Your BST class should include the following:
|
||||
|
||||
o A private instance variable called "root" of type BSTNode
|
||||
o The public method "add" which takes in a Comparable and returns void.
|
||||
The Comparable parameter will be the data to add, not a
|
||||
BSTNode. So you will need to create a new BSTNode with this
|
||||
Comparable. Why don't we take in an Object as with
|
||||
LinkedLists? We need to ensure that the data coming can, in
|
||||
fact, be compared to other data in the tree so we can order the
|
||||
tree properly.
|
||||
|
||||
o The public method "find" which takes in a Comparable and returns
|
||||
Comparable. This method should locate the data in the tree
|
||||
that matches the parameter passed in (according to the
|
||||
compareTo method). If no such match exists, return null;
|
||||
|
||||
o The public method "remove" which takes in a Comparable and returns
|
||||
Comparable. This method will locate the data in the tree that
|
||||
matches the parameter passed in (according to the compareTo
|
||||
method) and remove it from the tree while maintaining the BST
|
||||
property. You should then return the data in the tree that
|
||||
matched this parameter. If no data matching the parameter is
|
||||
found, return null.
|
||||
|
||||
|
||||
|
||||
|
||||
PHASE III - Reading in the Aircraft from a file
|
||||
(Approximate Coding Time: 2 hours)
|
||||
========================================================================
|
||||
|
||||
This phase deals with reading in the aircraft from a file and storing
|
||||
them. Provided to you is a file called "aircraftFile.txt". If you
|
||||
open this file, you'll notice that there is one aircraft per line each
|
||||
with four pieces of data separated by spaces. These correspond to the
|
||||
four instance variables of the Aircraft class. You will be reading in
|
||||
each line of this file, creating a new Aircraft instance from the data
|
||||
on this line, and then storing it in a BST. Since the comparator
|
||||
variable in Aircraft is initially set to the nickname, we can be sure
|
||||
that the Aircraft are stored in the BST alphabetically by nickname.
|
||||
|
||||
Create a class called AircraftCarrier. Your class should have the
|
||||
following:
|
||||
|
||||
o A constant (use the keyword "final") called FILE_NAME which
|
||||
matches the name of the file to read in
|
||||
|
||||
o A private instance variable called "aircraftBST" which is of type
|
||||
BST. This variable will store our Aircraft instances in
|
||||
alphabetical order by nickname.
|
||||
|
||||
o A private instance variable called "strikePackageReady" which is of
|
||||
type boolean. This variable should initially be set to
|
||||
false. This variable will ensure we do not try to launch a
|
||||
strike package before the BST is filled with aircraft
|
||||
|
||||
o A method "findAircraft" which takes in no parameters and
|
||||
returns void. This method will be private. This method will
|
||||
prompt the user to enter the nickname of an aircraft to find
|
||||
using the keyboard. (You can use IOHelper if you wish) You
|
||||
should then perform a search of aircraftBST for an Aircraft
|
||||
matching this nickname. If a match is made, print out the
|
||||
Aircraft, otherwise print "No Aircraft Found". If
|
||||
strikePackageFound is set to false then the above actions
|
||||
should not be performed. Instead you should print "Strike
|
||||
Package Not Ready".
|
||||
|
||||
o A method "throwAircraftOverboard" which takes in no
|
||||
parameters and returns void. This method will be private.
|
||||
This method will prompt the user to enter the nickname of an
|
||||
aircraft to remove using the keyboard. (You can use IOHelper
|
||||
if you wish) You should then attempt to remove the Aircraft
|
||||
matching this nickname from the BST. If a removal is made,
|
||||
print out the Aircraft removed, otherwise print "No Aircraft
|
||||
Found". If strikePackageFound is set to false then the above
|
||||
actions should not be performed. Instead you should print
|
||||
"Strike Package Not Ready".
|
||||
|
||||
|
||||
NOTE: You cannot simply pass in the String containing the
|
||||
nickname to the find and remove methods. You cannot call
|
||||
compareTo between two different instances (Aircraft and
|
||||
Strings). Think about the Constructors you made in Aircraft.
|
||||
|
||||
|
||||
o a method "createNewStrikePackage" which takes in no
|
||||
parameters and returns void. This method will be private.
|
||||
This method opens aircraftFile.txt for reading and loads the
|
||||
BST with the newly created Aircraft instances. Use a
|
||||
StringTokenizer to separate the four pieces of data per line:
|
||||
|
||||
private void createNewStrikePackage() {
|
||||
|
||||
assign a new BST to aircraftBST (Be sure you do this! We
|
||||
don't want any old aircraft from our previous strike package
|
||||
in the BST representing this new strike package)
|
||||
|
||||
open file for reading
|
||||
while more lines
|
||||
use a StringTokenizer to gather the model, nickname, role
|
||||
and launchPriority for this Aircraft
|
||||
instantiate the Aircraft
|
||||
add it to the BST
|
||||
end loop
|
||||
|
||||
close the file
|
||||
|
||||
set strikePackageReady to true (Our strike package is now
|
||||
ready for launch)
|
||||
|
||||
*NOTE: The data the autograder will use always contains 4
|
||||
tokens per line: 3 Strings and an int.
|
||||
|
||||
o a private method "printStrikePackage" which takes in no parameters
|
||||
and returns void. This method will be private. This method
|
||||
opens a file called "strikePackage.txt" for writing. The
|
||||
method will perform an in-order traversal of aircraftBST and
|
||||
print one node per line. At the end, your file should have
|
||||
one Aircraft per line sorted by nickname. You should not have
|
||||
any aircraft from any previous printings. Don't forget to
|
||||
close the file.
|
||||
|
||||
|
||||
|
||||
PHASE IV - Heap - INSTANT FEEDBACK
|
||||
(Approximate Coding Time: 3 hours)
|
||||
========================================================================
|
||||
|
||||
Please refer to the following for all your Heap learning needs:
|
||||
|
||||
http://www.cc.gatech.edu/classes/AY2003/cs1322_fall/
|
||||
test_resources/current/study.html#heaps
|
||||
|
||||
|
||||
|
||||
Create a class called Heap that includes the following:
|
||||
|
||||
o a private instance variable called "data" of type Vector. This
|
||||
Vector will hold the data of your heap.
|
||||
|
||||
o the public method "insert" which will take in a Comparable and
|
||||
return void. This method will insert the Comparable into the
|
||||
heap maintaining heap structure.
|
||||
|
||||
o the public method "remove" which will take in no parameters and
|
||||
return a Comparable. This should remove the next element from
|
||||
the heap (which should be the element with the highest priority)
|
||||
while maintaining heap structure. If the heap is empty, return
|
||||
null.
|
||||
|
||||
o the public method "isEmpty" which takes in no parameters and
|
||||
returns a boolean. The method will return true if there are no
|
||||
more elements in the heap and false if there is at least one more
|
||||
element.
|
||||
|
||||
|
||||
|
||||
PHASE V - Filling in AircraftCarrier
|
||||
(Approximate Coding Time: 1.5 hours)
|
||||
========================================================================
|
||||
|
||||
Go back to AircraftCarrier. We will now be adding the ability to
|
||||
launch our Aircraft in order by launchPriority. Our program will be
|
||||
controlled through the use of a text menu displayed in the console.
|
||||
|
||||
Add the following to the class AircraftCarrier:
|
||||
|
||||
o a private instance variable called "launchQueue" of type Heap. This
|
||||
variable will hold the aircraft ordered not by nickname as in
|
||||
aircraftBST but instead by launchPriority.
|
||||
|
||||
o a method "launchAircraft" which takes in no parameters
|
||||
and returns void. This method will be private. In this method,
|
||||
you first must instantiate launchQueue. Then you must traverse
|
||||
aircraftBST in a manner of your choosing. At each node, store
|
||||
the aircraft data in a temporary variable. You should then delete
|
||||
that Aircraft from the tree. Then insert the aircraft into
|
||||
launchQueue. Remember, however, we want to order the aircraft by
|
||||
launchPriority now. But the compareTo method of Aircraft
|
||||
currently orders instances by nickname because that's what the
|
||||
comparator is set to. So before you insert the data into the
|
||||
launchQueue, call switchComparators on the temporary Aircraft variable
|
||||
to switch the compareTo method to order instances by launchPriority.
|
||||
|
||||
After filling your heap, launch the aircraft from the carrier.
|
||||
(Remove each Aircraft from launchQueue until the launchQueue is
|
||||
empty) When you launch an Aircraft, you should display that
|
||||
Aircraft to the screen as well as write that Aircraft to a file
|
||||
called "launchLog.txt". At the end of the launching you should
|
||||
have a file containing each Aircraft launched. You should not
|
||||
have any previous aircraft from any previous launches. The
|
||||
aircraft should appear sequentially by launchPriority. Don't
|
||||
forget to close the file.
|
||||
|
||||
Be sure to set "strikePackageReady" to false since the BST is empty.
|
||||
|
||||
o a private method "doMenu" that should display the following to the
|
||||
screen
|
||||
|
||||
1) Create New Strike Package
|
||||
2) Find Aircraft
|
||||
3) Throw Aircraft Overboard
|
||||
4) Print Strike Package to file
|
||||
5) Launch Aircraft
|
||||
6) Quit
|
||||
|
||||
Your method should read in the user's choice and call the
|
||||
appropriate method. If the user enters something other than a
|
||||
number between 1 and 6, print an appropriate error message and
|
||||
redisplay the menu. If the user enters 6, the program should
|
||||
exit gracefully.
|
||||
|
||||
o a public constructor that takes in no parameters. This constructor
|
||||
will call doMenu.
|
||||
|
||||
|
||||
|
||||
PHASE VI - Wrapping it up
|
||||
(Approximate Coding Time: 1 hour)
|
||||
========================================================================
|
||||
|
||||
Create a driver class called P4 with a main method. This main method
|
||||
will instantiate AircraftCarrier.
|
||||
|
||||
TEST TEST TEST!!
|
||||
|
||||
o Verify the output files generated by your program contain the
|
||||
proper data in the proper order.
|
||||
|
||||
o You may feel free to make up your own aircraft if you feel the
|
||||
ones we provide aren't enough. Keep in mind that the data the
|
||||
autograder will use to test is not the data in the file provided
|
||||
to you. The data the autograder uses will in no way attempt to
|
||||
"trick" your program.
|
||||
|
||||
o Your program should exit gracefully in all circumstances. This
|
||||
means no uncaught exceptions/stack traces.
|
||||
|
||||
o Many of you have been doing debug printing in your project
|
||||
through bDEBUG or otherwise. This is outstanding. Keep it up.
|
||||
Problem is, you're supposed to stop printing debug prints for the
|
||||
final submission. You may lose style points if you leave them in.
|
||||
|
||||
o !!! HEY !!! At no point during your program should you put
|
||||
System.exit(...). When we are grading your project this will
|
||||
cause the autograder to quit as well and we, the TAs, will be
|
||||
most unhappy about this.
|
||||
|
||||
As an aside, you are permitted and in some cases encouraged to add any
|
||||
helper methods or instance variables not explicitly mentioned that you
|
||||
feel will help to accomplish the above tasks.
|
||||
|
||||
Don't forget that when submitting files to webwork, submit ALL your
|
||||
files. Good Luck!
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
16
CS1322/p4/aircraftFile.txt
Normal file
16
CS1322/p4/aircraftFile.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
MH-53 SeaDragon Helicopter 3
|
||||
P-3C Orion Anti-submarine 4
|
||||
F-18 Hornet Multirole 11
|
||||
F-18E SuperHornet Multirole 10
|
||||
F-14 Tomcat Interceptor 8
|
||||
F-4 Phantom Interceptor 9
|
||||
EA-6B Prolwer Jamming 6
|
||||
UH-3 SeaKing Helicopter 16
|
||||
F-8 Crusader Reconaissance 7
|
||||
E-2C Hawkeye AWACS 1
|
||||
S-3B Viking Refueler 5
|
||||
SH-60 SeaHawk Helicopter 2
|
||||
AV-8 Harrier VTOL 12
|
||||
A-6 Intruder Bomber 13
|
||||
V-22 Osprey Transport 14
|
||||
CH-46 SeaKnight Helicopter 15
|
||||
BIN
CS1322/p4/cs1322-P4.zip
Normal file
BIN
CS1322/p4/cs1322-P4.zip
Normal file
Binary file not shown.
15
CS1322/p4/launchLog.txt
Normal file
15
CS1322/p4/launchLog.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
E-2C Hawkeye of Type AWACS with launch priority 1
|
||||
SH-60 SeaHawk of Type Helicopter with launch priority 2
|
||||
MH-53 SeaDragon of Type Helicopter with launch priority 3
|
||||
P-3C Orion of Type Anti-submarine with launch priority 4
|
||||
S-3B Viking of Type Refueler with launch priority 5
|
||||
EA-6B Prolwer of Type Jamming with launch priority 6
|
||||
F-8 Crusader of Type Reconaissance with launch priority 7
|
||||
F-4 Phantom of Type Interceptor with launch priority 9
|
||||
F-18E SuperHornet of Type Multirole with launch priority 10
|
||||
F-18 Hornet of Type Multirole with launch priority 11
|
||||
AV-8 Harrier of Type VTOL with launch priority 12
|
||||
A-6 Intruder of Type Bomber with launch priority 13
|
||||
V-22 Osprey of Type Transport with launch priority 14
|
||||
CH-46 SeaKnight of Type Helicopter with launch priority 15
|
||||
UH-3 SeaKing of Type Helicopter with launch priority 16
|
||||
BIN
CS1322/p4/p4.zip
Normal file
BIN
CS1322/p4/p4.zip
Normal file
Binary file not shown.
BIN
CS1322/p4/p4class.zip
Normal file
BIN
CS1322/p4/p4class.zip
Normal file
Binary file not shown.
0
CS1322/p4/strikePackage.txt
Normal file
0
CS1322/p4/strikePackage.txt
Normal file
Reference in New Issue
Block a user