\section{Int\-Priority\-Queue  Class Template Reference}
\label{class_IntPriorityQueue}\index{IntPriorityQueue@{Int\-Priority\-Queue}}
{\tt \#include $<$ipqueue.h$>$}

\subsection*{Public Methods}
\begin{CompactItemize}
\item 
int {\bf Copy} (const Int\-Priority\-Queue$<$ PT $>$ \&ipq)
\item 
{\bf Int\-Priority\-Queue} (int maxsize={\bf IPQDEFLEN}, int rev=0)
\item 
{\bf Int\-Priority\-Queue} (const Int\-Priority\-Queue$<$ PT $>$ \&ipq)
\item 
{\bf $\sim$Int\-Priority\-Queue} ()
\item 
void {\bf Build} ()
\item 
int {\bf Is\-Empty} () const
\item 
{\bf operator int} () const
\item 
int {\bf Is\-Full} () const
\item 
int {\bf Size} () const
\item 
int {\bf Number} () const
\item 
int {\bf Is\-Bad} () const
\item 
int {\bf Bad\-Id} (int id) const
\item 
int {\bf In} (int id) const
\item 
void {\bf Clear} ()
\item 
int {\bf Add} (int id, const PT \&priority)
\item 
PT {\bf Peek} (int id) const
\item 
int {\bf Change\-Id} (int oldid, int newid)
\item 
void {\bf Modify} (int id, const PT \&newpriority)
\item 
void {\bf Rel\-Modify} (int id, const PT \&del)
\item 
int {\bf Extreme} () const
\item 
int {\bf Remove} (int \&id, PT \&priority)
\item 
const Int\-Priority\-Queue$<$PT$>$\& {\bf operator=} (const Int\-Priority\-Queue$<$ PT $>$ \&ipq)
\item 
const PT\& {\bf Get\-Priority} (int id) const
\item 
const PT\& {\bf operator[$\,$]} (int id) const
\item 
ostream\& {\bf Print\-Top} (ostream \&os, {\bf uint} n) const
\end{CompactItemize}
\subsection*{Private Methods}
\begin{CompactItemize}
\item 
{\bf uint} {\bf Parent} ({\bf uint} i) const
\item 
{\bf uint} {\bf Left} ({\bf uint} i) const
\item 
{\bf uint} {\bf Right} ({\bf uint} i) const
\item 
void {\bf Swap} ({\bf uint} i, {\bf uint} j)
\item 
int {\bf Fix\-Dir} ({\bf uint} i) const
\item 
void {\bf Heapify} ({\bf uint} i, {\bf uint} len)
\item 
void {\bf Bubble\-Up} ({\bf uint} i)
\end{CompactItemize}
\subsection*{Private Attributes}
\begin{CompactItemize}
\item 
int {\bf Rev}
\item 
{\bf uint} {\bf M}
\item 
{\bf uint} {\bf N}
\item 
int$\ast$ {\bf Index}
\item 
int$\ast$ {\bf Id}
\item 
PT$\ast$ {\bf Pri}
\item 
int {\bf built}
\end{CompactItemize}
\subsection*{Friends}
\begin{CompactItemize}
\item 
ostream\& {\bf operator} (ostream \&os, const Int\-Priority\-Queue$<$ PT $>$ \&Q)
\end{CompactItemize}
\subsubsection*{template$<$class PT = double$>$  class Int\-Priority\-Queue}



\subsection{Constructor \& Destructor Documentation}
\index{IntPriorityQueue@{Int\-Priority\-Queue}!IntPriorityQueue@{IntPriorityQueue}}
\index{IntPriorityQueue@{IntPriorityQueue}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT$>$ Int\-Priority\-Queue$<$ PT $>$::Int\-Priority\-Queue$<$PT$>$ (int {\em maxsize} = {\bf IPQDEFLEN}, int {\em rev} = 0)\hspace{0.3cm}{\tt  [inline]}}\label{class_IntPriorityQueue_a1}




Definition at line 196 of file ipqueue.inc.\footnotesize\begin{verbatim}00197   {
00198     M      = 0;
00199     N      = 0;
00200     Rev    = rev;
00201     built  = 0;
00202 
00203     Pri   = 0;
00204     Index = 0;
00205     Id    = 0;
00206 
00207     maxsize = (maxsize < 1) ? IPQDEFLEN : maxsize;
00208 
00209     if(!(Pri = new PT[maxsize+1]) || 
00210        !(Id  = new int[maxsize+1]) || 
00211        !(Index = new int[maxsize+1]))
00212       {
00213         delete[] Index; Index = 0;
00214         delete[] Id;    Id    = 0;
00215         delete[] Pri;     Pri     = 0;
00216         raise(SIGQUIT);
00217       }
00218 \end{verbatim}\normalsize 
\index{IntPriorityQueue@{Int\-Priority\-Queue}!IntPriorityQueue@{IntPriorityQueue}}
\index{IntPriorityQueue@{IntPriorityQueue}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT$>$ Int\-Priority\-Queue$<$ PT $>$::Int\-Priority\-Queue$<$PT$>$ (const Int\-Priority\-Queue$<$ PT $>$ \& {\em ipq})\hspace{0.3cm}{\tt  [inline]}}\label{class_IntPriorityQueue_a2}




Definition at line 183 of file ipqueue.inc.\footnotesize\begin{verbatim}00184   {
00185     M     = 0;
00186     N     = 0;
00187     Rev   = 0;
00188     built = 0;
00189     Pri   = 0;
00190     Index = 0;
00191     Id    = 0;
00192     Copy(ipq);
00193 \end{verbatim}\normalsize 
\index{IntPriorityQueue@{Int\-Priority\-Queue}!~IntPriorityQueue@{$\sim$IntPriorityQueue}}
\index{~IntPriorityQueue@{$\sim$IntPriorityQueue}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT$>$ Int\-Priority\-Queue$<$ PT $>$::$\sim$Int\-Priority\-Queue$<$PT$>$ ()\hspace{0.3cm}{\tt  [inline]}}\label{class_IntPriorityQueue_a3}




Definition at line 223 of file ipqueue.inc.\footnotesize\begin{verbatim}00224   { delete[] Pri; Pri = 0; delete[] Id; Id=0; delete[] Index; Index = 0; }
00225 \end{verbatim}\normalsize 


\subsection{Member Function Documentation}
\index{IntPriorityQueue@{Int\-Priority\-Queue}!Add@{Add}}
\index{Add@{Add}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT$>$ int Int\-Priority\-Queue$<$ PT $>$::Add (int {\em id}, const PT \& {\em priority})\hspace{0.3cm}{\tt  [inline]}}\label{class_IntPriorityQueue_a14}




Definition at line 252 of file ipqueue.inc.

Referenced by sd\-Graph::Dijkstra().\footnotesize\begin{verbatim}00253   {
00254     int i;
00255 
00256     // See if the queue's full:
00257     // See if the id's ok:
00258     //
00259     if(IsBad() || BadId(id)) raise(SIGQUIT);
00260     if(IsFull() || In(id)) return 0;
00261 
00262     // If the heap has not been built yet, we can just stupidly copy the
00263     // new element into the last spot available in the array.
00264     if(!built)
00265       {
00266         Pri[N+1]      = priority;
00267         Index[id]   = N+1;
00268         Id[N+1]     = id;
00269         // ++N;
00270       }
00271 
00272     // Otherwise, we need to insert the new element and maintain the heap
00273     // structure of the array.
00274     else
00275       {
00276         i = N+1;
00277         if(!Rev)
00278           {
00279             while(i>1 && (Pri[Parent(i)] < priority))
00280               {
00281                 if(BadId(i) || BadId(Parent(i))) raise(SIGQUIT);
00282                 Pri[i] = Pri[Parent(i)];
00283                 Id[i] = Id[Parent(i)];
00284                 Index[Id[i]] = i;
00285                 i = Parent(i);
00286               }
00287           }
00288         else
00289           {
00290             while(i>1 && (Pri[Parent(i)] > priority))
00291               {
00292                 if(BadId(i) || BadId(Parent(i))) raise(SIGQUIT);
00293                 Pri[i] = Pri[Parent(i)];
00294                 Id[i] = Id[Parent(i)];
00295                 Index[Id[i]] = i;
00296                 i = Parent(i);
00297               }
00298           }
00299         Pri[i]      = priority;
00300         Id[i]     = id;
00301         Index[id] = i;
00302         //
00303 
00304         /*
00305         ++N;
00306         Pri[N]    = priority;
00307         Id[N]     = id;
00308         Index[id] = N;
00309         BubbleUp(N);
00310         */
00311       }
00312 \end{verbatim}\normalsize 
\index{IntPriorityQueue@{Int\-Priority\-Queue}!BadId@{BadId}}
\index{BadId@{BadId}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT$>$ int Int\-Priority\-Queue$<$ PT $>$::Bad\-Id (int {\em id}) const\hspace{0.3cm}{\tt  [inline]}}\label{class_IntPriorityQueue_a11}




Definition at line 19 of file ipqueue.inc.

Referenced by Add(), Bubble\-Up(), Change\-Id(), Get\-Priority(), In(), Modify(), Peek(), and Rel\-Modify().\footnotesize\begin{verbatim}00020   { return (id<0 || id > (int) M); }
00021 \end{verbatim}\normalsize 
\index{IntPriorityQueue@{Int\-Priority\-Queue}!BubbleUp@{BubbleUp}}
\index{BubbleUp@{BubbleUp}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT$>$ void Int\-Priority\-Queue$<$ PT $>$::Bubble\-Up ({\bf uint} {\em i})\hspace{0.3cm}{\tt  [inline, private]}}\label{class_IntPriorityQueue_c6}




Definition at line 84 of file ipqueue.inc.

Referenced by Modify().\footnotesize\begin{verbatim}00085   {
00086     // if(BadId(i)) raise(SIGQUIT);
00087 
00088     if(!Rev)
00089       {
00090         while(i>1 && (Pri[i] > Pri[Parent(i)]))
00091           {
00092             if(BadId(i) || BadId(Parent(i)))
00093                 raise(SIGQUIT);
00094             Swap(i,Parent(i));
00095             i = Parent(i);
00096           }
00097       }
00098     else
00099       {
00100         while(i>1 && (Pri[i] < Pri[Parent(i)]))
00101           {
00102             if(BadId(i) || BadId(Parent(i)))
00103                 raise(SIGQUIT);
00104             Swap(i,Parent(i));
00105             i = Parent(i);
00106           }
00107       }
00108 \end{verbatim}\normalsize 
\index{IntPriorityQueue@{Int\-Priority\-Queue}!Build@{Build}}
\index{Build@{Build}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT$>$ void Int\-Priority\-Queue$<$ PT $>$::Build ()\hspace{0.3cm}{\tt  [inline]}}\label{class_IntPriorityQueue_a4}




Definition at line 111 of file ipqueue.inc.

Referenced by Remove().\footnotesize\begin{verbatim}00112   { 
00113     if(built) return;
00114     if(N>1)
00115         for(uint i = N>>1; i>=1; --i) 
00116             Heapify(i,N); 
00117     built=1; 
00118 \end{verbatim}\normalsize 
\index{IntPriorityQueue@{Int\-Priority\-Queue}!ChangeId@{ChangeId}}
\index{ChangeId@{ChangeId}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT$>$ int Int\-Priority\-Queue$<$ PT $>$::Change\-Id (int {\em oldid}, int {\em newid})\hspace{0.3cm}{\tt  [inline]}}\label{class_IntPriorityQueue_a16}




Definition at line 352 of file ipqueue.inc.\footnotesize\begin{verbatim}00353   {
00354     if(IsBad() || BadId(oldid) || BadId(newid)) raise(SIGQUIT);
00355 
00356     if(oldid == newid) return 1;
00357     if(!In(oldid) || In(newid))
00358         return 0;
00359 
00360     int ndx = Index[oldid];
00361     Index[oldid]  = -1;
00362     Index[newid]  = ndx;
00363     Id[ndx] = newid;
00364     return 1;
00365 \end{verbatim}\normalsize 
\index{IntPriorityQueue@{Int\-Priority\-Queue}!Clear@{Clear}}
\index{Clear@{Clear}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT$>$ void Int\-Priority\-Queue$<$ PT $>$::Clear ()\hspace{0.3cm}{\tt  [inline]}}\label{class_IntPriorityQueue_a13}




Definition at line 121 of file ipqueue.inc.

Referenced by Int\-Priority\-Queue().\footnotesize\begin{verbatim}00122   {
00123     for(uint i=0; i<=M; ++i)
00124       {
00125         Index[i]  = -1;
00126         Id[i]     = -1;
00127         Pri[i]    = Rev ? INF : -INF;
00128       }
00129 \end{verbatim}\normalsize 
\index{IntPriorityQueue@{Int\-Priority\-Queue}!Copy@{Copy}}
\index{Copy@{Copy}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT$>$ int Int\-Priority\-Queue$<$ PT $>$::Copy (const Int\-Priority\-Queue$<$ PT $>$ \& {\em ipq})\hspace{0.3cm}{\tt  [inline]}}\label{class_IntPriorityQueue_a0}




Definition at line 134 of file ipqueue.inc.

Referenced by Int\-Priority\-Queue().\footnotesize\begin{verbatim}00135   {
00136     if(this == &ipq) return 1;
00137 
00138     PT * tmpPri = Pri;
00139     int * tmpIndex  = Index;
00140     int * tmpId     = Id;
00141     if(ipq.M==0)
00142       {
00143         delete[] Pri;   Pri   = 0;
00144         delete[] Index; Index = 0;
00145         delete[] Id;    Id    = 0;
00146         N = M = 0;
00147         return 1;
00148       }
00149     if(M != ipq.M)
00150       {
00151         if(!(Pri   = new PT[ipq.M+1]) ||
00152            !(Index = new int[ipq.M+1])    ||
00153            !(Id    = new int[ipq.M+1]))
00154           {
00155             delete[] Pri;   Pri   = tmpPri;
00156             delete[] Index; Index = tmpIndex;
00157             delete[] Id;    Id    = tmpId;
00158             return 0;
00159           }
00160         delete[] tmpPri;
00161         delete[] tmpIndex;
00162         delete[] tmpId;
00163         M = ipq.M;
00164       }
00165     N = ipq.N;
00166     Rev = ipq.Rev;
00167     built = ipq.built;
00168     for(uint i=0; i<=M; ++i)
00169       {
00170         Pri[i]   = ipq.Pri[i];
00171         Index[i] = ipq.Index[i];
00172         Id[i]    = ipq.Id[i];
00173       }
00174 \end{verbatim}\normalsize 
\index{IntPriorityQueue@{Int\-Priority\-Queue}!Extreme@{Extreme}}
\index{Extreme@{Extreme}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT$>$ int Int\-Priority\-Queue$<$ PT $>$::Extreme () const\hspace{0.3cm}{\tt  [inline]}}\label{class_IntPriorityQueue_a19}




Definition at line 400 of file ipqueue.inc.\footnotesize\begin{verbatim}00401   { 
00402     if(IsBad() || N<1)
00403         return -1;
00404     return Id[1]; 
00405 \end{verbatim}\normalsize 
\index{IntPriorityQueue@{Int\-Priority\-Queue}!FixDir@{FixDir}}
\index{FixDir@{FixDir}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT$>$ int Int\-Priority\-Queue$<$ PT $>$::Fix\-Dir ({\bf uint} {\em i}) const\hspace{0.3cm}{\tt  [inline, private]}}\label{class_IntPriorityQueue_c4}




Definition at line 317 of file ipqueue.inc.

Referenced by Modify().\footnotesize\begin{verbatim}00318   {
00319     uint l=Left(i), r=Right(i);
00320     if(!Rev)
00321       {
00322         if(i>1 && Pri[i] > Pri[Parent(i)]) return 1;
00323         else
00324           {
00325             if((l<=N) && (Pri[i] < Pri[l]) ||
00326                (r<=N) && (Pri[i] < Pri[r])) 
00327                  return -1;
00328           }
00329       }
00330     else
00331       {
00332         if(i>1 && Pri[i] < Pri[Parent(i)]) return 1;
00333         else
00334           {
00335             if((l<=N) && (Pri[i] > Pri[l]) ||
00336                (r<=N) && (Pri[i] > Pri[r])) 
00337                  return -1;
00338           }
00339       }
00340 \end{verbatim}\normalsize 
\index{IntPriorityQueue@{Int\-Priority\-Queue}!GetPriority@{GetPriority}}
\index{GetPriority@{GetPriority}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT$>$ const PT \& Int\-Priority\-Queue$<$ PT $>$::Get\-Priority (int {\em id}) const\hspace{0.3cm}{\tt  [inline]}}\label{class_IntPriorityQueue_a22}




Definition at line 442 of file ipqueue.inc.

Referenced by operator[$\,$]().\footnotesize\begin{verbatim}00443   {
00444     if(IsBad() || BadId(id)) raise(SIGQUIT);
00445     return Pri[Index[id]];
00446 \end{verbatim}\normalsize 
\index{IntPriorityQueue@{Int\-Priority\-Queue}!Heapify@{Heapify}}
\index{Heapify@{Heapify}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT$>$ void Int\-Priority\-Queue$<$ PT $>$::Heapify ({\bf uint} {\em i}, {\bf uint} {\em len})\hspace{0.3cm}{\tt  [inline, private]}}\label{class_IntPriorityQueue_c5}




Definition at line 42 of file ipqueue.inc.

Referenced by Build(), Modify(), and Remove().\footnotesize\begin{verbatim}00043   {
00044     uint l = Left(i), r = Right(i), extreme;
00045 
00046     // if(BadId(i) || len>N) 
00047     //  raise(SIGQUIT);
00048 
00049     if(!Rev)
00050       {
00051         if((l<=len) && (Pri[l] > Pri[i]))
00052           extreme = l;
00053         else
00054           extreme = i;
00055     
00056         if((r<=len) && (Pri[r]>Pri[extreme]))
00057           extreme = r;
00058     
00059         if(extreme != i)
00060           {
00061             Swap(i,extreme);
00062             Heapify(extreme, len);
00063           }
00064       }
00065     else
00066       {
00067         if((l<=len) && (Pri[l] < Pri[i]))
00068           extreme = l;
00069         else
00070           extreme = i;
00071     
00072         if((r<=len) && (Pri[r]<Pri[extreme]))
00073           extreme = r;
00074     
00075         if(extreme != i)
00076           {
00077             Swap(i,extreme);
00078             Heapify(extreme, len);
00079           }
00080       }
00081 \end{verbatim}\normalsize 
\index{IntPriorityQueue@{Int\-Priority\-Queue}!In@{In}}
\index{In@{In}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT$>$ int Int\-Priority\-Queue$<$ PT $>$::In (int {\em id}) const\hspace{0.3cm}{\tt  [inline]}}\label{class_IntPriorityQueue_a12}




Definition at line 248 of file ipqueue.inc.

Referenced by Add(), Change\-Id(), Modify(), Peek(), and Rel\-Modify().\footnotesize\begin{verbatim}00249   { return (BadId(id) ? 0 : (Index[id] != -1)); }
00250 \end{verbatim}\normalsize 
\index{IntPriorityQueue@{Int\-Priority\-Queue}!IsBad@{IsBad}}
\index{IsBad@{IsBad}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT$>$ int Int\-Priority\-Queue$<$ PT $>$::Is\-Bad () const\hspace{0.3cm}{\tt  [inline]}}\label{class_IntPriorityQueue_a10}




Definition at line 14 of file ipqueue.inc.

Referenced by Add(), Change\-Id(), Extreme(), Get\-Priority(), Modify(), Peek(), Print\-Top(), Rel\-Modify(), and Remove().\footnotesize\begin{verbatim}00015      { return 0; }
00016 \end{verbatim}\normalsize 
\index{IntPriorityQueue@{Int\-Priority\-Queue}!IsEmpty@{IsEmpty}}
\index{IsEmpty@{IsEmpty}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT$>$ int Int\-Priority\-Queue$<$ PT $>$::Is\-Empty () const\hspace{0.3cm}{\tt  [inline]}}\label{class_IntPriorityQueue_a5}




Definition at line 228 of file ipqueue.inc.

Referenced by sd\-Graph::Dijkstra().\footnotesize\begin{verbatim}00229   { return N==0; }
00230 \end{verbatim}\normalsize 
\index{IntPriorityQueue@{Int\-Priority\-Queue}!IsFull@{IsFull}}
\index{IsFull@{IsFull}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT$>$ int Int\-Priority\-Queue$<$ PT $>$::Is\-Full () const\hspace{0.3cm}{\tt  [inline]}}\label{class_IntPriorityQueue_a7}




Definition at line 236 of file ipqueue.inc.

Referenced by Add().\footnotesize\begin{verbatim}00237   { return N==M; }
00238 \end{verbatim}\normalsize 
\index{IntPriorityQueue@{Int\-Priority\-Queue}!Left@{Left}}
\index{Left@{Left}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT$>$ {\bf uint} Int\-Priority\-Queue$<$ PT $>$::Left ({\bf uint} {\em i}) const\hspace{0.3cm}{\tt  [inline, private]}}\label{class_IntPriorityQueue_c1}




Definition at line 6 of file ipqueue.inc.

Referenced by Fix\-Dir(), and Heapify().\footnotesize\begin{verbatim}00007   { return (i << 1); }
00008 \end{verbatim}\normalsize 
\index{IntPriorityQueue@{Int\-Priority\-Queue}!Modify@{Modify}}
\index{Modify@{Modify}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT$>$ void Int\-Priority\-Queue$<$ PT $>$::Modify (int {\em id}, const PT \& {\em newpriority})\hspace{0.3cm}{\tt  [inline]}}\label{class_IntPriorityQueue_a17}




Definition at line 368 of file ipqueue.inc.

Referenced by sd\-Graph::Dijkstra(), and Rel\-Modify().\footnotesize\begin{verbatim}00369   {
00370     if(IsBad() || BadId(id)) raise(SIGQUIT);
00371     if(!In(id)) return;
00372 
00373     uint ndx = Index[id];
00374     int dir;
00375 
00376     if(ndx>N) raise(SIGQUIT);
00377 
00378     Pri[ndx] = newpriority;
00379 
00380     if(built)
00381       {
00382         if((dir = FixDir(ndx)) == -1)   // Modify downward
00383             Heapify(ndx,N);
00384         else if(dir == 1)               // Modify upward
00385             BubbleUp(ndx);
00386       }
00387 \end{verbatim}\normalsize 
\index{IntPriorityQueue@{Int\-Priority\-Queue}!Number@{Number}}
\index{Number@{Number}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT$>$ int Int\-Priority\-Queue$<$ PT $>$::Number () const\hspace{0.3cm}{\tt  [inline]}}\label{class_IntPriorityQueue_a9}




Definition at line 244 of file ipqueue.inc.\footnotesize\begin{verbatim}00245   { return (int) N; }
00246 \end{verbatim}\normalsize 
\index{IntPriorityQueue@{Int\-Priority\-Queue}!Parent@{Parent}}
\index{Parent@{Parent}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT$>$ {\bf uint} Int\-Priority\-Queue$<$ PT $>$::Parent ({\bf uint} {\em i}) const\hspace{0.3cm}{\tt  [inline, private]}}\label{class_IntPriorityQueue_c0}




Definition at line 2 of file ipqueue.inc.

Referenced by Add(), Bubble\-Up(), and Fix\-Dir().\footnotesize\begin{verbatim}00003   { return (i >> 1); }
00004 \end{verbatim}\normalsize 
\index{IntPriorityQueue@{Int\-Priority\-Queue}!Peek@{Peek}}
\index{Peek@{Peek}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT$>$ PT Int\-Priority\-Queue$<$ PT $>$::Peek (int {\em id}) const\hspace{0.3cm}{\tt  [inline]}}\label{class_IntPriorityQueue_a15}




Definition at line 344 of file ipqueue.inc.\footnotesize\begin{verbatim}00345   {
00346     if(IsBad() || BadId(id)) raise(SIGQUIT);
00347     if(!In(id)) return -1.0;
00348     return Pri[ Index[id] ];
00349 \end{verbatim}\normalsize 
\index{IntPriorityQueue@{Int\-Priority\-Queue}!PrintTop@{PrintTop}}
\index{PrintTop@{PrintTop}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT$>$ ostream \& Int\-Priority\-Queue$<$ PT $>$::Print\-Top (ostream \& {\em os}, {\bf uint} {\em n}) const\hspace{0.3cm}{\tt  [inline]}}\label{class_IntPriorityQueue_a24}




Definition at line 466 of file ipqueue.inc.\footnotesize\begin{verbatim}00467   {
00468     if(IsBad())
00469       {
00470         os << "<<BADIPQUEUE>>";
00471         return os;
00472       }
00473 
00474     n = (n>N) ? N : n;
00475     for(uint i=1; i<=n; ++i)
00476       {
00477         os << Id[i];
00478         if(i!=n) os << ' ';
00479       }
00480 \end{verbatim}\normalsize 
\index{IntPriorityQueue@{Int\-Priority\-Queue}!RelModify@{RelModify}}
\index{RelModify@{RelModify}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT$>$ void Int\-Priority\-Queue$<$ PT $>$::Rel\-Modify (int {\em id}, const PT \& {\em del})\hspace{0.3cm}{\tt  [inline]}}\label{class_IntPriorityQueue_a18}




Definition at line 390 of file ipqueue.inc.\footnotesize\begin{verbatim}00391   {
00392     if(IsBad() || BadId(id)) raise(SIGQUIT);
00393     if(!In(id)) return;
00394     uint ndx = Index[id];
00395     if(ndx>N) raise(SIGQUIT);
00396     Modify(id, Pri[ndx]+del);
00397 \end{verbatim}\normalsize 
\index{IntPriorityQueue@{Int\-Priority\-Queue}!Remove@{Remove}}
\index{Remove@{Remove}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT$>$ int Int\-Priority\-Queue$<$ PT $>$::Remove (int \& {\em id}, PT \& {\em priority})\hspace{0.3cm}{\tt  [inline]}}\label{class_IntPriorityQueue_a20}




Definition at line 408 of file ipqueue.inc.

Referenced by sd\-Graph::Dijkstra().\footnotesize\begin{verbatim}00409   {
00410     if(IsBad() || N==0) 
00411       {
00412         priority = Rev ? INF : -INF;
00413         id = -1;
00414         return 0;
00415       }
00416 
00417     if(!built) Build();
00418 
00419     priority = Pri[1];
00420     id       = Id[1];
00421     if(N == 1)
00422       {
00423         Pri[1] = Rev ? INF : -INF;
00424         Id[1]  = -1;
00425         Index[id] = -1;
00426         N = 0;
00427         return 1;
00428       }
00429 \end{verbatim}\normalsize 
\index{IntPriorityQueue@{Int\-Priority\-Queue}!Right@{Right}}
\index{Right@{Right}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT$>$ {\bf uint} Int\-Priority\-Queue$<$ PT $>$::Right ({\bf uint} {\em i}) const\hspace{0.3cm}{\tt  [inline, private]}}\label{class_IntPriorityQueue_c2}




Definition at line 10 of file ipqueue.inc.

Referenced by Fix\-Dir(), and Heapify().\footnotesize\begin{verbatim}00011   { return ((i << 1) | ((uint) 1)); }
00012 \end{verbatim}\normalsize 
\index{IntPriorityQueue@{Int\-Priority\-Queue}!Size@{Size}}
\index{Size@{Size}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT$>$ int Int\-Priority\-Queue$<$ PT $>$::Size () const\hspace{0.3cm}{\tt  [inline]}}\label{class_IntPriorityQueue_a8}




Definition at line 240 of file ipqueue.inc.\footnotesize\begin{verbatim}00241   { return (int) M; }
00242 \end{verbatim}\normalsize 
\index{IntPriorityQueue@{Int\-Priority\-Queue}!Swap@{Swap}}
\index{Swap@{Swap}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT$>$ void Int\-Priority\-Queue$<$ PT $>$::Swap ({\bf uint} {\em i}, {\bf uint} {\em j})\hspace{0.3cm}{\tt  [private]}}\label{class_IntPriorityQueue_c3}




Definition at line 23 of file ipqueue.inc.

Referenced by Bubble\-Up(), and Heapify().\footnotesize\begin{verbatim}00024   {
00025     // if(IsBad() || BadId(i) || BadId(j) || i>N || j>N) raise(SIGQUIT);
00026     if(i==j) return;
00027 
00028     PT d = Pri[i];
00029     Pri[i]   = Pri[j];
00030     Pri[j]   = d;
00031 
00032     int k        = Index[Id[i]];
00033     Index[Id[i]] = Index[Id[j]];
00034     Index[Id[j]] = k;
00035 
00036     k     = Id[i];
00037     Id[i] = Id[j];
00038     Id[j] = k;
00039 \end{verbatim}\normalsize 
\index{IntPriorityQueue@{Int\-Priority\-Queue}!operator int@{operator int}}
\index{operator int@{operator int}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT$>$ Int\-Priority\-Queue$<$ PT $>$::operator int () const\hspace{0.3cm}{\tt  [inline]}}\label{class_IntPriorityQueue_a6}




Definition at line 232 of file ipqueue.inc.\footnotesize\begin{verbatim}00233   { return N>0; }
00234 \end{verbatim}\normalsize 
\index{IntPriorityQueue@{Int\-Priority\-Queue}!operator=@{operator=}}
\index{operator=@{operator=}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT$>$ const Int\-Priority\-Queue$<$ PT $>$ \& Int\-Priority\-Queue$<$ PT $>$::operator= (const Int\-Priority\-Queue$<$ PT $>$ \& {\em ipq})\hspace{0.3cm}{\tt  [inline]}}\label{class_IntPriorityQueue_a21}




Definition at line 179 of file ipqueue.inc.\footnotesize\begin{verbatim}00180   { Copy(ipq); return *this; }
00181 \end{verbatim}\normalsize 
\index{IntPriorityQueue@{Int\-Priority\-Queue}!operator[]@{operator[]}}
\index{operator[]@{operator[]}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT$>$ const PT \& Int\-Priority\-Queue$<$ PT $>$::operator[$\,$] (int {\em id}) const\hspace{0.3cm}{\tt  [inline]}}\label{class_IntPriorityQueue_a23}




Definition at line 449 of file ipqueue.inc.\footnotesize\begin{verbatim}00450   { return GetPriority(id); }
00451 \end{verbatim}\normalsize 


\subsection{Friends And Related Function Documentation}
\index{IntPriorityQueue@{Int\-Priority\-Queue}!operator@{operator}}
\index{operator@{operator}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT = double$>$ ostream\& operator (ostream \& {\em os}, const Int\-Priority\-Queue$<$ PT $>$ \& {\em Q})\hspace{0.3cm}{\tt  [friend]}}\label{class_IntPriorityQueue_l0}




\subsection{Member Data Documentation}
\index{IntPriorityQueue@{Int\-Priority\-Queue}!Id@{Id}}
\index{Id@{Id}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT = double$>$ int $\ast$ Int\-Priority\-Queue$<$PT$>$::Id\hspace{0.3cm}{\tt  [private]}}\label{class_IntPriorityQueue_o4}




Definition at line 105 of file ipqueue.h.\index{IntPriorityQueue@{Int\-Priority\-Queue}!Index@{Index}}
\index{Index@{Index}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT = double$>$ int $\ast$ Int\-Priority\-Queue$<$PT$>$::Index\hspace{0.3cm}{\tt  [private]}}\label{class_IntPriorityQueue_o3}




Definition at line 102 of file ipqueue.h.\index{IntPriorityQueue@{Int\-Priority\-Queue}!M@{M}}
\index{M@{M}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT = double$>$ {\bf uint} Int\-Priority\-Queue$<$PT$>$::M\hspace{0.3cm}{\tt  [private]}}\label{class_IntPriorityQueue_o1}




Definition at line 96 of file ipqueue.h.\index{IntPriorityQueue@{Int\-Priority\-Queue}!N@{N}}
\index{N@{N}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT = double$>$ {\bf uint} Int\-Priority\-Queue$<$PT$>$::N\hspace{0.3cm}{\tt  [private]}}\label{class_IntPriorityQueue_o2}




Definition at line 99 of file ipqueue.h.\index{IntPriorityQueue@{Int\-Priority\-Queue}!Pri@{Pri}}
\index{Pri@{Pri}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT = double$>$ PT $\ast$ Int\-Priority\-Queue$<$PT$>$::Pri\hspace{0.3cm}{\tt  [private]}}\label{class_IntPriorityQueue_o5}




Definition at line 109 of file ipqueue.h.\index{IntPriorityQueue@{Int\-Priority\-Queue}!Rev@{Rev}}
\index{Rev@{Rev}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT = double$>$ int Int\-Priority\-Queue$<$PT$>$::Rev\hspace{0.3cm}{\tt  [private]}}\label{class_IntPriorityQueue_o0}




Definition at line 91 of file ipqueue.h.\index{IntPriorityQueue@{Int\-Priority\-Queue}!built@{built}}
\index{built@{built}!IntPriorityQueue@{Int\-Priority\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class PT = double$>$ int Int\-Priority\-Queue$<$PT$>$::built\hspace{0.3cm}{\tt  [private]}}\label{class_IntPriorityQueue_o6}




Definition at line 112 of file ipqueue.h.

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
{\bf ipqueue.h}\item 
{\bf ipqueue.inc}\end{CompactItemize}
