\section{Segments  Class Reference}
\label{class_Segments}\index{Segments@{Segments}}
Collaboration diagram for Segments:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=106pt]{class_Segments_coll_graph}
\end{center}
\end{figure}
\subsection*{Public Methods}
\begin{CompactItemize}
\item 
{\bf Segments} ()
\item 
{\bf $\sim$Segments} ()
\item 
double {\bf Get\-Num} (void)
\item 
{\bf Segment} {\bf Get\-Seg} (int j)
\item 
void {\bf Add} (double start, double end)
\item 
void {\bf Add} ({\bf Segment} seg)
\item 
void {\bf QSort\-Reduce} ()
\item 
{\bf Segment} {\bf QSort\-Reduce\-Viol} (double testval)
\item 
{\bf Segment} {\bf Pop} (void)
\item 
int {\bf Number} (void)
\item 
void {\bf Clear} ()
\end{CompactItemize}
\subsection*{Private Methods}
\begin{CompactItemize}
\item 
bool {\bf Overlap} ({\bf Segment} \&s1, {\bf Segment} \&s2)
\item 
{\bf Segment} {\bf Join} ({\bf Segment} \&s1, {\bf Segment} \&s2)
\end{CompactItemize}
\subsection*{Private Attributes}
\begin{CompactItemize}
\item 
{\bf DLList}$<${\bf Segment}$>$ {\bf L}
\end{CompactItemize}


\subsection{Constructor \& Destructor Documentation}
\index{Segments@{Segments}!Segments@{Segments}}
\index{Segments@{Segments}!Segments@{Segments}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Segments::Segments ()\hspace{0.3cm}{\tt  [inline]}}\label{class_Segments_a0}




Definition at line 93 of file segments.inc.\footnotesize\begin{verbatim}00093                { }
00094 \end{verbatim}\normalsize 
\index{Segments@{Segments}!~Segments@{$\sim$Segments}}
\index{~Segments@{$\sim$Segments}!Segments@{Segments}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Segments::$\sim$Segments ()\hspace{0.3cm}{\tt  [inline]}}\label{class_Segments_a1}




Definition at line 94 of file segments.inc.\footnotesize\begin{verbatim}00094                 { }
00095 \end{verbatim}\normalsize 


\subsection{Member Function Documentation}
\index{Segments@{Segments}!Add@{Add}}
\index{Add@{Add}!Segments@{Segments}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Segments::Add ({\bf Segment} {\em seg})\hspace{0.3cm}{\tt  [inline]}}\label{class_Segments_a5}




