List<TerroristPlan> listOfPlans = new ArrayList<TerroristPlan>();
for (ShipEntity ship : db.getShips()) {
if (ship.hasTerroristPlan()) {
if (!listOfPlans.contains(ship.getTerroristPlan())) {
if (ship.getTerroristPlan().getTerroristPlanType() == TerroristPlanType.ExchangeIllicitCargo) {
ExchangeIllicitCargoPlan plan = (ExchangeIllicitCargoPlan)ship.getTerroristPlan();
System.out.println("Exchange Illicit Cargo Plan: ");
System.out.println("\tShip "
+ db.getShips().indexOf(plan.getMainShip())
+ " is the main ship of type "
+ plan.getMainShip().getShipType()
+ (plan.getMainShip().isHijacked() ? " and was hijacked " : " and has a terrorist crew member."));
if (!plan.getMainShip().isHijacked()) {
for (PersonEntity person : plan.getMainShip().getCrew()) {
if (person.isTerrorist()) {
System.out.println("\t\tPerson " + db.getPeople().indexOf(person)
+ " is a terrorist crew member.");
}
}
}
System.out.println("\tShip "
+ db.getShips().indexOf(plan.getSecondaryShip())
+ " is the secondary ship of type "
+ plan.getSecondaryShip().getShipType()
+ (plan.getSecondaryShip().isHijacked() ? " and was hijacked " : " and has a terrorist crew member."));
if (!plan.getSecondaryShip().isHijacked()) {
for (PersonEntity person : plan.getSecondaryShip().getCrew()) {
if (person.isTerrorist()) {
System.out.println("\t\tPerson " + db.getPeople().indexOf(person)
+ " is a terrorist crew member.");
}
}
}
} else if (ship.getTerroristPlan().getTerroristPlanType() == TerroristPlanType.BombingPort) {
BombingPortPlan plan = (BombingPortPlan)ship.getTerroristPlan();
System.out.println("Bombing Port Plan: ");
System.out.println("\tShip "
+ db.getShips().indexOf(plan.getShip())
+ " is the suicide ship of type "
+ plan.getShip().getShipType()
+ (plan.getShip().isHijacked() ? " and was hijacked " : " and has a terrorist crew member."));
if (!plan.getShip().isHijacked()) {
for (PersonEntity person : plan.getShip().getCrew()) {
if (person.isTerrorist()) {
System.out.println("\t\tPerson " + db.getPeople().indexOf(person)
+ " is a terrorist crew member.");
}
}