/**** * * Implementation of IntList. * */ #include #include #include "intlist.h" IntListElem* IntList::Pull() { return (IntListElem *) List::Pull(); } IntListElem* IntList::Pop() { return (IntListElem *) List::Pop(); } IntListElem* IntList::GetNth(int n) { return (IntListElem *) List::GetNth(n); } IntListElem* IntList::RemoveNth(int n) { return (IntListElem *) List::RemoveNth(n); } IntListElem* IntList::Find(int k) { return (IntListElem *) List::Find((ListElemKey*) k); } int IntList::FindPos(int k) { return List::FindPos((ListElemKey*) k); } IntListElem* IntList::Enum() { return (IntListElem *) List::Enum(); } IntListElem::IntListElem(int initval) : data(initval) {} IntListElem::~IntListElem() { } int IntListElem::GetData() { return this ? data : 0; } int IntListElem::Compare(ListElem* e) { IntListElem* ie = (IntListElem*) e; return (data < ie->data) ? -1 : ( (data == ie->data) ? 0 : 1 ); } int IntListElem::Compare(ListElemKey* k) { return (data < (intptr_t) k) ? -1 : ( (data == (intptr_t) k) ? 0 : 1 ); } ListElemKey* IntListElem::GetKey() { return (ListElemKey*) data; } void IntListElem::Print() { if (this) printf("%d ", data); }