org.planx.xmlstore.koala.io
Class RawNode

java.lang.Object
  extended by org.planx.xmlstore.koala.io.RawNode
Direct Known Subclasses:
VirtualRawNode

public abstract class RawNode
extends Object

A view of a node in byte representation. Nodes are created using the static createNode(org.planx.xmlstore.koala.io.NodeFileSystem, org.planx.io.Locator) method.

Author:
Thomas Ambus

Method Summary
abstract  int childCount()
           
static RawNode createNode(NodeFileSystem fs, Locator loc)
          Creates a RawNode based on the type read from the location of a node.
 boolean equals(Object o)
           
abstract  List<List<Byte>> getAttributes()
           
abstract  RawNode getChild(NodeFileSystem fs, int index)
           
abstract  List<Locator> getChildren()
           
 int getHeight()
           
 Locator getLocator()
           
abstract  byte getType()
           
abstract  List<Byte> getValue()
           
 Object getVisitToken()
           
 int hashCode()
           
abstract  boolean isDirty(int index)
           
abstract  boolean isVirtual()
           
abstract  Locator save(NodeFileSystem fs, boolean doLazySave)
          Synchronizes the byte representation of the node if necessary.
abstract  void setChild(int index, Locator child)
           
abstract  void setChild(int index, RawNode child)
          Changes a child pointer of this node in its in-memory representation.
 void setHeight(int height)
           
abstract  void setIsShared(boolean isShared)
          Updates the isShared status of this node in the underlying byte representation.
 void setVisitToken(Object token)
           
abstract  long size()
          Returns the number of bytes that the byte representation of this RawNode occupies.
 String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

createNode

public static RawNode createNode(NodeFileSystem fs,
                                 Locator loc)
                          throws IOException
Creates a RawNode based on the type read from the location of a node.

Throws:
IOException

isVirtual

public abstract boolean isVirtual()

getType

public abstract byte getType()

getValue

public abstract List<Byte> getValue()

getAttributes

public abstract List<List<Byte>> getAttributes()

getChildren

public abstract List<Locator> getChildren()

childCount

public abstract int childCount()

getChild

public abstract RawNode getChild(NodeFileSystem fs,
                                 int index)
                          throws IOException
Throws:
IOException

setChild

public abstract void setChild(int index,
                              Locator child)
                       throws IOException
Throws:
IOException

setChild

public abstract void setChild(int index,
                              RawNode child)
                       throws IOException
Changes a child pointer of this node in its in-memory representation. The actual update of the underlying byte representation can be postponed until the save(NodeFileSystem,boolean) method is called.

Throws:
IOException

isDirty

public abstract boolean isDirty(int index)

save

public abstract Locator save(NodeFileSystem fs,
                             boolean doLazySave)
                      throws IOException
Synchronizes the byte representation of the node if necessary. If the new byte representation fits in the old space, it is simply overwritten. If the new byte representation is longer, it is written to the specified file system by calling FileSystem.allocate(long). In any case, a Locator to the updated byte representation is returned. This RawNode will henceforth represent the new byte representation.

Throws:
IOException

setIsShared

public abstract void setIsShared(boolean isShared)
                          throws IOException
Updates the isShared status of this node in the underlying byte representation. Thus, this method can be called without calling save(NodeFileSystem,boolean) later.

Throws:
IOException

size

public abstract long size()
Returns the number of bytes that the byte representation of this RawNode occupies.


getLocator

public Locator getLocator()

getHeight

public int getHeight()

setHeight

public void setHeight(int height)

getVisitToken

public Object getVisitToken()

setVisitToken

public void setVisitToken(Object token)

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2004-2005 Plan-X. All Rights Reserved.