Campaign and Bus:
- Buses now have fixed vehicle length stored in STD_BUS_SIZE and are constructed without parameters. - Fixed generateBuses() in Campaign to not be public and used one in practice Signed-off-by: HeshamTB <hishaminv@gmail.com>
This commit is contained in:
parent
1bf7290dbf
commit
d242489985
@ -5,8 +5,10 @@ public class Bus extends CivilVehicle {
|
||||
private static int numeberOfBuses;
|
||||
private final int TIME_TO_FIX = 20; //in minutes
|
||||
|
||||
public Bus(double vehicleSize) {
|
||||
super(vehicleSize);
|
||||
public static final double STD_BUS_SIZE = 10;
|
||||
|
||||
public Bus() {
|
||||
super(STD_BUS_SIZE);
|
||||
generateUID();
|
||||
}
|
||||
|
||||
|
@ -5,13 +5,13 @@ public class Campaign {
|
||||
|
||||
private String UID;
|
||||
//private int housingNumber;
|
||||
//private String name; //TODO äÈÛÇ ÑÇíß íÇ åÔÇã (:
|
||||
//private String name;
|
||||
private District hotelDistrict;
|
||||
|
||||
private Route housingToDestRoute;
|
||||
private Route destToHousingRoute;
|
||||
|
||||
private ArrayList<Vehicle> vehicles;
|
||||
private ArrayList<Vehicle> vehicles = new ArrayList<>();
|
||||
|
||||
//Will be of type PDate after extention
|
||||
private Date timeToLeaveToDest;
|
||||
@ -77,8 +77,6 @@ public class Campaign {
|
||||
return busses;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ArrayList<Vehicle> getVehicles() {
|
||||
return vehicles;
|
||||
}
|
||||
@ -88,12 +86,9 @@ public class Campaign {
|
||||
this.vehicles = vehicles;
|
||||
}
|
||||
|
||||
|
||||
public void generateBusses(int number){
|
||||
//TODO: discuss. Make new list or add to old list?
|
||||
vehicles = new ArrayList<Vehicle>();
|
||||
private void generateBusses(int number){
|
||||
for (int i = 1; i <= number; i++) {
|
||||
vehicles.add(new Bus(10));//Throws NullPtrEx
|
||||
vehicles.add(new Bus());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user