java.lang.Object
java.io.OutputStream
de.grogra.util.OutputQueue
de.grogra.util.HierarchicalQueue
- All Implemented Interfaces:
Closeable,DataOutput,Flushable,ObjectOutput,AutoCloseable
- Direct Known Subclasses:
GraphQueue,XAQueue
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 typeint-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
ints contain the total number ofint,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 methodsetItemSize(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.
- Author:
- Ole Kniemeyer
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionfinal classstatic classclass -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intprotected final ObjectOutputStream -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidfinal intvoidclear()final HierarchicalQueue.Dataprotected HierarchicalQueue.Datafinal voidfinal voidendLevel()final voidendSkipBlock(int beginIndex) final HierarchicalQueue.Cursorfinal HierarchicalQueue.DatagetData()final booleanhasItems()final booleanfinal voidvoidfinal voidsetItemSize(int item, int bsize, int isize, int lsize, int fsize, int dsize, int asize) final voidwriteItem(int item) voidvoidMethods inherited from class de.grogra.util.OutputQueue
close, dump, flush, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeObjectInQueue, writeShort, writeUTFMethods inherited from class java.io.OutputStream
nullOutputStreamMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.io.DataOutput
writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
-
Field Details
-
NEXT_EXISTS
public static final int NEXT_EXISTS- See Also:
-
IS_FINISHED
public static final int IS_FINISHED- See Also:
-
ITEM_MASK
public static final int ITEM_MASK- See Also:
-
MIN_UNUSED_BIT
public static final int MIN_UNUSED_BIT- See Also:
-
MAX_UNUSED_BIT
public static final int MAX_UNUSED_BIT- See Also:
-
ITEM_AND_BITS_MASK
public static final int ITEM_AND_BITS_MASK- See Also:
-
BEGIN_LEVEL
public static final int BEGIN_LEVEL- See Also:
-
MIN_UNUSED_ITEM
public static final int MIN_UNUSED_ITEM- See Also:
-
out
-
-
Constructor Details
-
HierarchicalQueue
public HierarchicalQueue(boolean usesObjectQueue, boolean createBackLinks)
-
-
Method Details
-
clear
public void clear()- Overrides:
clearin classOutputQueue
-
setItemSize
public final void setItemSize(int item, int bsize, int isize, int lsize, int fsize, int dsize, int asize) -
beginLevel
public final void beginLevel() -
endLevel
public final void endLevel() -
discardLevel
public final void discardLevel() -
writeItem
public final void writeItem(int item) -
hasItems
public final boolean hasItems() -
hasItemsInCurrentLevel
public final boolean hasItemsInCurrentLevel() -
writeObject
- Specified by:
writeObjectin interfaceObjectOutput- Overrides:
writeObjectin classOutputQueue- Throws:
IOException
-
writeObjectInStream
- Throws:
IOException
-
beginSkipBlock
public final int beginSkipBlock() -
endSkipBlock
public final void endSkipBlock(int beginIndex) -
getCursor
-
moveTo
-
createData
-
getData
-
cloneData
-
restore
-