Added Flight POint Test as well as some Exceptions
This commit is contained in:
@@ -197,7 +197,10 @@ public class FlightPoint {
|
||||
* gets the Path Index ID at this point.
|
||||
* @return
|
||||
*/
|
||||
public int getIndex(){
|
||||
public int getIndex() throws DataException{
|
||||
if (indexID == -1){
|
||||
throw new DataException("Index ID is not set.");
|
||||
}
|
||||
return indexID;
|
||||
}
|
||||
|
||||
|
||||
@@ -204,7 +204,14 @@ public class FlightRDController extends Controller {
|
||||
*/
|
||||
public void deletePoint() {
|
||||
FlightPoint toDelete = flightTableView.getSelectionModel().getSelectedItem();
|
||||
int pathID = toDelete.getIndex();
|
||||
int pathID = 0;
|
||||
try {
|
||||
pathID = toDelete.getIndex();
|
||||
} catch (DataException e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("Point is Undeletable as the Index ID is not set.");
|
||||
return;
|
||||
}
|
||||
LinkedHashMap<Integer, FlightPath> flightPathDict = theDataSet.getFlightPathDictionary();
|
||||
FlightPath toDeletesPath = flightPathDict.get(pathID);
|
||||
theDataSet.deleteFlightPoint(toDelete, toDeletesPath);
|
||||
|
||||
Reference in New Issue
Block a user