View Javadoc
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   * An abstract class to gather common elements of the DeleteResult
28   * 
29   * @param <K> The type for the Key
30   * @param <V> The type for the stored value
31   *
32   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
33   */
34  /* No qualifier*/abstract class AbstractDeleteResult<K, V> extends AbstractResult<K, V> implements
35      DeleteResult<K, V>
36  {
37      /** The modified page reference */
38      private Page<K, V> modifiedPage;
39  
40      /** The removed element if the key was found in the tree*/
41      private Tuple<K, V> removedElement;
42  
43  
44      /**
45       * The default constructor for AbstractDeleteResult.
46       * 
47       * @param modifiedPage The modified page
48       * @param removedElement The removed element (can be null if the key wasn't present in the tree)
49       */
50      /*no qualifier*/AbstractDeleteResult( Page<K, V> modifiedPage, Tuple<K, V> removedElement )
51      {
52          super();
53          this.modifiedPage = modifiedPage;
54          this.removedElement = removedElement;
55      }
56  
57  
58      /**
59       * The default constructor for AbstractDeleteResult.
60       * 
61       * @param copiedPages the list of copied pages
62       * @param modifiedPage The modified page
63       * @param removedElement The removed element (can be null if the key wasn't present in the tree)
64       */
65      /*no qualifier*/AbstractDeleteResult( List<Page<K, V>> copiedPages, Page<K, V> modifiedPage,
66          Tuple<K, V> removedElement )
67      {
68          super( copiedPages );
69          this.modifiedPage = modifiedPage;
70          this.removedElement = removedElement;
71      }
72  
73  
74      /**
75       * {@inheritDoc}
76       */
77      public Page<K, V> getModifiedPage()
78      {
79          return modifiedPage;
80      }
81  
82  
83      /**
84       * {@inheritDoc}
85       */
86      public Tuple<K, V> getRemovedElement()
87      {
88          return removedElement;
89      }
90  
91  
92      /**
93       * @param modifiedPage the modifiedPage to set
94       */
95      /*no qualifier*/void setModifiedPage( Page<K, V> modifiedPage )
96      {
97          this.modifiedPage = modifiedPage;
98      }
99  }