Definition at line 109 of file segments.inc.\footnotesize\begin{verbatim}00109                        {
00110     L.AddToFront(seg);      // unsorted Segment list
00111 \end{verbatim}\normalsize 
\index{Segments@{Segments}!Add@{Add}}
\index{Add@{Add}!Segments@{Segments}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Segments::Add (double {\em start}, double {\em end})\hspace{0.3cm}{\tt  [inline]}}\label{class_Segments_a4}




Definition at line 104 of file segments.inc.

Referenced by gw\-Numerics::add\-LPERTSegments(), and gw\-Numerics::add\-VDWSegments().\footnotesize\begin{verbatim}00104                                     {    
00105     Segment s(start,end);
00106     L.AddToFront(s);      // unsorted Segment list
00107 \end{verbatim}\normalsize 
\index{Segments@{Segments}!Clear@{Clear}}
\index{Clear@{Clear}!Segments@{Segments}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Segments::Clear ()\hspace{0.3cm}{\tt  [inline]}}\label{class_Segments_a10}




Definition at line 197 of file segments.inc.\footnotesize\begin{verbatim}00198     {L.Clear();}
00199 \end{verbatim}\normalsize 
\index{Segments@{Segments}!GetNum@{GetNum}}
\index{GetNum@{GetNum}!Segments@{Segments}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double Segments::Get\-Num (void)\hspace{0.3cm}{\tt  [inline]}}\label{class_Segments_a2}




Definition at line 96 of file segments.inc.

Referenced by gw\-Numerics::Set\-HCPosition2(), and gw\-Numerics::add\-LPERTSegments().\footnotesize\begin{verbatim}00096                       {
00097     return L.Number();
00098 \end{verbatim}\normalsize 
\index{Segments@{Segments}!GetSeg@{GetSeg}}
\index{GetSeg@{GetSeg}!Segments@{Segments}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Segment} Segments::Get\-Seg (int {\em j})\hspace{0.3cm}{\tt  [inline]}}\label{class_Segments_a3}




Definition at line 100 of file segments.inc.

Referenced by gw\-Numerics::Set\-HCPosition2(), and gw\-Numerics::add\-LPERTSegments().\footnotesize\begin{verbatim}00100                         {
00101     return L.Get(j);
00102 \end{verbatim}\normalsize 
\index{Segments@{Segments}!Join@{Join}}
\index{Join@{Join}!Segments@{Segments}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Segment} Segments::Join ({\bf Segment} \& {\em s1}, {\bf Segment} \& {\em s2})\hspace{0.3cm}{\tt  [inline, private]}}\label{class_Segments_c1}




Definition at line 211 of file segments.inc.

Referenced by QSort\-Reduce().\footnotesize\begin{verbatim}00212     {
00213 
00214       Segment returnSegment;      
00215       returnSegment.start = (s1.start>s2.start) ? s2.start : s1.start;
00216       returnSegment.end = (s1.end<s2.end) ? s2.end : s1.end;
00217       //      returnSegment.width = returnSegment.end - returnSegment.start;      
00218       return returnSegment;
00219 \end{verbatim}\normalsize 
\index{Segments@{Segments}!Number@{Number}}
\index{Number@{Number}!Segments@{Segments}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Segments::Number (void)\hspace{0.3cm}{\tt  [inline]}}\label{class_Segments_a9}




Definition at line 194 of file segments.inc.\footnotesize\begin{verbatim}00195     {return(L.Number());}
00196 \end{verbatim}\normalsize 
\index{Segments@{Segments}!Overlap@{Overlap}}
\index{Overlap@{Overlap}!Segments@{Segments}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool Segments::Overlap ({\bf Segment} \& {\em s1}, {\bf Segment} \& {\em s2})\hspace{0.3cm}{\tt  [inline, private]}}\label{class_Segments_c0}




Definition at line 202 of file segments.inc.

Referenced by QSort\-Reduce().\footnotesize\begin{verbatim}00203     {
00204       if ((s1.start >= s2.start)&&(s1.start <= s2.end)) return true;
00205       if ((s2.start >= s1.start)&&(s2.start <= s1.end)) return true;
00206       if ((s1.end >= s2.start)&&(s1.end <= s2.end)) return true;
00207       if ((s2.end >= s1.start)&&(s2.end <= s1.end)) return true;
00208       return false;     
00209 \end{verbatim}\normalsize 
\index{Segments@{Segments}!Pop@{Pop}}
\index{Pop@{Pop}!Segments@{Segments}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Segment} Segments::Pop (void)\hspace{0.3cm}{\tt  [inline]}}\label{class_Segments_a8}




Definition at line 191 of file segments.inc.\footnotesize\begin{verbatim}00192     {return(L.RemoveFromFront());}
00193 \end{verbatim}\normalsize 
\index{Segments@{Segments}!QSortReduce@{QSortReduce}}
\index{QSortReduce@{QSortReduce}!Segments@{Segments}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Segments::QSort\-Reduce ()\hspace{0.3cm}{\tt  [inline]}}\label{class_Segments_a6}




Definition at line 113 of file segments.inc.

Referenced by QSort\-Reduce\-Viol().\footnotesize\begin{verbatim}00113                     {
00114     int num = L.Number();
00115     if (num == 0) return;      
00116     // Sort the list using another array
00117     Segment *segarray = new Segment[num];
00118     for (int i= 0;i<num;i++)
00119       segarray[i] = L.RemoveFromFront(); // Create array for quicksort
00120     RecQuickSort(segarray, 0, num-1);  // Sort it (from search-sort.h)
00121 
00122     L.Clear(); // sanity ck debug
00123 
00124     // Reduce as they are added back to the list.
00125     Segment TempSeg = segarray[0];
00126     int j = 1;
00127     // the next 9 lines are a gem. --jd
00128     while (j < num){
00129       if(Overlap(TempSeg,segarray[j])){ 
00130         TempSeg = Join(TempSeg,segarray[j++]);
00131       } else {
00132         L.AddToBack(TempSeg); 
00133         TempSeg = segarray[j++];
00134       }    
00135     }
00136 \end{verbatim}\normalsize 
\index{Segments@{Segments}!QSortReduceViol@{QSortReduceViol}}
\index{QSortReduceViol@{QSortReduceViol}!Segments@{Segments}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Segment} Segments::QSort\-Reduce\-Viol (double {\em testval})\hspace{0.3cm}{\tt  [inline]}}\label{class_Segments_a7}




Definition at line 142 of file segments.inc.

Referenced by gw\-Numerics::Set\-HCPosition2().\footnotesize\begin{verbatim}00142                                          {
00143     // Returns segment that overlaps the testval.  This check REQUIES
00144     // that the seglist be sorted and reduced for efficient checking,
00145     // so this function begins with a call to QSortReduce.
00146 
00147     Segment testseg(testval,testval);
00148     
00149     QSortReduce();
00150 
00151 #ifdef JOB_VERBOSE2
00152     int num = L.Number();
00153     cerr << "final number segments = "<< num << "; "      ;
00154     for (int i=0;i<num;i++) cerr << "(" << L.Get(i) << ") " ;
00155     cerr << endl;
00156 #endif
00157     
00158     if (L.Number()>0){
00159       int segind = 0;
00160       testseg = L.Get(segind++);
00161 #ifdef JOB_VERBOSE2
00162       cerr << "walking up through segment: ("<< testseg <<") ;?test overlap "<<testval<< endl;
00163 #endif    
00164       while (testseg.end < testval){
00165         if (segind >= L.Number()) break;
00166         testseg = L.Get(segind++);
00167       }
00168       // test for violation
00169       if ((testseg.start < testval) && (testseg.end > testval)){
00170 #ifdef JOB_VERBOSE2
00171     cerr << "Violating segment: ("<< testseg <<")"<< endl;
00172 #endif    
00173 
00174         return testseg;
00175       }
00176       testseg.start = 0; // returns zero segment if ok
00177       testseg.end = 0;
00178     } else {
00179       // no segments at all in this class
00180       testseg.start = 0; // returns zero segment if ok
00181       testseg.end = 0;
00182     }
00183 \end{verbatim}\normalsize 


\subsection{Member Data Documentation}
\index{Segments@{Segments}!L@{L}}
\index{L@{L}!Segments@{Segments}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf DLList}$<$ {\bf Segment} $>$ Segments::L\hspace{0.3cm}{\tt  [private]}}\label{class_Segments_o0}




Definition at line 89 of file segments.inc.

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