コード例 #1
0
 public IDeque <T> EnqueueRight(T value)
 {
     if (!Right.Full)
     {
         return(new Deque <T>(Left, Middle, Right.EnqueueRight(value)));
     }
     return(new Deque <T>(
                Left,
                Middle.EnqueueRight(Right.DequeueRight()),
                new Two(Right.PeekRight(), value)));
 }
コード例 #2
0
ファイル: Deque`1.cs プロジェクト: uniblab/Icod.Collections
 public IDeque <T> DequeueRight()
 {
     return((1 < myRight.Capacity)
                         ? new Deque <T>(myLeft, myMiddle, myRight.DequeueRight(), myLongCount - 1)
                         : (!myMiddle.IsEmpty)
                                 ? new Deque <T>(myLeft, myMiddle.DequeueRight(), myMiddle.PeekRight(), myLongCount - 1)
                                 : (1 < myLeft.Capacity)
                                         ? new Deque <T>(myLeft.DequeueRight(), myMiddle, new One(myLeft.PeekRight()), myLongCount - 1)
                                         : new SingleDequeue(myLeft.PeekRight()) as IDeque <T>
            );
 }
コード例 #3
0
 public IDeque <T> DequeueRight()
 {
     if (Right.Size > 1)
     {
         return(new Deque <T>(Left, Middle, Right.DequeueRight()));
     }
     if (!Middle.IsEmpty)
     {
         return(new Deque <T>(Left, Middle.DequeueRight(), Middle.PeekRight()));
     }
     if (Left.Size > 1)
     {
         return(new Deque <T>(Left.DequeueRight(), Middle, new One(Left.PeekRight())));
     }
     return(new SingleDeque(Left.PeekRight()));
 }