コード例 #1
0
  public static void cancel(mtproject2 list1, mtproject2 list2, mtproject2 list3, int element) {
    if (list1.findingelement(element) == true) {
      list1.deleteitem(element);
    } else if (list2.findingelement(element) == true) {
      list2.deleteitem(element);

    } else if (list3.findingelement(element) == true) {
      list3.deleteitem(element);
    }
  }
コード例 #2
0
  public static void remove(mtproject2 list1, mtproject2 list2, mtproject2 list3) {
    int a, b, c, d;

    a = list1.checkforfirst();
    b = list2.checkforfirst();
    c = list3.checkforfirst();
    d = LLdetermination(a, b, c);
    if (d == 1) {
      list1.deletingfirst();
      System.out.println("Removed" + " " + a);
    } else if (d == 2) {
      list2.deletingfirst();
      System.out.println("Removed" + " " + b);

    } else if (d == 3) {
      list3.deletingfirst();
      System.out.println("Removed" + " " + c);

    } else {
      System.out.println("Remove called on empty lists");
    }
  }
コード例 #3
0
  // function for adding element to respective list
  public static void add_list(mtproject2 list1, mtproject2 list2, mtproject2 list3, int element) {
    int s1, s2, s3, res;

    s1 = list1.sizeof();
    s2 = list2.sizeof();
    s3 = list3.sizeof();

    res = find_small(s1, s2, s3);

    if (res == s1) {
      list1.final_add(element);
      // list1.bubbleSort();
      System.out.println("Added" + " " + element + " " + "to L1");
    } else if (res == s2) {
      list2.final_add(element);
      // list2.bubbleSort();
      System.out.println("Added" + " " + element + " " + "to L2");
    } else if (res == s3) {
      list3.final_add(element);
      // list2.bubbleSort();
      System.out.println("Added" + " " + element + " " + "to L3");
    }
  }