} //end UpdateList /// <summary> /// Allows adding TermListItems to the TermList. /// </summary> /// <param name="tli"></param> public void Add(TermListItem tli) { try { m_List.Add(tli); switch (tli.TermType) { case TermTypeEnum.LFOnly: UpdateList(ref m_LFOnlyCount, ref m_LastLFOnly, ref m_FirstLFOnly, false); break; case TermTypeEnum.CROnly: //route all jumps through here to catch this in every fix UpdateList(ref m_CROnlyCount, ref m_LastCROnly, ref m_FirstCROnly, true); break; case TermTypeEnum.CRLF: UpdateList(ref m_CRLFCount, ref m_LastCRLF, ref m_FirstCRLF, false); break; default: throw new System.InvalidOperationException("Bad value in switch statement"); } //end switch } //end try catch (Exception e) { CRLFAnalyzer.OutputException("Exception in TermListType.Add", e); } //end catch } //end Add()
}//end constructor /// <summary> /// This is really the core of the logic. /// Updates the jump list allowing for CROnlyNext entries. /// This method directly modifies the m_* static variables that store /// the counts and locations of the first and last jump entries. /// </summary> /// <param name="Count"></param> /// <param name="last"></param> /// <param name="first"></param> /// <param name="CROnly"></param> private void UpdateList(ref int Count, ref int last, ref int first, bool CROnly) { try { Count++; if (last > -1) { TermListItem setnext = (TermListItem)m_List[last]; setnext.Next = m_List.Count - 1; last = m_List.Count - 1; } //end if else //First entry into the jump list. Initialize both first and last. { first = m_List.Count - 1; last = m_List.Count - 1; }//end else //Special case the CROnly to insert special jumps into both LF and CRLF entries. if (CROnly) { if (m_LastLFOnly > -1) { TermListItem lastlf = (TermListItem)m_List[m_LastLFOnly]; if (lastlf.CROnlyNext == -1) { lastlf.CROnlyNext = m_List.Count - 1; } //end if } //end if if (m_LastCRLF > -1) { TermListItem lastcrlf = (TermListItem)m_List[m_LastCRLF]; if (lastcrlf.CROnlyNext == -1) { lastcrlf.CROnlyNext = m_List.Count - 1; } //end if } //end if } //end if } //end try catch (Exception e) { CRLFAnalyzer.OutputException("Exception in TermListType.UpdateList", e); } //end catch } //end UpdateList