Type LinkList = class private count_; head_; tail_; public Function Create(); Function Add(data); Function Remove(index, fp); Function Size(); Function Get(index, fp); Function Find(index, fp); End; Function LinkList.Create(); Begin head_ := new List(nil); tail_ := head_; count_ := 0; End; Function LinkList.Add(data); Begin list := new List(data); tail_.next := list; list.prev := tail_; tail_ := list; count_ ++; End; Function LinkList.Remove(index, fp); Begin node := Find(index, fp); if ifnil(node) then return; if node = tail_ then tail_ := node.prev; else begin node.prev.next := node.next; node.next.prev := node.prev; node := nil; end count_--; End; Function LinkList.Size(); Begin return count_; End; Function LinkList.Find(index, fp); Begin node := head_.next; while (node) do begin if (fp and fp.do(index, node.data)) or node.data = index then return node; node := node.next; end return nil; End; Function LinkList.Get(index, fp); Begin node := Find(index, fp); return ifnil(node) ? nil : node.data; End; Type List = class public data; prev; next; Function Create(value); Begin data := value; prev := nil; next := nil; End; End;