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 static int numeberOfBuses;
|
||||||
private final int TIME_TO_FIX = 20; //in minutes
|
private final int TIME_TO_FIX = 20; //in minutes
|
||||||
|
|
||||||
public Bus(double vehicleSize) {
|
public static final double STD_BUS_SIZE = 10;
|
||||||
super(vehicleSize);
|
|
||||||
|
public Bus() {
|
||||||
|
super(STD_BUS_SIZE);
|
||||||
generateUID();
|
generateUID();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,13 +5,13 @@ public class Campaign {
|
|||||||
|
|
||||||
private String UID;
|
private String UID;
|
||||||
//private int housingNumber;
|
//private int housingNumber;
|
||||||
//private String name; //TODO äÈÛÇ ÑÇíß íÇ åÔÇã (:
|
//private String name;
|
||||||
private District hotelDistrict;
|
private District hotelDistrict;
|
||||||
|
|
||||||
private Route housingToDestRoute;
|
private Route housingToDestRoute;
|
||||||
private Route destToHousingRoute;
|
private Route destToHousingRoute;
|
||||||
|
|
||||||
private ArrayList<Vehicle> vehicles;
|
private ArrayList<Vehicle> vehicles = new ArrayList<>();
|
||||||
|
|
||||||
//Will be of type PDate after extention
|
//Will be of type PDate after extention
|
||||||
private Date timeToLeaveToDest;
|
private Date timeToLeaveToDest;
|
||||||
@ -77,8 +77,6 @@ public class Campaign {
|
|||||||
return busses;
|
return busses;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public ArrayList<Vehicle> getVehicles() {
|
public ArrayList<Vehicle> getVehicles() {
|
||||||
return vehicles;
|
return vehicles;
|
||||||
}
|
}
|
||||||
@ -88,12 +86,9 @@ public class Campaign {
|
|||||||
this.vehicles = vehicles;
|
this.vehicles = vehicles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void generateBusses(int number){
|
||||||
public void generateBusses(int number){
|
|
||||||
//TODO: discuss. Make new list or add to old list?
|
|
||||||
vehicles = new ArrayList<Vehicle>();
|
|
||||||
for (int i = 1; i <= number; i++) {
|
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