Пример #1
0
 /// -----------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="ScrVerse"/> class, when we don't
 /// care about the complete para property
 /// </summary>
 /// -----------------------------------------------------------------------------------
 public ScrVerse(BCVRef start, BCVRef end, ITsString text, ParaNodeMap map,
                 IScrTxtPara para, IStText paraOwner, int ichMinVerse, int ichMinText,
                 bool isChapterNumberRun, bool isVerseNumberRun) :
     this(start, end, text, map, para, paraOwner, ichMinVerse, ichMinText,
          isChapterNumberRun, isVerseNumberRun, false, false)
 {
 }
Пример #2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Creates a deep copy of this ParaNodeMap
        /// </summary>
        /// <returns>The copy</returns>
        /// ------------------------------------------------------------------------------------
        public ParaNodeMap Clone()
        {
            ParaNodeMap clonedMap = new ParaNodeMap();

            clonedMap.m_location = (int[])this.m_location.Clone();             // int[].Clone may only return its reference
            return(clonedMap);
        }
Пример #3
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Compares this object against the supplied one.  Objects are compared on the
        /// basis of their location, starting from the broadest form (where they are in
        /// the book), to the most specific (which paragraph in a section are they)
        /// </summary>
        /// <param name="o">The object to compare myself to</param>
        /// <returns>
        /// The integer value signifying this object's relationship to the one given.
        /// This relationship is an expression of our relationship to the supplied object.
        /// If this one is bigger than the one given, return 1, if smaller, -1, and if they
        /// are equal, 0
        /// </returns>
        /// ------------------------------------------------------------------------------------
        public int CompareTo(object o)
        {
            // Cast the given object and store it, so we don't have to keep casting it
            ParaNodeMap compareAgainst = (ParaNodeMap)o;

            // Walk down the list, starting at the least level of detail (the book level)
            // moving inwards towards paragraphs
            for (int i = 0; i < this.m_location.Length; i++)
            {
                // If at our current level of the depth, the object given to compare to
                // us is less than us, return 1 to show that we are bigger
                if (compareAgainst.m_location[i] < this.m_location[i])
                {
                    return(1);
                }
                // If it is greater than us, return -1
                else if (compareAgainst.m_location[i] > this.m_location[i])
                {
                    return(-1);
                }
            }

            // If the whole loop ran through and never returned, return 0
            // to signify that the objects are equal
            return(0);
        }
Пример #4
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="ScrVerseSet"/> class, for the given
        /// paragraph.
        /// </summary>
        /// <param name="para">given paragraph</param>
        /// <param name="fTreatChapterNumberAsSeparateScrVerse">if set to <c>true</c> treat
        /// chapter number as separate verse token.</param>
        /// ------------------------------------------------------------------------------------
        public ScrVerseSet(IScrTxtPara para, bool fTreatChapterNumberAsSeparateScrVerse)
        {
            if (para == null)
            {
                throw new ArgumentNullException("para");
            }

            m_para = para;
            m_fTreatChapterNumberAsSeparateScrVerse = fTreatChapterNumberAsSeparateScrVerse;
            m_address = new ParaNodeMap(para);
            m_para.GetRefsAtPosition(0, out m_startRef, out m_endRef);
        }
Пример #5
0
 /// -----------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="ScrVerse"/> class.
 /// </summary>
 /// -----------------------------------------------------------------------------------
 public ScrVerse(BCVRef start, BCVRef end, ITsString text, ParaNodeMap map,
                 IScrTxtPara para, IStText paraOwner, int ichMinVerse, int ichMinText,
                 bool isChapterNumberRun, bool isVerseNumberRun, bool isCompletePara, bool isStanzaBreak)
 {
     m_startRef         = new BCVRef(start);
     m_endRef           = new BCVRef(end);
     m_text             = text;
     m_address          = map;
     m_Para             = para;
     m_ParaOwner        = paraOwner;
     m_ichMinVerse      = ichMinVerse;
     m_ichMinText       = ichMinText;
     m_chapterNumberRun = isChapterNumberRun;
     m_verseNumberRun   = isVerseNumberRun;
     m_completePara     = isCompletePara;
     m_isStanzaBreak    = isStanzaBreak;
 }
Пример #6
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Two ParaNodeMaps are considered to be equal if they indicate the same exact location
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public override bool Equals(object o)
        {
            // Cast the given object and store it, so we don't have to keep casting it
            ParaNodeMap compareAgainst = (ParaNodeMap)o;

            // Walk down each list, comparing them side-by-side to see if any of the
            // elements are different
            for (int i = 0; i < this.m_location.Length; i++)
            {
                // If any of the elements in our arrays are different, return false; they aren't
                // equal unless they're equal on every element
                if (compareAgainst.m_location[i] != this.m_location[i])
                {
                    return(false);
                }
            }

            // If the whole loop ran through we know that the lists have the same values in them,
            // return true--they are equal
            return(true);
        }
Пример #7
0
 /// -----------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="ScrVerse"/> class for an empty paragraph.
 /// </summary>
 /// -----------------------------------------------------------------------------------
 public ScrVerse(BCVRef start, BCVRef end, ITsString text, ParaNodeMap map,
                 IScrTxtPara para, IStText paraOwner, bool isStanzaBreak) :
     this(start, end, text, map, para, paraOwner, 0, 0, false, false, true, isStanzaBreak)
 {
 }