/** @param args */ public static void main(String[] args) { // Welcome System.out.println("Welcome to my traffic simulation project."); System.out.println("Choose from the following options:"); System.out.println("start - Start a simulation"); System.out.println("stop - Stop a simulation"); System.out.println("0 - clear"); System.out.println("1 - init null hypothesis"); System.out.println("2 - init alt hypothesis"); System.out.println("3 - step 1"); System.out.println("4 - step n (1000x)"); System.out.println("5 - step continuous"); System.out.println("6 - print results"); System.out.println("exit - Exit the program"); System.out.println(""); // simulation initialization Simulation s = new Simulation(); // input initialization String command = ""; BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); while (!command.equals("exit")) { System.out.print("Input: "); try { command = reader.readLine(); } catch (IOException e) { System.out.println("Invalid input!"); e.printStackTrace(); } // parse int command if (command.matches("\\d+")) { mode = Integer.parseInt(command); } else { // do nothing } if (command.matches("start")) { s.start(); } if (command.matches("stop")) { run = false; } } }
@Test public void simplest() { StaticPlayer player = new StaticPlayer(); Simulation simulation = new Simulation(1000, 1000, 1, Integer.MAX_VALUE, 1, player); product = simulation.createProduct(0, 1); warehouse = simulation.addWarehouse(0, 0, 0); warehouse.setProductQuantity(product.getId(), 1); order = simulation.addOrder(0, 0, 100); order.add(product); player.submit(0, new Load(warehouse, product, 1)); player.submit(0, new Deliver(order, product, 1)); simulation.start(); }
public static void main(String[] args) { Simulation app = new Simulation(); app.start(); }