Advertisement
anemic_prince

Untitled

Apr 10th, 2020
586
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.10 KB | None | 0 0
  1. public class Channel {
  2.     public static double currentTime;
  3.     private int channelId;
  4.     private double willFreeTime;
  5.     private boolean isFree;
  6.  
  7.     public Channel(int channelId) {
  8.         this.channelId = channelId;
  9.         this.willFreeTime = 0;
  10.         this.isFree = true;
  11.     }
  12.  
  13.     public void setChannelId(int channelId) {
  14.         this.channelId = channelId;
  15.     }
  16.  
  17.     public int getChannelId() {
  18.         return channelId;
  19.     }
  20.  
  21.     public void setWillFreeTime(double willFreeTime) {
  22.         this.willFreeTime = willFreeTime;
  23.     }
  24.  
  25.     public double getWillFreeTime() {
  26.         return willFreeTime;
  27.     }
  28.  
  29.     public void setIsFree(boolean isFree) {
  30.         this.isFree = isFree;
  31.     }
  32.  
  33.     public boolean getIsFree() {
  34.         return isFree;
  35.     }
  36.  
  37.     public boolean CheckFree(double time) {
  38.         return this.willFreeTime < time;
  39.     }
  40.  
  41.     public boolean SetTask(double time) {
  42.         if(this.isFree) {
  43.             this.willFreeTime = currentTime + time;
  44.             this.isFree = false;
  45.             return true;
  46.         }
  47.         else return false;
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement