1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 *
19 */
20 package org.apache.directory.mavibot.btree;
21
22
23 import java.util.List;
24
25
26 /**
27 * The result of a delete operation, when the child has not been merged, and when
28 * we have borrowed an element from the left sibling. It contains the
29 * reference to the modified page, and the removed element.
30 *
31 * @param <K> The type for the Key
32 * @param <V> The type for the stored value
33
34 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
35 */
36 /* No qualifier*/class BorrowedFromLeftResult<K, V> extends AbstractBorrowedFromSiblingResult<K, V>
37 {
38 /**
39 * The default constructor for BorrowedFromLeftResult.
40 *
41 * @param modifiedPage The modified page
42 * @param modifiedSibling The modified sibling
43 * @param removedElement The removed element (can be null if the key wasn't present in the tree)
44 */
45 public BorrowedFromLeftResult( Page<K, V> modifiedPage, Page<K, V> modifiedSibling,
46 Tuple<K, V> removedElement )
47 {
48 super( modifiedPage, modifiedSibling, removedElement, AbstractBorrowedFromSiblingResult.SiblingPosition.LEFT );
49 }
50
51
52 /**
53 * A constructor for BorrowedFromLeftResult which takes a list of copied pages.
54 *
55 * @param copiedPages the list of copied pages
56 * @param modifiedPage The modified page
57 * @param modifiedSibling The modified sibling
58 * @param removedElement The removed element (can be null if the key wasn't present in the tree)
59 */
60 public BorrowedFromLeftResult( List<Page<K, V>> copiedPages, Page<K, V> modifiedPage,
61 Page<K, V> modifiedSibling,
62 Tuple<K, V> removedElement )
63 {
64 super( copiedPages, modifiedPage, modifiedSibling, removedElement,
65 AbstractBorrowedFromSiblingResult.SiblingPosition.LEFT );
66 }
67
68
69 /**
70 * @see Object#toString()
71 */
72 public String toString()
73 {
74 StringBuilder sb = new StringBuilder();
75
76 sb.append( "Borrowed from left" );
77 sb.append( super.toString() );
78
79 return sb.toString();
80 }
81 }