KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > mdr > persistence > btreeimpl > btreestorage > DeletedBtreeExtent


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.mdr.persistence.btreeimpl.btreestorage;
20
21 import java.io.*;
22 import java.util.*;
23
24 /** This is an extent which is part of a record which has been deleted,
25 * and is available for reuse
26 */

27 class DeletedBtreeExtent extends BtreeExtent {
28
29     /** Create a new DeletedBtreeExtent
30     * @param file the BtreeDataFile this extent will belong to
31     * @param chunkNum where this extent begins
32     * @param numChunks the size of the extent
33     */

34     DeletedBtreeExtent(BtreeDataFile file, int chunkNum, short numChunks) {
35         super(file, chunkNum, numChunks);
36     }
37
38     /** Convert an active extent to a deleted one when a record is
39     * deleted
40     * @param extent the extent being deleted
41     */

42     DeletedBtreeExtent(ActiveBtreeExtent extent) {
43         super(extent);
44         headerIsDirty = true;
45         owner.deleteExtent(this);
46     }
47         
48     /** read type-specific header data. A no-op, since DeletedBtreeExtents
49     * have none.
50     * @param buffer the buffer to read from
51     * @param offset the offset to being reading at
52     */

53     void readHeaderFromPage(byte buffer[], IntHolder offset) {
54         // we have no type-specific data
55
}
56
57     /** Get the magic number for this type of extent
58     * @return the magic number
59     */

60     short getMagic() {
61         return DELETED_MAGIC;
62     }
63
64     /** write the type-specific part of the header. A no-op, since
65     * DeletedBtreeExtents have none.
66     * @param page the page to write to
67     * @param offset the offset to begin an
68     */

69     protected void writeHeaderToPage(CachedPage page, int offset) {
70         // we have no type-specific data
71
}
72
73     /** return type of extent
74     * @return IS_DELETED
75     */

76     byte getType() {
77         return IS_DELETED;
78     }
79
80     /** return name of type of extent
81     * @return DELETED_NAME
82     */

83     String JavaDoc getTypeName() {
84         return DELETED_NAME;
85     }
86 }
87
Popular Tags