de.grogra.util
Class HierarchicalQueue
java.lang.Object
java.io.OutputStream
de.grogra.util.OutputQueue
de.grogra.util.HierarchicalQueue
- All Implemented Interfaces:
- java.io.Closeable, java.io.DataOutput, java.io.Flushable, java.io.ObjectOutput
- Direct Known Subclasses:
- GraphQueue, XAQueue
public class HierarchicalQueue
- extends OutputQueue
- implements java.io.ObjectOutput
A HierarchicalQueue
equips an OutputQueue
with a record-like, hierarchical structure. Each record is called
an item, the type of which is identified by the first
int
-value of the record. Items follow each other
in a linked list (the link is established by relative
addresses which are stored in an item's header structure, see below).
The item of type BEGIN_LEVEL
indicates a nesting of items,
it contains another linked list of items.
A whole item is represented by
the following structure in the int
-queue:
int
-value at offset 0: item type
int
-value at offset 1: difference between this item's
address (the absolute index of offset 0) and the address of the
previous item. If no previous item exists, -1 is used for the latter address.
The first item which is contained in a new level has no previous item.
- The following
int
s contain the total number of int
,
byte
, long, float
,
double
, Object
-values in this order. If
the total number of values of one of these types is always the same
for the item type, this number is not present in the structure. The
total number of values for an item type is set by the method
setItemSize(int, int, int, int, int, int, int)
.
- The following
int
s represent the data of the
item in its specific format
An item of type BEGIN_LEVEL
is used to store the whole
information of the nested items it contains. It uses an
additional int
-value as first value of its data:
Its value is the difference between the address of the
last contained item and this item.
- Author:
- Ole Kniemeyer
Constructor Summary |
HierarchicalQueue(boolean usesObjectQueue,
boolean createBackLinks)
|
Methods inherited from class de.grogra.util.OutputQueue |
close, dump, flush, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeObjectInQueue, writeShort, writeUTF |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.io.ObjectOutput |
close, flush, write, write, write |
Methods inherited from interface java.io.DataOutput |
writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF |
BEGIN_LEVEL
public static final int BEGIN_LEVEL
- See Also:
- Constant Field Values
IS_FINISHED
public static final int IS_FINISHED
- See Also:
- Constant Field Values
ITEM_AND_BITS_MASK
public static final int ITEM_AND_BITS_MASK
- See Also:
- Constant Field Values
ITEM_MASK
public static final int ITEM_MASK
- See Also:
- Constant Field Values
MAX_UNUSED_BIT
public static final int MAX_UNUSED_BIT
- See Also:
- Constant Field Values
MIN_UNUSED_BIT
public static final int MIN_UNUSED_BIT
- See Also:
- Constant Field Values
MIN_UNUSED_ITEM
public static final int MIN_UNUSED_ITEM
- See Also:
- Constant Field Values
NEXT_EXISTS
public static final int NEXT_EXISTS
- See Also:
- Constant Field Values
out
protected final java.io.ObjectOutputStream out
HierarchicalQueue
public HierarchicalQueue(boolean usesObjectQueue,
boolean createBackLinks)
beginLevel
public final void beginLevel()
beginSkipBlock
public final int beginSkipBlock()
clear
public void clear()
- Overrides:
clear
in class OutputQueue
cloneData
public final HierarchicalQueue.Data cloneData()
createData
protected HierarchicalQueue.Data createData()
discardLevel
public final void discardLevel()
endLevel
public final void endLevel()
endSkipBlock
public final void endSkipBlock(int beginIndex)
getCursor
public final HierarchicalQueue.Cursor getCursor(HierarchicalQueue.Cursor c)
getData
public final HierarchicalQueue.Data getData()
hasItems
public final boolean hasItems()
hasItemsInCurrentLevel
public final boolean hasItemsInCurrentLevel()
moveTo
public final void moveTo(HierarchicalQueue.Cursor c)
restore
public void restore(HierarchicalQueue.Data data)
setItemSize
public final void setItemSize(int item,
int bsize,
int isize,
int lsize,
int fsize,
int dsize,
int asize)
writeItem
public final void writeItem(int item)
writeObject
public void writeObject(java.lang.Object o)
throws java.io.IOException
- Specified by:
writeObject
in interface java.io.ObjectOutput
- Overrides:
writeObject
in class OutputQueue
- Throws:
java.io.IOException
writeObjectInStream
public void writeObjectInStream(java.lang.Object o)
throws java.io.IOException
- Throws:
java.io.IOException