NAMD
Public Member Functions | List of all members
SortableResizeArray< Type > Class Template Reference

#include <ResizeArrayRaw.h>

Inheritance diagram for SortableResizeArray< Type >:
ResizeArray< Elem > SortedArray< Compute * > SortedArray< ComputeQMPntChrg > SortedArray< Elem > SortedArray< HomePatchElem > SortedArray< idIndxStr > SortedArray< int > SortedArray< LSSSubsDat > SortedArray< meMMQMGrp > SortedArray< MovePatch >

Public Member Functions

 SortableResizeArray (void)
 
 SortableResizeArray (int size)
 
 SortableResizeArray (ResizeArray< Elem > &ra)
 
 SortableResizeArray (SortableResizeArray< Elem > &ra)
 
 SortableResizeArray (const ResizeArray< Elem > *ra)
 
 SortableResizeArray (const SortableResizeArray< Elem > *ra)
 
 SortableResizeArray (Elem **const r, int numElem, int maxElem)
 
SortableResizeArray< Elem > & operator= (SortableResizeArray< Elem > &sa)
 
 ~SortableResizeArray (void)
 
void init (void)
 
void sort (void)
 
void sort (int bot, int top)
 
void uniq (void)
 
int bsearch (const Elem &elem) const
 
- Public Member Functions inherited from ResizeArray< Elem >
iterator begin (void)
 
iterator end (void)
 
const_iterator const_begin (void) const
 
const_iterator const_end (void) const
 
 ResizeArray (void)
 
 ResizeArray (int s)
 
 ResizeArray (Elem **array, int arraySize, int allocSize=0)
 
void copy (ResizeArray< Elem > &ra)
 
void swap (ResizeArray< Elem > &ra)
 
bool shared () const
 
 ~ResizeArray (void)
 
void resize (int i)
 
void clear ()
 
void setall (const Elem &elem)
 
int add (const Elem &elem)
 
void del (int index, int num=1)
 
int insert (const Elem &elem, int index)
 
Elem & item (int i)
 
Elem & operator[] (int index)
 
const Elem & operator[] (int index) const
 
int size (void) const
 
int find (const Elem &e) const
 

Additional Inherited Members

- Public Types inherited from ResizeArray< Elem >
typedef Elem * iterator
 
typedef const Elem * const_iterator
 
- Protected Attributes inherited from ResizeArray< Elem >
ResizeArrayRaw< Elem > rep
 

Detailed Description

template<class Type>
class SortableResizeArray< Type >

Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000 by The Board of Trustees of the University of Illinois. All rights reserved.

Definition at line 26 of file ResizeArrayRaw.h.

Constructor & Destructor Documentation

template<class Type>
SortableResizeArray< Type >::SortableResizeArray ( void  )
inline

Definition at line 49 of file SortableResizeArray.h.

template<class Type>
SortableResizeArray< Type >::SortableResizeArray ( int  size)
inline

Definition at line 51 of file SortableResizeArray.h.

template<class Type>
SortableResizeArray< Type >::SortableResizeArray ( ResizeArray< Elem > &  ra)
inline

Definition at line 53 of file SortableResizeArray.h.

template<class Type>
SortableResizeArray< Type >::SortableResizeArray ( SortableResizeArray< Elem > &  ra)
inline

Definition at line 56 of file SortableResizeArray.h.

template<class Type>
SortableResizeArray< Type >::SortableResizeArray ( const ResizeArray< Elem > *  ra)
inline

Definition at line 59 of file SortableResizeArray.h.

template<class Type>
SortableResizeArray< Type >::SortableResizeArray ( const SortableResizeArray< Elem > *  ra)
inline

Definition at line 62 of file SortableResizeArray.h.

template<class Type>
SortableResizeArray< Type >::SortableResizeArray ( Elem **const  r,
int  numElem,
int  maxElem 
)
inline

Definition at line 65 of file SortableResizeArray.h.

65  :
66  ResizeArray<Elem>(r,numElem,maxElem) { init(); }
template<class Type>
SortableResizeArray< Type >::~SortableResizeArray ( void  )
inline

Definition at line 73 of file SortableResizeArray.h.

73 { }

Member Function Documentation

template<class Type>
int SortableResizeArray< Type >::bsearch ( const Elem &  elem) const
inline

Definition at line 106 of file SortableResizeArray.h.

106  {
107  int test;
108  int bot = -1;
109  int top = this->size();
110  if (this->size() == 0) return (-1);
111  while (top - bot > 1) {
112  if ( this->rep.array[test = (bot+top)/2] < elem )
113  bot = test;
114  else
115  top = test;
116  }
117  return(top);
118  }
ResizeArrayRaw< Elem > rep
Definition: ResizeArray.h:31
int size(void) const
Definition: ResizeArray.h:127
template<class Type>
void SortableResizeArray< Type >::init ( void  )
inline

Definition at line 75 of file SortableResizeArray.h.

Referenced by SortableResizeArray< Elem >::SortableResizeArray().

75 { }
template<class Type>
SortableResizeArray<Elem>& SortableResizeArray< Type >::operator= ( SortableResizeArray< Elem > &  sa)
inline

Definition at line 68 of file SortableResizeArray.h.

Referenced by SortedArray< ComputeQMPntChrg >::operator=().

68  {
70  return(*this);
71  }
template<class Type>
void SortableResizeArray< Type >::sort ( void  )
inline
template<class Type>
void SortableResizeArray< Type >::sort ( int  bot,
int  top 
)
inline

Definition at line 82 of file SortableResizeArray.h.

82  {
83  int index, size;
84  if (top > this->rep.size()) top = this->rep.size();
85  size = top - bot + 1;
86 
87  // Make all sub-heaps
88  for ( index = size/2-1; index > 0; index-- )
89  siftup(bot, index, size);
90 
91  // Take top element of overall heap, and put on top
92  for ( index = size; index > 1; index-- ) {
93  siftup(bot, 0, index);
94  swap(bot, 0, index-1);
95  }
96  }
ResizeArrayRaw< Elem > rep
Definition: ResizeArray.h:31
void swap(Array< T > &s, Array< T > &t)
Definition: MsmMap.h:319
Index index
Definition: Parameters.C:148
int size(void) const
Definition: ResizeArray.h:127
template<class Type>
void SortableResizeArray< Type >::uniq ( void  )
inline

The documentation for this class was generated from the following files: