UniqueSortedArray< Elem > Class Template Reference

#include <UniqueSortedArray.h>

Inheritance diagram for UniqueSortedArray< Elem >:

SortedArray< Elem > SortableResizeArray< Elem > ResizeArray< Elem > List of all members.

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)

Detailed Description

template<class Elem>
class UniqueSortedArray< 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.


Constructor & Destructor Documentation

template<class Elem>
UniqueSortedArray< Elem >::UniqueSortedArray ( int  s = 0  )  [inline]

Definition at line 16 of file UniqueSortedArray.h.

00016 : SortedArray<Elem>(s) { }

template<class Elem>
UniqueSortedArray< Elem >::UniqueSortedArray ( UniqueSortedArray< Elem > &  ua  )  [inline]

Definition at line 18 of file UniqueSortedArray.h.

00018                                                    : 
00019       SortedArray<Elem>(ua) { }

template<class Elem>
UniqueSortedArray< Elem >::UniqueSortedArray ( SortedArray< Elem > &  sa  )  [inline]

Definition at line 21 of file UniqueSortedArray.h.

References SortableResizeArray< Elem >::uniq().

00021                                              : SortedArray<Elem>(sa) { 
00022       this->uniq(); 
00023     }


Member Function Documentation

template<class Elem>
int UniqueSortedArray< Elem >::add ( const Elem &  elem  )  [inline]

Reimplemented from SortedArray< Elem >.

Definition at line 50 of file UniqueSortedArray.h.

References UniqueSortedArray< Elem >::insert().

Referenced by ComputeHomePatches::initialize().

00050 { return(insert(elem)); }

template<class 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 >::insert(), and ResizeArray< Elem >::size().

Referenced by UniqueSortedArray< Elem >::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 }

template<class Elem>
UniqueSortedArray<Elem>& UniqueSortedArray< Elem >::operator= ( SortedArray< Elem > &  sa  )  [inline]

Reimplemented from SortedArray< Elem >.

Definition at line 36 of file UniqueSortedArray.h.

References SortedArray< Elem >::operator=(), and SortableResizeArray< Elem >::uniq().

00036                                                                {
00037       SortedArray<Elem>::operator=(sa);
00038       this->uniq();
00039       return(*this);
00040     }

template<class Elem>
UniqueSortedArray<Elem>& UniqueSortedArray< Elem >::operator= ( UniqueSortedArray< Elem > &  ua  )  [inline]

Definition at line 31 of file UniqueSortedArray.h.

References SortedArray< Elem >::operator=().

00031                                                                       {
00032       SortedArray<Elem>::operator=(ua);
00033       return(*this);
00034     }


The documentation for this class was generated from the following file:
Generated on Tue Nov 21 01:17:21 2017 for NAMD by  doxygen 1.4.7