KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sleepycat > je > tree > TreeLocation


1 /*-
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 2002,2006 Oracle. All rights reserved.
5  *
6  * $Id: TreeLocation.java,v 1.14 2006/10/30 21:14:26 bostic Exp $
7  */

8
9 package com.sleepycat.je.tree;
10
11 import com.sleepycat.je.utilint.DbLsn;
12
13 /*
14  * TreeLocation is a cursor like object that keeps track of a location
15  * in a tree. It's used during recovery.
16  */

17 public class TreeLocation {
18     public BIN bin; // parent BIN for the target LN
19
public int index; // index of where the LN is or should go
20
public byte[] lnKey; // the key that represents this LN in this BIN
21
public long childLsn = DbLsn.NULL_LSN; // current LSN value in that slot.
22

23     public void reset() {
24         bin = null;
25         index = -1;
26         lnKey = null;
27         childLsn = DbLsn.NULL_LSN;
28     }
29
30     public String JavaDoc toString() {
31     StringBuffer JavaDoc sb = new StringBuffer JavaDoc("<TreeLocation bin=\"");
32     if (bin == null) {
33         sb.append("null");
34     } else {
35         sb.append(bin.getNodeId());
36     }
37     sb.append("\" index=\"");
38     sb.append(index);
39     sb.append("\" lnKey=\"");
40     sb.append(Key.dumpString(lnKey,0));
41     sb.append("\" childLsn=\"");
42     sb.append(DbLsn.toString(childLsn));
43     sb.append("\">");
44     return sb.toString();
45     }
46 }
47
48
Popular Tags