de.grogra.util
public class HierarchicalQueue extends OutputQueue implements java.io.ObjectOutput
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.
ints 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
ints 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.
| Modifier and Type | Class and Description |
|---|---|
class |
HierarchicalQueue.Cursor |
static class |
HierarchicalQueue.Data |
class |
HierarchicalQueue.Reader |
| Modifier and Type | Field and Description |
|---|---|
static int |
BEGIN_LEVEL |
static int |
IS_FINISHED |
static int |
ITEM_AND_BITS_MASK |
static int |
ITEM_MASK |
static int |
MAX_UNUSED_BIT |
static int |
MIN_UNUSED_BIT |
static int |
MIN_UNUSED_ITEM |
static int |
NEXT_EXISTS |
protected java.io.ObjectOutputStream |
out |
| Constructor and Description |
|---|
HierarchicalQueue(boolean usesObjectQueue,
boolean createBackLinks) |
| Modifier and Type | Method and Description |
|---|---|
void |
beginLevel() |
int |
beginSkipBlock() |
void |
clear() |
HierarchicalQueue.Data |
cloneData() |
protected HierarchicalQueue.Data |
createData() |
void |
discardLevel() |
void |
endLevel() |
void |
endSkipBlock(int beginIndex) |
HierarchicalQueue.Cursor |
getCursor(HierarchicalQueue.Cursor c) |
HierarchicalQueue.Data |
getData() |
boolean |
hasItems() |
boolean |
hasItemsInCurrentLevel() |
void |
moveTo(HierarchicalQueue.Cursor c) |
void |
restore(HierarchicalQueue.Data data) |
void |
setItemSize(int item,
int bsize,
int isize,
int lsize,
int fsize,
int dsize,
int asize) |
void |
writeItem(int item) |
void |
writeObject(java.lang.Object o) |
void |
writeObjectInStream(java.lang.Object o) |
close, dump, flush, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeObjectInQueue, writeShort, writeUTFpublic static final int BEGIN_LEVEL
public static final int IS_FINISHED
public static final int ITEM_AND_BITS_MASK
public static final int ITEM_MASK
public static final int MAX_UNUSED_BIT
public static final int MIN_UNUSED_BIT
public static final int MIN_UNUSED_ITEM
public static final int NEXT_EXISTS
protected final java.io.ObjectOutputStream out
public HierarchicalQueue(boolean usesObjectQueue,
boolean createBackLinks)
public final void beginLevel()
public final int beginSkipBlock()
public void clear()
clear in class OutputQueuepublic final HierarchicalQueue.Data cloneData()
protected HierarchicalQueue.Data createData()
public final void discardLevel()
public final void endLevel()
public final void endSkipBlock(int beginIndex)
public final HierarchicalQueue.Cursor getCursor(HierarchicalQueue.Cursor c)
public final HierarchicalQueue.Data getData()
public final boolean hasItems()
public final boolean hasItemsInCurrentLevel()
public final void moveTo(HierarchicalQueue.Cursor c)
public void restore(HierarchicalQueue.Data data)
public final void setItemSize(int item,
int bsize,
int isize,
int lsize,
int fsize,
int dsize,
int asize)
public final void writeItem(int item)
public void writeObject(java.lang.Object o)
throws java.io.IOException
writeObject in interface java.io.ObjectOutputwriteObject in class OutputQueuejava.io.IOExceptionpublic void writeObjectInStream(java.lang.Object o)
throws java.io.IOException
java.io.IOException