예제 #1
0
 public override ImmutableCollection <T> AddBack(T value)
 {
     if (m_right.IsFull)
     {
         return(new NormalCollection(
                    m_left,
                    m_middle.AddBack(m_right.RemoveBack()),
                    new Two(m_right.Back, value)));
     }
     else
     {
         return(new NormalCollection(m_left, m_middle, m_right.AddBack(value)));
     }
 }
예제 #2
0
 public override ImmutableCollection <T> RemoveBack()
 {
     if (m_right.Size > 1)
     {
         return(new NormalCollection(m_left, m_middle, m_right.RemoveBack()));
     }
     else if (!m_middle.IsEmpty)
     {
         return(new NormalCollection(m_left, m_middle.RemoveBack(), m_middle.Back));
     }
     else if (m_left.Size > 1)
     {
         return(new NormalCollection(m_left.RemoveBack(), ImmutableCollection <MiniCollection> .Empty, new One(m_left.Back)));
     }
     else
     {
         return(new SingleCollection(m_left.Back));
     }
 }