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