Advertisement
Tal_Rofe

Spot_Project

Jan 6th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.06 KB | None | 0 0
  1. public class Spot implements Comparable{
  2.     private char status;
  3.     private String carID;
  4.     private int entryTime;
  5.     private int exitTime;
  6.    
  7.     @Override
  8.     public int compareTo(Object o) {
  9.         return this.exitTime - ((Spot)o).getExitTime();
  10.     }
  11.    
  12.     Spot(){
  13.         status = 'e'; // e - EMPTY, f - FULL, i - INVALID, s - SAVE, o - ORDERED
  14.         carID = "";
  15.         entryTime = 0;
  16.         exitTime = 0;
  17.     }
  18.    
  19.     Spot(char status, String carID, int timeLeaving, int entryTime){
  20.         this.status = status;
  21.         this.carID = carID;
  22.         this.entryTime = entryTime;
  23.         this.exitTime = timeLeaving;
  24.     }
  25.    
  26.     public int getStatus(){
  27.         return status;
  28.     }
  29.    
  30.     public String getcarID(){
  31.         return carID;
  32.     }
  33.    
  34.     public int getEntryTime(){
  35.         return entryTime;
  36.     }
  37.    
  38.     public int getExitTime(){
  39.         return exitTime;
  40.     }
  41.    
  42.     public void setStatus(char status){
  43.         this.status = status;
  44.     }
  45.    
  46.     public void setcarID(String carID){
  47.         this.carID = carID;
  48.     }
  49.    
  50.     public void setEntryTime(int entryTime){
  51.         this.entryTime = entryTime;
  52.     }
  53.    
  54.     public void setTimeLeaving(int exitTime){
  55.         this.exitTime = exitTime;
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement