org.planx.xmlstore.io
Class LocalLocator

java.lang.Object
  extended by org.planx.xmlstore.io.LocalLocator
All Implemented Interfaces:
Comparable<LocalLocator>, Reference, Locator

public class LocalLocator
extends Object
implements Locator, Comparable<LocalLocator>

A LocalLocator consists of a file offset, a length, and a FileSystemIdentifier. The file offset and the FileSystemIdentifier uniquely identifies a LocalLocator. The length is merely used for efficient de-allocation of the space occupied in the FileSystem.

TODO: Only path compression is currently performed. Add union-by-rank.

Author:
Thomas Ambus

Field Summary
static byte CLASS_ID
           
protected  LocalLocator eqref
           
protected  FileSystemIdentifier fsi
           
protected  int len
           
protected  int off
           
 
Constructor Summary
LocalLocator(int off, int len, FileSystemIdentifier fsi)
           
 
Method Summary
 LocalLocator clone()
          Careful with this!
 int compareTo(LocalLocator loc)
           
 boolean equals(Object o)
           
protected  LocalLocator find()
           
static Discriminator<LocalLocator> getDiscriminator(Memory memory)
           
 FileSystemIdentifier getFileSystemId()
           
 int getLen()
           
 int getOff()
           
static Streamer<LocalLocator> getStreamer(boolean isCompact)
           
 int hashCode()
           
 boolean isContained(LocalLocator l)
           
 void locatorMoved(LocalLocator loc)
           
 void setFileSystemId(FileSystemIdentifier fsi)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CLASS_ID

public static final byte CLASS_ID
See Also:
Constant Field Values

off

protected int off

len

protected int len

fsi

protected FileSystemIdentifier fsi

eqref

protected LocalLocator eqref
Constructor Detail

LocalLocator

public LocalLocator(int off,
                    int len,
                    FileSystemIdentifier fsi)
Method Detail

clone

public LocalLocator clone()
Careful with this! It breaks union-find for in-memory locators.

Overrides:
clone in class Object

find

protected LocalLocator find()

getFileSystemId

public FileSystemIdentifier getFileSystemId()

setFileSystemId

public void setFileSystemId(FileSystemIdentifier fsi)

locatorMoved

public void locatorMoved(LocalLocator loc)

getOff

public int getOff()

getLen

public int getLen()

isContained

public boolean isContained(LocalLocator l)

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

compareTo

public int compareTo(LocalLocator loc)
Specified by:
compareTo in interface Comparable<LocalLocator>

toString

public String toString()
Overrides:
toString in class Object

getStreamer

public static Streamer<LocalLocator> getStreamer(boolean isCompact)

getDiscriminator

public static Discriminator<LocalLocator> getDiscriminator(Memory memory)


Copyright © 2010. All Rights Reserved.