Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class School {
- public static void main(String[] args){
- Brord b = new Brord();
- b.startCoding();
- }
- }
- class Brord extends AwesomePerson {
- private static int coffeeRequired = Integer.MAX_INT;
- private int coffee = 0;
- public Brord(){
- startActivity(Coffee.class, getMethod("startCoding"), getMethod("stopCoding");
- }
- public boolean isBrainActive(){
- return coffee > 0;
- }
- public void stopCoding(){
- Bram b = PersonManager.findPerson(Bram.class);
- if (b != null && b.isBrainActive()){
- starActivity(BuyCoffee.class, b, getMethod("startCoding"), stopCoding());
- }
- }
- public synchronised startCoding(){
- while (coffee > 0){
- codeLine();
- wait(min_to_milsec(10));
- coffee--;
- }
- }
- }
- class Coffee extends ActiveTask {
- Coffee(AwesomePerson person, Runnable startTask){
- person.drink(this);
- startTask.run();
- }
- }
- class BuyCoffee extends ActiveMultiPersonTask {
- Coffee(AwesomePerson person, Runnable startTask, AwesomePerson ... other){
- person.drink(this);
- startTask.run();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement