Advertisement
Brord

Coffee script (?)

Mar 30th, 2015
457
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.04 KB | None | 0 0
  1. class School {
  2.     public static void main(String[] args){
  3.         Brord b = new Brord();
  4.         b.startCoding();
  5.     }
  6. }
  7.  
  8. class Brord extends AwesomePerson {
  9.     private static int coffeeRequired = Integer.MAX_INT;
  10.    
  11.     private int coffee = 0;
  12.    
  13.     public Brord(){
  14.         startActivity(Coffee.class, getMethod("startCoding"), getMethod("stopCoding");
  15.     }
  16.    
  17.     public boolean isBrainActive(){
  18.         return coffee > 0;
  19.     }
  20.    
  21.     public void stopCoding(){
  22.         Bram b = PersonManager.findPerson(Bram.class);
  23.         if (b != null && b.isBrainActive()){
  24.             starActivity(BuyCoffee.class, b, getMethod("startCoding"), stopCoding());
  25.         }
  26.     }
  27.    
  28.     public synchronised startCoding(){
  29.         while (coffee > 0){
  30.             codeLine();
  31.             wait(min_to_milsec(10));
  32.             coffee--;
  33.         }
  34.        
  35.     }
  36. }
  37.  
  38. class Coffee extends ActiveTask {
  39.     Coffee(AwesomePerson person, Runnable startTask){
  40.         person.drink(this);
  41.         startTask.run();
  42.     }
  43. }
  44.  
  45. class BuyCoffee extends ActiveMultiPersonTask {
  46.     Coffee(AwesomePerson person, Runnable startTask, AwesomePerson ... other){
  47.         person.drink(this);
  48.         startTask.run();
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement