#include <SortedArray.h>
Inheritance diagram for SortedArray< Elem >:

Public Member Functions | |
| SortedArray (void) | |
| SortedArray (int s) | |
| SortedArray (SortedArray< Elem > &sa) | |
| SortedArray (SortableResizeArray< Elem > &ra) | |
| SortedArray< Elem > & | operator= (SortedArray< Elem > &sa) |
| SortedArray< Elem > & | operator= (SortableResizeArray< Elem > &ra) |
| int | load (const Elem &elem) |
| int | add (const Elem &elem) |
| int | del (const Elem &elem) |
| void | sort (void) |
| int | bsearch (const Elem &elem) |
| int | insert (const Elem &elem) |
| int | index (const Elem &elem) |
| Elem * | find (const Elem &elem) |
| Elem * | find (void) |
Protected Attributes | |
| int | found |
| int | isSorted |
Definition at line 12 of file SortedArray.h.
|
||||||||||
|
Definition at line 21 of file SortedArray.h. 00021 : SortableResizeArray<Elem>() { 00022 found = -1; isSorted = 1; 00023 }
|
|
||||||||||
|
Definition at line 25 of file SortedArray.h. 00025 : SortableResizeArray<Elem>(s) { 00026 found = -1; isSorted = 1; 00027 }
|
|
||||||||||
|
Definition at line 29 of file SortedArray.h. 00029 : SortableResizeArray<Elem>(sa) { 00030 found = -1; if(!(isSorted = sa.isSorted)) sort(); 00031 isSorted = 1; 00032 }
|
|
||||||||||
|
Definition at line 34 of file SortedArray.h. 00034 : 00035 SortableResizeArray<Elem>(ra) { 00036 found = -1; sort(); isSorted = 1; 00037 }
|
|
||||||||||
|
Reimplemented from ResizeArray< Elem >. Reimplemented in UniqueSortedArray< Elem >, and UniqueSortedArray< PatchElem >. Definition at line 56 of file SortedArray.h. Referenced by Patch::registerDEdaSumDeposit(), Patch::registerForceDeposit(), Patch::registerPositionPickup(), and Patch::registerPsiSumDeposit(). 00056 {
00057 return(insert(elem));
00058 }
|
|
||||||||||
|
Definition at line 72 of file SortedArray.h. Referenced by SortedArray< PatchElem >::del(), SortedArray< Elem >::find(), SortedArray< PatchElem >::index(), UniqueSortedArray< Elem >::insert(), and SortedArray< Elem >::insert(). 00072 {
00073 if (!isSorted) sort();
00074 return (SortableResizeArray<Elem>::bsearch(elem));
00075 }
|
|
||||||||||
|
Definition at line 60 of file SortedArray.h. Referenced by GlobalMasterIMD::get_vmd_forces(), PatchMgr::sendMovePatches(), PatchMgr::sendOneHomePatch(), Patch::unregisterDEdaSumDeposit(), Patch::unregisterForceDeposit(), Patch::unregisterPositionPickup(), and Patch::unregisterPsiSumDeposit(). 00060 {
00061 found = bsearch(elem);
00062 if (this->size() != 0 && (*(this->rep))[found] == elem) {
00063 return(SortableResizeArray<Elem>::del(found,1));
00064 } else {
00065 found = -1;
00066 return(-1);
00067 }
00068 }
|
|
||||||||||
|
Definition at line 83 of file SortedArray.h. 00083 {
00084 if (found < 0 || ++found >= this->size()) {
00085 return((Elem *)NULL);
00086 }
00087 else if ((*(this->rep))[found] == (*(this->rep))[found-1]) {
00088 return (&(*(this->rep))[found]);
00089 } else {
00090 return ((Elem *)NULL);
00091 }
00092 }
|
|
||||||||||
|
Definition at line 109 of file SortedArray.h. References SortedArray< Elem >::bsearch(), and SortedArray< Elem >::found. Referenced by GlobalMasterIMD::get_vmd_forces(), PatchMgr::homePatch(), and PatchMgr::~PatchMgr(). 00109 {
00110 if ( (found = bsearch(elem)) < 0)
00111 return ((Elem *)NULL);
00112 if ((*(this->rep))[found] == elem) {
00113 return (&(*(this->rep))[found]);
00114 } else {
00115 found = -1;
00116 return ((Elem *)NULL);
00117 }
00118 }
|
|
||||||||||
|
Definition at line 79 of file SortedArray.h. Referenced by GlobalMasterIMD::calculate().
|
|
||||||||||
|
Reimplemented in UniqueSortedArray< Elem >, and UniqueSortedArray< PatchElem >. Definition at line 96 of file SortedArray.h. References SortedArray< Elem >::bsearch(), SortedArray< Elem >::found, ResizeArray< Elem >::insert(), and ResizeArray< Elem >::size(). Referenced by SortedArray< PatchElem >::add(). 00096 {
00097 found = bsearch(elem);
00098 if (found == -1) {
00099 return (ResizeArray<Elem>::insert(elem, 0));
00100 }
00101 if (found == (this->size()-1) && (*(this->rep))[found] < elem) {
00102 return (ResizeArray<Elem>::insert(elem, this->size()));
00103 } else {
00104 return (ResizeArray<Elem>::insert(elem, found));
00105 }
00106 }
|
|
||||||||||
|
Definition at line 51 of file SortedArray.h. Referenced by PatchMgr::createHomePatch(), PatchMgr::movePatch(), and PatchMgr::preCreateHomePatch(). 00051 {
00052 isSorted = 0;
00053 return(ResizeArray<Elem>::add(elem));
00054 }
|
|
||||||||||
|
Reimplemented from SortableResizeArray< Elem >. Definition at line 45 of file SortedArray.h. 00045 {
00046 SortableResizeArray<Elem>::operator=(ra);
00047 found = -1; sort(); isSorted = 1;
00048 return(*this);
00049 }
|
|
||||||||||
|
Reimplemented in UniqueSortedArray< Elem >, and UniqueSortedArray< PatchElem >. Definition at line 39 of file SortedArray.h. Referenced by UniqueSortedArray< PatchElem >::operator=(). 00039 {
00040 SortableResizeArray<Elem>::operator=(sa);
00041 found = -1; isSorted = sa.isSorted;
00042 return(*this);
00043 }
|
|
||||||||||
|
Reimplemented from SortableResizeArray< Elem >. Definition at line 70 of file SortedArray.h. Referenced by SortedArray< PatchElem >::bsearch(), SortedArray< PatchElem >::operator=(), and SortedArray< PatchElem >::SortedArray(). 00070 { SortableResizeArray<Elem>::sort(); isSorted = 1; }
|
|
|||||
|
Definition at line 16 of file SortedArray.h. Referenced by SortedArray< Elem >::find(), and SortedArray< Elem >::insert(). |
|
|||||
|
Definition at line 17 of file SortedArray.h. Referenced by SortedArray< PatchElem >::operator=(), and SortedArray< PatchElem >::SortedArray(). |
1.3.9.1