コード例 #1
0
        // ----------------------------------------------------------------------
        // Copy history
        public void CopyFrom(iCS_NavigationHistory from)
        {
            // Copy cursor
            myCursor = from.myCursor;
            // Adjust size
            int fromLen = from.myMementos.Count;
            int toLen   = myMementos.Count;

            if (toLen > fromLen)
            {
                myMementos.RemoveRange(fromLen, toLen - fromLen);
            }
            myMementos.Capacity = fromLen;
            // Copy each memento
            for (int i = 0; i < fromLen; ++i)
            {
                if (i < myMementos.Count)
                {
                    myMementos[i].CopyFrom(from.myMementos[i]);
                }
                else
                {
                    myMementos.Add(from.myMementos[i].Clone());
                }
            }
        }
コード例 #2
0
 // ----------------------------------------------------------------------
 // Equivalence operator
 public bool IsEquivalentTo(iCS_NavigationHistory other)
 {
     if (myCursor != other.myCursor)
     {
         return(false);
     }
     for (int i = 0; i < myCursor; ++i)
     {
         if (!myMementos[i].IsEquivalentTo(other.myMementos[i]))
         {
             return(false);
         }
     }
     return(true);
 }