#include <UniqueSortedArray.h>
Public Member Functions | |
UniqueSortedArray (int s=0) | |
UniqueSortedArray (UniqueSortedArray< Elem > &ua) | |
UniqueSortedArray (SortedArray< Elem > &sa) | |
UniqueSortedArray< Elem > & | operator= (UniqueSortedArray< Elem > &ua) |
UniqueSortedArray< Elem > & | operator= (SortedArray< Elem > &sa) |
int | add (const Elem &elem) |
int | insert (const Elem &elem) |
Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000 by The Board of Trustees of the University of Illinois. All rights reserved.
Definition at line 12 of file UniqueSortedArray.h.
UniqueSortedArray< Elem >::UniqueSortedArray | ( | int | s = 0 |
) | [inline] |
Definition at line 16 of file UniqueSortedArray.h.
00016 : SortedArray<Elem>(s) { }
UniqueSortedArray< Elem >::UniqueSortedArray | ( | UniqueSortedArray< Elem > & | ua | ) | [inline] |
Definition at line 18 of file UniqueSortedArray.h.
00018 : 00019 SortedArray<Elem>(ua) { }
UniqueSortedArray< Elem >::UniqueSortedArray | ( | SortedArray< Elem > & | sa | ) | [inline] |
Definition at line 21 of file UniqueSortedArray.h.
00021 : SortedArray<Elem>(sa) { 00022 this->uniq(); 00023 }
int UniqueSortedArray< Elem >::add | ( | const Elem & | elem | ) | [inline] |
Reimplemented from SortedArray< Elem >.
Definition at line 50 of file UniqueSortedArray.h.
Referenced by GlobalMasterIMD::get_vmd_forces(), and ComputeHomePatches::initialize().
00050 { return(insert(elem)); }
int UniqueSortedArray< Elem >::insert | ( | const Elem & | elem | ) | [inline] |
Reimplemented from SortedArray< Elem >.
Definition at line 58 of file UniqueSortedArray.h.
References SortedArray< Elem >::bsearch(), ResizeArray< Elem >::rep, and ResizeArray< Elem >::size().
Referenced by UniqueSortedArray< PatchElem >::add().
00058 { 00059 int found = this->bsearch(elem); 00060 if (found == -1) { 00061 return ResizeArray<Elem>::insert(elem, 0); 00062 } 00063 if (found < this->size() && this->rep[found] == elem) { 00064 return -2; 00065 } 00066 if (found == (this->size()-1) && this->rep[found] < elem) { 00067 return ResizeArray<Elem>::insert(elem, this->size()); 00068 } else { 00069 return ResizeArray<Elem>::insert(elem, found); 00070 } 00071 }
UniqueSortedArray<Elem>& UniqueSortedArray< Elem >::operator= | ( | SortedArray< Elem > & | sa | ) | [inline] |
Definition at line 36 of file UniqueSortedArray.h.
00036 { 00037 SortedArray<Elem>::operator=(sa); 00038 this->uniq(); 00039 return(*this); 00040 }
UniqueSortedArray<Elem>& UniqueSortedArray< Elem >::operator= | ( | UniqueSortedArray< Elem > & | ua | ) | [inline] |
Reimplemented from SortedArray< Elem >.
Definition at line 31 of file UniqueSortedArray.h.
Referenced by UniqueSortedArray< PatchElem >::operator=().
00031 { 00032 SortedArray<Elem>::operator=(ua); 00033 return(*this); 00034 }