Commit b534b667 authored by michael lundquist's avatar michael lundquist
Browse files

Adding comments

parent 8f44858c
package com.ds.thirdlab;
/**
* Hello world!
*/
public final class App {
private App() {
}
/**
* Says hello to the world.
* @param args The arguments of the program.
*/
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
......@@ -7,6 +7,8 @@ package com.ds.thirdlab;
*
* After running the code, flights should be printed out according to their priority, i.e., flight with minimum priority gets printed first compared to other flights.
*
* @author <a href="mailto:mlundqu2@masonlive.gmu.edu">Michael Lundquist</a>
* Gnumber: G00737340
*/
public class Flight {
......
......@@ -2,6 +2,14 @@ package com.ds.thirdlab;
import javax.swing.JOptionPane;
/*
* This class gets user input for the priority queue of flights, then outputs the
* flights in priority order.
*
* @author <a href="mailto:mlundqu2@masonlive.gmu.edu">Michael Lundquist</a>
* Gnumber: G00737340
*/
public class FlightImplementation{
/**
* a) reads flight information from user input using JOptionPane as long as there are more flights to be added,
......
......@@ -46,7 +46,7 @@ public class Inputs{
* Prompts for input and parses it into an int.
*
* @param message the prompt used to the UI input
* @return
* @return an int given by the user.
*/
public static int promptInt(String message){
String userInputString = getString(message);
......
......@@ -2,9 +2,11 @@ package com.ds.thirdlab;
/**
* PQ entry
*
* doesn't implement comparator because we don't know generics
* This code was taken from IT306 Spring 2019. The calcKey was implemented by the "author"
*
*
* @author <a href="mailto:mlundqu2@masonlive.gmu.edu">Michael Lundquist</a>
* Gnumber: G00737340
*/
public class PQEntry {
private long key;
......@@ -21,14 +23,14 @@ public class PQEntry {
/**
* connecting flight, the key, and the connection period,
*
* * Higher priority is assigned to the connective flights with short-period connections. Non-connective flights have the lowest priority that means they are serviced last. Every flight has a flightNumber, an indication to whether or not it is connective, and a connection period in case it is a connective flight.
* Higher priority is assigned to the connective flights with short-period connections. Non-connective flights have the lowest priority that means they are serviced last. Every flight has a flightNumber, an indication to whether or not it is connective, and a connection period in case it is a connective flight.
*
* After running the code, flights should be printed out according to their priority, i.e., flight with minimum priority gets printed first compared to other flights.
* After running the code, flights should be printed out according to their priority, i.e.,
* flight with minimum priority gets printed first compared to other flights.
*
* This priority is then assigned to the member variable key.
*/
private void calcKey(){
//TODO part
//this is really it.
if(this.val.isConnectingFlight()){
this.key = this.val.getConnectionPeriod();
}else{
......
......@@ -3,8 +3,7 @@ package com.ds.thirdlab;
import java.util.*;
/**
*
*
* This code was taken from IT306 spring 2019
*/
public class UnsortedPriorityQueue {
......
......@@ -5,11 +5,14 @@ import org.junit.Test;
import static org.junit.Assert.*;
/**
* Unit test for simple App.
* Unit tests for adding planes to and removing planes from the priority queue
*
* @author <a href="mailto:mlundqu2@masonlive.gmu.edu">Michael Lundquist</a>
* Gnumber: G00737340
*/
public class AppTest {
/**
* Rigorous Test.
* This tests if 9 planes can be added, then removed.
*/
@Test
public void testAddRemove() {
......@@ -21,9 +24,9 @@ public class AppTest {
}
/**
* Adds 9 planes in reverse order
* Adds 9 planes in reverse order. One doesn't contain a connection period.
*
* @param pq
* @param pq the priority queue to add planes to
*/
public void addPlanes(UnsortedPriorityQueue pq) {
Flight flight;
......@@ -36,8 +39,9 @@ public class AppTest {
}
/**
* The test version
* This tests if removing planes is done in order.
*
* @see addPlanes(UnsortedPriorityQueue)
*/
@Test
public void orderedRemovePlanesTest() {
......@@ -54,7 +58,8 @@ public class AppTest {
}
/**
* The non-test version
* This simply removes all the planes from a priority queue.
* It doesn't test if it's done in order
*
* @param pq
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment