KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > db4o > MetaIndex


1 /* Copyright (C) 2004 - 2006 db4objects Inc. http://www.db4o.com
2
3 This file is part of the db4o open source object database.
4
5 db4o is free software; you can redistribute it and/or modify it under
6 the terms of version 2 of the GNU General Public License as published
7 by the Free Software Foundation and as clarified by db4objects' GPL
8 interpretation policy, available at
9 http://www.db4o.com/about/company/legalpolicies/gplinterpretation/
10 Alternatively you can write to db4objects, Inc., 1900 S Norfolk Street,
11 Suite 350, San Mateo, CA 94403, USA.
12
13 db4o is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License along
19 with this program; if not, write to the Free Software Foundation, Inc.,
20 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */

21 package com.db4o;
22
23 /**
24  * The index record that is written to the database file.
25  * Don't obfuscate.
26  *
27  * @exclude
28  * @persistent
29  */

30 public class MetaIndex implements Internal4{
31     
32     // The number of entries an the length are redundant, because the handler should
33
// return a fixed length, but we absolutely want to make sure, we don't free
34
// a slot into nowhere.
35

36     public int indexAddress;
37     public int indexEntries;
38     public int indexLength;
39     
40     // TODO: make sure this aren't really needed
41
// and remove them
42
private final int patchAddress = 0;
43     private final int patchEntries = 0;
44     private final int patchLength = 0;
45     
46     public void read(YapReader reader){
47         indexAddress = reader.readInt();
48         indexEntries = reader.readInt();
49         indexLength = reader.readInt();
50         
51         // no longer used apparently
52
/*patchAddress = */reader.readInt();
53         /*patchEntries = */reader.readInt();
54         /*patchLength = */reader.readInt();
55     }
56     
57     public void write(YapReader writer){
58         writer.writeInt(indexAddress);
59         writer.writeInt(indexEntries);
60         writer.writeInt(indexLength);
61         writer.writeInt(patchAddress);
62         writer.writeInt(patchEntries);
63         writer.writeInt(patchLength);
64     }
65     
66     public void free(YapFile file){
67         file.free(indexAddress, indexLength);
68         indexAddress = 0;
69         indexLength = 0;
70 // file.free(patchAddress, patchLength);
71
// patchAddress = 0;
72
// patchLength = 0;
73
}
74 }
75
Popular Tags