Campaign update:
- Remove fields as discussed in first project meeting - Add 2 Routes to each object with get/set Signed-off-by: HeshamTB <hishaminv@gmail.com>
This commit is contained in:
parent
e12c5ec296
commit
49f7be0ceb
@ -7,5 +7,6 @@ public interface Breakable {
|
|||||||
boolean isInAccident();
|
boolean isInAccident();
|
||||||
void collide(Breakable car, Date time);
|
void collide(Breakable car, Date time);
|
||||||
void _break(Date time);
|
void _break(Date time);
|
||||||
|
void fix();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,34 +1,63 @@
|
|||||||
|
import java.util.Date;
|
||||||
|
|
||||||
public class Campaign {
|
public class Campaign {
|
||||||
|
|
||||||
private int UID;
|
private int UID;
|
||||||
private int workers;
|
|
||||||
private int numberOfPeople;
|
private int numberOfPeople;
|
||||||
private String district;
|
private int housingNumber;
|
||||||
private String name;
|
private String name;
|
||||||
private boolean local;
|
private boolean local;
|
||||||
|
|
||||||
|
private Route housingToDestRoute;
|
||||||
|
private Route destToHousingRoute;
|
||||||
|
|
||||||
public Campaign(int numberOfPeople){
|
private Vehicle[] vehicles;
|
||||||
/*
|
|
||||||
Make an array of pilgrims based on number of people with
|
//Will be of type PDate after extention
|
||||||
a set ration pilgrims:workers
|
private Date timeToLeaveToDest;
|
||||||
Assume not local
|
private Date timeToLeaveToHousing;
|
||||||
*/
|
|
||||||
|
public Campaign(int numberOfPeople, String name, Route housingToDestRoute, Route destToHousingRoute) {
|
||||||
|
setNumberOfPeople(numberOfPeople);
|
||||||
|
this.name = name;
|
||||||
|
this.housingToDestRoute = housingToDestRoute;
|
||||||
|
this.destToHousingRoute = destToHousingRoute;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public Campaign(Pilgrim[] pilgrims){
|
public Campaign(int numberOfPeople){
|
||||||
// /*
|
setNumberOfPeople(numberOfPeople);
|
||||||
// Calculate number of workers based on number of pilgrims (pilgrims.length;)
|
}
|
||||||
// Assume not local
|
|
||||||
// */
|
|
||||||
// }
|
|
||||||
|
|
||||||
public int getNumberofCars(){
|
public int getNumberOfPeople() {
|
||||||
//Assume each car holds 4 workers
|
return numberOfPeople;
|
||||||
return (int)workers/4;
|
}
|
||||||
|
|
||||||
|
public void setNumberOfPeople(int numberOfPeople) {
|
||||||
|
if (numberOfPeople > 0) this.numberOfPeople = numberOfPeople;
|
||||||
|
else throw new IllegalArgumentException("Negative number of people in camp");
|
||||||
|
}
|
||||||
|
|
||||||
|
public Route getHousingToDestRoute() {
|
||||||
|
return housingToDestRoute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHousingToDestRoute(Route housingToDestRoute) {
|
||||||
|
this.housingToDestRoute = housingToDestRoute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Route getDestToHousingRoute() {
|
||||||
|
return destToHousingRoute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDestToHousingRoute(Route destToHousingRoute) {
|
||||||
|
this.destToHousingRoute = destToHousingRoute;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getNumberOfBusses() {
|
public int getNumberOfBusses() {
|
||||||
return 0;//TODO: calc buses?
|
int busses = 0;
|
||||||
|
for (Vehicle vehicle : vehicles){
|
||||||
|
if (vehicle instanceof Bus) busses++;
|
||||||
|
}
|
||||||
|
return busses;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user