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;
|
||||||
|
|
||||||
|
private Vehicle[] vehicles;
|
||||||
|
|
||||||
|
//Will be of type PDate after extention
|
||||||
|
private Date timeToLeaveToDest;
|
||||||
|
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(int numberOfPeople){
|
public Campaign(int numberOfPeople){
|
||||||
/*
|
setNumberOfPeople(numberOfPeople);
|
||||||
Make an array of pilgrims based on number of people with
|
|
||||||
a set ration pilgrims:workers
|
|
||||||
Assume not local
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// public Campaign(Pilgrim[] pilgrims){
|
public int getNumberOfPeople() {
|
||||||
// /*
|
return numberOfPeople;
|
||||||
// Calculate number of workers based on number of pilgrims (pilgrims.length;)
|
|
||||||
// Assume not local
|
|
||||||
// */
|
|
||||||
// }
|
|
||||||
|
|
||||||
public int getNumberofCars(){
|
|
||||||
//Assume each car holds 4 workers
|
|
||||||
return (int)workers/4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getNumberOfBusses(){
|
public void setNumberOfPeople(int numberOfPeople) {
|
||||||
return 0;//TODO: calc buses?
|
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() {
|
||||||
|
int busses = 0;
|
||||||
|
for (Vehicle vehicle : vehicles){
|
||||||
|
if (vehicle instanceof Bus) busses++;
|
||||||
|
}
|
||||||
|
return busses;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user