Advertisement
xickoh

WorkSchedule

Nov 11th, 2020
592
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.56 KB | None | 0 0
  1. //
  2. // Source code recreated from a .class file by IntelliJ IDEA
  3. // (powered by FernFlower decompiler)
  4. //
  5.  
  6. package WorkSchedule;
  7.  
  8. public class WorkSchedule {
  9.     private WorkSchedule.Hour[] hours;
  10.  
  11.     public WorkSchedule(int paramInt) {
  12.         this.hours = new WorkSchedule.Hour[paramInt];
  13.  
  14.         for(int i = 0; i < paramInt; ++i) {
  15.             this.hours[i] = new WorkSchedule.Hour();
  16.             this.hours[i].requiredNumber = 0;
  17.             this.hours[i].workingEmployees = new String[0];
  18.         }
  19.  
  20.     }
  21.  
  22.     public WorkSchedule.Hour readSchedule(int paramInt) {
  23.         return this.hours[paramInt];
  24.     }
  25.  
  26.     public void setRequiredNumber(int paramInt1, int paramInt2, int paramInt3) {
  27.         for(int i = paramInt2; i <= paramInt3; ++i) {
  28.             this.hours[i].requiredNumber = paramInt1;
  29.         }
  30.  
  31.     }
  32.  
  33.     public boolean addWorkingPeriod(String paramString, int paramInt1, int paramInt2) {
  34.         if (paramInt1 >= 0 && paramInt2 < this.hours.length) {
  35.             int i;
  36.             for(i = paramInt1; i <= paramInt2; ++i) {
  37.                 for(int j = 0; j < this.hours[i].workingEmployees.length; ++j) {
  38.                     if (this.hours[i].workingEmployees[j].equals(paramString)) {
  39.                         return false;
  40.                     }
  41.                 }
  42.  
  43.                 if (this.hours[i].requiredNumber == this.hours[i].workingEmployees.length) {
  44.                     return false;
  45.                 }
  46.             }
  47.  
  48.             for(i = paramInt1; i <= paramInt2; ++i) {
  49.                 String[] arrayOfString = new String[this.hours[i].workingEmployees.length + 1];
  50.  
  51.                 for(int k = 0; k < this.hours[i].workingEmployees.length; ++k) {
  52.                     arrayOfString[k] = this.hours[i].workingEmployees[k];
  53.                 }
  54.  
  55.                 arrayOfString[this.hours[i].workingEmployees.length] = paramString;
  56.                 this.hours[i].workingEmployees = arrayOfString;
  57.             }
  58.  
  59.             return true;
  60.         } else {
  61.             return false;
  62.         }
  63.     }
  64.  
  65.     public String[] workingEmployees(int paramInt1, int paramInt2) {
  66.         String[] arrayOfString1 = new String[this.hours[paramInt1].workingEmployees.length + this.hours[paramInt2].workingEmployees.length];
  67.         int i = 0;
  68.  
  69.         int k;
  70.         int j;
  71.         for(j = 0; j < this.hours[paramInt1].workingEmployees.length; ++j) {
  72.             for(k = 0; k < i && !arrayOfString1[k].equals(this.hours[paramInt1].workingEmployees[j]); ++k) {
  73.             }
  74.  
  75.             if (k == i) {
  76.                 arrayOfString1[i++] = this.hours[paramInt1].workingEmployees[j];
  77.             }
  78.         }
  79.  
  80.         for(j = 0; j < this.hours[paramInt2].workingEmployees.length; ++j) {
  81.             for(k = 0; k < i && !arrayOfString1[k].equals(this.hours[paramInt2].workingEmployees[j]); ++k) {
  82.             }
  83.  
  84.             if (k == i) {
  85.                 arrayOfString1[i++] = this.hours[paramInt2].workingEmployees[j];
  86.             }
  87.         }
  88.  
  89.         String[] arrayOfString2 = new String[i];
  90.  
  91.         for(k = 0; k < i; ++k) {
  92.             arrayOfString2[k] = arrayOfString1[k];
  93.         }
  94.  
  95.         return arrayOfString2;
  96.     }
  97.  
  98.     public int nextIncomplete(int paramInt) {
  99.         for(int i = paramInt; i < this.hours.length; ++i) {
  100.             if (this.hours[i].requiredNumber > this.hours[i].workingEmployees.length) {
  101.                 return i;
  102.             }
  103.         }
  104.  
  105.         return -1;
  106.     }
  107.  
  108.     public class Hour {
  109.         int requiredNumber;
  110.         String[] workingEmployees;
  111.  
  112.         public Hour() {
  113.         }
  114.     }
  115. }
  116.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement