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