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.memory;
21  
22  
23  import java.util.List;
24  
25  import org.apache.directory.mavibot.btree.Tuple;
26  
27  
28  /**
29   * An abstract class to gather common elements of the DeleteResult
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 */abstract class AbstractDeleteResult<K, V> extends AbstractResult<K, V> implements
37      DeleteResult<K, V>
38  {
39      /** The modified page reference */
40      private Page<K, V> modifiedPage;
41  
42      /** The removed element if the key was found in the tree*/
43      private Tuple<K, V> removedElement;
44  
45  
46      /**
47       * The default constructor for AbstractDeleteResult.
48       * 
49       * @param modifiedPage The modified page
50       * @param removedElement The removed element (can be null if the key wasn't present in the tree)
51       */
52      /* No qualifier */AbstractDeleteResult( Page<K, V> modifiedPage, Tuple<K, V> removedElement )
53      {
54          super();
55          this.modifiedPage = modifiedPage;
56          this.removedElement = removedElement;
57      }
58  
59  
60      /**
61       * The default constructor for AbstractDeleteResult.
62       * 
63       * @param copiedPages the list of copied pages
64       * @param modifiedPage The modified page
65       * @param removedElement The removed element (can be null if the key wasn't present in the tree)
66       */
67      /* No qualifier */AbstractDeleteResult( List<Page<K, V>> copiedPages, Page<K, V> modifiedPage,
68          Tuple<K, V> removedElement )
69      {
70          super( copiedPages );
71          this.modifiedPage = modifiedPage;
72          this.removedElement = removedElement;
73      }
74  
75  
76      /**
77       * {@inheritDoc}
78       */
79      public Page<K, V> getModifiedPage()
80      {
81          return modifiedPage;
82      }
83  
84  
85      /**
86       * {@inheritDoc}
87       */
88      public Tuple<K, V> getRemovedElement()
89      {
90          return removedElement;
91      }
92  
93  
94      /**
95       * @param modifiedPage the modifiedPage to set
96       */
97      /* No qualifier */void setModifiedPage( Page<K, V> modifiedPage )
98      {
99          this.modifiedPage = modifiedPage;
100     }
101 }