コード例 #1
0
ファイル: Radio.java プロジェクト: bsclayt1/CSE360-Project
 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;
   }
 }
コード例 #2
0
ファイル: Radio.java プロジェクト: bsclayt1/CSE360-Project
 public void setStation(Station station) {
   if (currentStation != station) {
     makeStationLog();
   }
   if (isValidStation(station)) {
     currentStation = station;
     stationStartDate = new Date();
     stationStartTime = System.currentTimeMillis();
   } else currentStation = null;
 }