Exemplo n.º 1
0
 public void setPower(boolean power) {
   if (!car.getPhone().getOnCall()) {
     if (power) {
       if (currentStation == null) setNextStation();
       startDate = new Date();
       radioStartTime = System.currentTimeMillis();
     } else {
       makeStationLog();
       car.addRadioLog(new RadioLog(user.getUserName(), startDate, radioStartTime));
       currentStation = null;
       startDate = null;
       radioStartTime = 0;
     }
     radioOn = power;
   } else {
     if (radioOn) {
       makeStationLog();
       car.addRadioLog(new RadioLog(user.getUserName(), startDate, radioStartTime));
       currentStation = null;
       startDate = null;
       radioStartTime = 0;
     }
     radioOn = false;
   }
 }
Exemplo n.º 2
0
 public void setStation(Station station) {
   if (currentStation != station) {
     makeStationLog();
   }
   if (isValidStation(station)) {
     currentStation = station;
     stationStartDate = new Date();
     stationStartTime = System.currentTimeMillis();
   } else currentStation = null;
 }