Exemplo n.º 1
0
  static void test00() {
    Aron.beg();
    PriorityQueue<Interval> queue = new PriorityQueue<Interval>();
    Stack<Interval> stack = new Stack<Interval>();
    int[] arr1 = {4, 1, 2, 6, 9};
    int[] arr2 = {5, 1, 4, 9, 10};

    for (int i = 0; i < arr1.length; i++) {
      queue.add(new Interval(arr1[i], arr2[i]));
    }
    if (queue.size() > 0) {
      stack.push(queue.remove());
    }
    while (!queue.isEmpty()) {
      Interval top = stack.peek();
      Interval inter = queue.remove();
      if (top.end < inter.begin) stack.push(inter);
      else {
        stack.peek().end = Math.max(stack.peek().end, inter.end);
      }
    }
    while (!stack.empty()) {
      System.out.println("[" + stack.peek().begin + " " + stack.peek().end + "]");
      stack.pop();
    }

    Aron.end();
  }
Exemplo n.º 2
0
  static void test1() {
    Aron.beg();

    getDay(DAY.SUNDAY);
    getDay(DAY.MONDAY);

    Aron.end();
  }
Exemplo n.º 3
0
 static void test0() {
   Aron.beg();
   Print.pbl("NUM=" + MyType.NUM.Value());
   Print.pbl("NUM=" + MyType.ROW.Value());
   Aron.end();
 }