Min/Max for history
This commit is contained in:
parent
c07dc8a87c
commit
f137b07c1e
@ -106,6 +106,8 @@ class State implements Serializable {
|
||||
private Date allArrivedToArafatTime;
|
||||
private Date allArrivedToHotelsTime;
|
||||
private Date stateTime;
|
||||
private String maxTrip;
|
||||
private String minTrip;
|
||||
|
||||
public State(ArrayList<Campaign> listOfCampaigns,
|
||||
ArrayList<Vehicle> listOfVehicles,
|
||||
@ -128,6 +130,14 @@ class State implements Serializable {
|
||||
this.allArrivedToHotelsTime = (Date) allArrivedToHotelsTime.clone();
|
||||
}
|
||||
this.stateTime = stateTime;
|
||||
if (Vehicle.getMinArrived() != null && Vehicle.getMaxArrived() != null){
|
||||
this.maxTrip = Vehicle.getMaxArrived().getTripTime();
|
||||
this.minTrip = Vehicle.getMinArrived().getTripTime();
|
||||
}
|
||||
else {
|
||||
this.maxTrip = "N/A";
|
||||
this.minTrip = "N/A";
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<Campaign> getListOfCampaigns() {
|
||||
@ -161,5 +171,12 @@ class State implements Serializable {
|
||||
public Date getStateTime() {
|
||||
return stateTime;
|
||||
}
|
||||
|
||||
|
||||
public String getMaxTrip() {
|
||||
return maxTrip;
|
||||
}
|
||||
|
||||
public String getMinTrip() {
|
||||
return minTrip;
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ import java.awt.SystemColor;
|
||||
public class GUI_History {
|
||||
|
||||
private List<State> states;
|
||||
private State selectedState;
|
||||
private ArrayList<Campaign> listOfCampaigns;
|
||||
private ArrayList<Vehicle> listOfVehicles;
|
||||
private ArrayList<Campaign>[] campPerDistrict;
|
||||
@ -39,7 +40,7 @@ public class GUI_History {
|
||||
"Local Vehicles","Avg. Time"};
|
||||
private String[] districtColNames = {"District", "Campaigns", "Busses", "Arrival %",
|
||||
"Avg. Time", "Best time to Arafat", "Best time to District"};
|
||||
|
||||
|
||||
public GUI_History(List<State> states) {
|
||||
this.states = states;
|
||||
makeFrame();
|
||||
@ -302,6 +303,7 @@ public class GUI_History {
|
||||
stdRoutes = state.getStdRoutes();
|
||||
stdStreet = state.getStdStreet();
|
||||
currenttimeManager = state.getStateTime();
|
||||
selectedState = state;
|
||||
}
|
||||
|
||||
public void updateFrame() {
|
||||
@ -348,16 +350,13 @@ public class GUI_History {
|
||||
String numOfdoneBuses = String.format("%d", getNumberOfArrivedBusses());
|
||||
lblNumOfDonebuses.setText(numOfdoneBuses);
|
||||
|
||||
if (Vehicle.getMaxArrived() != null && Vehicle.getMinArrived() != null) {
|
||||
lblMaximumTripValue.setText(Vehicle.getMaxArrived().getTripTime().toString());
|
||||
lblMinimumTripValue.setText(Vehicle.getMinArrived().getTripTime().toString());
|
||||
}
|
||||
|
||||
String NumberOfBussPerHour = String.format("%d", getNumberOfArrivedBussesPerHour());
|
||||
lblBusesArrivedInTheLastHourValue.setText(NumberOfBussPerHour);
|
||||
|
||||
lblAverageTripForLastHourValue.setText(avgTimeOfTrip());
|
||||
lblAverageTimeForTheTrip.setText(getAvgTripForAllDis());
|
||||
lblMaximumTripValue.setText(selectedState.getMaxTrip());
|
||||
lblMinimumTripValue.setText(selectedState.getMinTrip());
|
||||
}
|
||||
|
||||
//Methods
|
||||
|
Loading…
Reference in New Issue
Block a user