Ejemplo n.º 1
0
  // Print the linked list
  public boolean Print() {
    List aux01;
    boolean var_end;
    Element var_elem;

    aux01 = this;
    var_end = end;
    var_elem = elem;
    while (!var_end) {
      System.out.println(var_elem.GetAge());
      aux01 = aux01.GetNext();
      var_end = aux01.GetEnd();
      var_elem = aux01.GetElem();
    }

    return true;
  }
Ejemplo n.º 2
0
  // Search for an element e on the list
  public int Search(Element e) {
    int int_ret_val;
    List aux01;
    Element var_elem;
    boolean var_end;
    int nt;

    int_ret_val = 0;
    aux01 = this;
    var_end = end;
    var_elem = elem;
    while (!var_end) {
      if (e.Equal(var_elem)) {
        int_ret_val = 1;
      } else nt = 0;
      aux01 = aux01.GetNext();
      var_end = aux01.GetEnd();
      var_elem = aux01.GetElem();
    }
    return int_ret_val;
  }
Ejemplo n.º 3
0
  // Delete an element e from the list
  public List Delete(Element e) {
    List my_head;
    boolean ret_val;
    boolean aux05;
    List aux01;
    List prev;
    boolean var_end;
    Element var_elem;
    int aux04;
    int nt;

    my_head = this;
    ret_val = false;
    aux04 = 0 - 1;
    aux01 = this;
    prev = this;
    var_end = end;
    var_elem = elem;
    while ((!var_end) & (!ret_val)) {
      if (e.Equal(var_elem)) {
        ret_val = true;
        if (aux04 < 0) {
          // delete first element
          my_head = aux01.GetNext();
        } else { // delete a non first element
          System.out.println(0 - 555);
          aux05 = prev.SetNext(aux01.GetNext());
          System.out.println(0 - 555);
        }
      } else nt = 0;
      if (!ret_val) {
        prev = aux01;
        aux01 = aux01.GetNext();
        var_end = aux01.GetEnd();
        var_elem = aux01.GetElem();
        aux04 = 1;
      } else nt = 0;
    }
    return my_head;
  }