Advertisement
Guest User

Untitled

a guest
Dec 18th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. class Buyer implements Comparable<Buyer>{
  2. public LocalTime arival;
  3. public LocalTime departure;
  4.  
  5. public Buyer(String arival, int timeSpent)
  6. {
  7. this.arival = LocalTime.parse(arival);
  8. this.departure = this.arival.plusMinutes(timeSpent);
  9. this.departure = this.departure.isAfter(this.arival) ? this.departure : LocalTime.of(23, 59);
  10. }
  11.  
  12. @Override
  13. public int compareTo(Buyer arg0) {
  14. return arival.compareTo(arg0.arival);
  15. }
  16.  
  17. public boolean isIn(LocalTime time)
  18. {
  19. return arival.compareTo(time) < 0&&time.compareTo(departure) < 0;
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement