コード例 #1
0
 /**
  * The method checks the object to <code>null</code> completeness of all positions are empty
  * positions are not allowed
  *
  * @param flight - Flight object being checked
  * @return - false, if everything checks out correctly; true - if the data is invalid
  */
 private static boolean checkEmpty(Flight flight) {
   return flight == null
       || flight.getDate() == null
       || flight.getFrom() == null
       || flight.getTo() == null
       || flight.getPlane() == null;
 }
コード例 #2
0
 /**
  * The method checks the date of departure, it would not be the in the past
  *
  * @param flight - Flight object being checked
  * @return - false, if everything checks out correctly; true - if the data is invalid
  */
 private boolean checkDate(Flight flight) {
   Date yesterdayDate = new Date(System.currentTimeMillis() - 1000L * 60L * 60L * 24L);
   Date flightDate = flight.getDate();
   return yesterdayDate.after(flightDate);
 }