University stuff.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Main.java 804B

12345678910111213141516171819202122232425262728293031323334353637
  1. class Main {
  2. public static void main(String[] args) {
  3. if (args.length != 1) {
  4. System.out.println("Usage: java Main <n>");
  5. System.exit(1);
  6. }
  7. NPunkter17 points = new NPunkter17(Integer.parseInt(args[0]));
  8. int[] x = new int[points.n];
  9. int[] y = new int[points.n];
  10. System.out.println("Filling...");
  11. points.fyllArrayer(x, y);
  12. System.out.println("Done.");
  13. Oblig4 seq = new Sequential(x, y, points.n);
  14. Oblig4 par = new Parallel(x, y, points.n);
  15. Timer tseq = run(seq, null);
  16. run(par, tseq);
  17. seq.draw();
  18. par.draw();
  19. }
  20. static Timer run(Oblig4 o, Timer base) {
  21. Timer t = new Timer().start();
  22. o.solve();
  23. t.end();
  24. if (base == null)
  25. System.out.println(o.name+": "+t.prettyTime());
  26. else
  27. System.out.println(o.name+": "+t.prettySpeedup(base));
  28. return t;
  29. }
  30. }