示例#1
0
 public void beforeInsert(LinkedListToken insert)
 {
     if (insert.getPrev() != null)
     {
         throw new ArgumentException("beforeInsert(" + insert + ") : prev was not null");
     }
     if (insert.getNext() != null)
     {
         throw new ArgumentException("beforeInsert(" + insert + ") : next was not null");
     }
     insert.prev = prev;
     insert.next = this;
     if (prev != null)
     {
         prev.next = insert;
     }
     prev = insert;
 }
示例#2
0
 public void afterInsert(LinkedListToken insert)
 {
     if (insert.getPrev() != null)
     {
         throw new ArgumentException("afterInsert(" + insert + ") : prev was not null");
     }
     if (insert.getNext() != null)
     {
         throw new ArgumentException("afterInsert(" + insert + ") : next was not null");
     }
     insert.next = next;
     insert.prev = this;
     if (next != null)
     {
         next.prev = insert;
     }
     next = insert;
 }