/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package hw4_multithreadtrucks; import java.util.*; import pbxlogique.Pbx; /** * * @author Peilos */ public class DebugMain { static private final long howLongToRunProgramForInMilli = 300000; static private final boolean bPrioritize = false; //PRIORITY SYSTEM ON? static public Vector vTruckList; static public Truck truck; static public Truck truck2; static public Truck truck3; static public Shovel shovel; static public Crusher crusher; @SuppressWarnings("empty-statement") public static void main(String[] args) { //INIT crusher = new Crusher(); shovel = new Shovel(1); truck = new Truck(1, 20, "Joe"); //truck2 = new Truck(1, 50, "Bob"); //truck3 = new Truck(1, 50, "John"); //MORE INIT truck.attachCrusher(crusher); truck.attachShovel(shovel); //truck2.attachCrusher(crusher); //truck2.attachShovel(shovel); //truck3.attachCrusher(crusher); //truck3.attachShovel(shovel); crusher.start(); shovel.start(); new TimeCal().RunForSomeTime(2000); System.out.println("-----====={ TIMER STARTING }=====-----"); System.out.println("-----Timer set: "+Pbx.antiDecimal(howLongToRunProgramForInMilli/1000,0)+" minutes\t -----"); System.out.println("-----Priority System: N/A -----"); System.out.println("-----=====~~~~~~~~~~~~~~~~~~=====-----"); truck.start(); //truck2.start(); //truck3.start(); new TimeCal().RunForSomeTime(howLongToRunProgramForInMilli); //END truck.jobFinished(); //truck2.jobFinished(); //truck3.jobFinished(); while (truck.isAlive()); //while (truck2.isAlive()); //while (truck3.isAlive()); crusher.shutDownCrusher(); shovel.shutDownShovel(); while (crusher.isAlive()); while (shovel.isAlive()); System.out.println(truck.getStats()); //System.out.println(truck2.getStats()); //System.out.println(truck3.getStats()); System.exit(0); } }