org.exist.storage
Class StorageAddress

java.lang.Object
  extended by org.exist.storage.StorageAddress

public class StorageAddress
extends Object

Represents a (virtual) storage address in the paged file, consisting of page number, tuple id and type indicator. The format of a storage address is as follows:

 | page    | type | tid |
 | 1 2 3 4 | 5 6   | 7 8 |
 


Constructor Summary
StorageAddress()
           
 
Method Summary
static long createPointer(int page, short tid)
          Create virtual address from page number and offset (tid)
static long createPointer(int page, short tid, short flags)
           
static boolean equals(long p0, long p1)
          Returns true if the page number and tid of the two storage addresses is equal.
static short indexTypeFromPointer(long pointer)
          Get the type indicator from a virtual address.
static int pageFromPointer(long pointer)
          Get the page from a virtual address.
static long read(VariableByteInput is)
           
static long setIndexType(long pointer, short type)
           
static short tidFromPointer(long pointer)
          Get the tid (tuple id) from a virtual address.
static String toString(long pointer)
           
static void write(long pointer, VariableByteOutputStream os)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StorageAddress

public StorageAddress()
Method Detail

createPointer

public static final long createPointer(int page,
                                       short tid)
Create virtual address from page number and offset (tid)

Parameters:
page - page number
tid - offset
Returns:
new virtual address in a long

createPointer

public static final long createPointer(int page,
                                       short tid,
                                       short flags)

tidFromPointer

public static final short tidFromPointer(long pointer)
Get the tid (tuple id) from a virtual address.

Parameters:
pointer -
Returns:
the tid encoded in this address

pageFromPointer

public static final int pageFromPointer(long pointer)
Get the page from a virtual address.

Parameters:
pointer -
Returns:
the page encoded in this address

indexTypeFromPointer

public static final short indexTypeFromPointer(long pointer)
Get the type indicator from a virtual address. Returns a short corresponding to the type constants defined in Type.

Parameters:
pointer -
Returns:
type indicator from a virtual address

setIndexType

public static final long setIndexType(long pointer,
                                      short type)

equals

public static final boolean equals(long p0,
                                   long p1)
Returns true if the page number and tid of the two storage addresses is equal. The type indicator is ignored.

Parameters:
p0 -
p1 -
Returns:
true if the page number and tid of the two storage addresses is equal

write

public static final void write(long pointer,
                               VariableByteOutputStream os)

read

public static final long read(VariableByteInput is)
                       throws IOException,
                              EOFException
Throws:
IOException
EOFException

toString

public static final String toString(long pointer)


Copyright (C) Wolfgang Meier. All rights reserved.