public class EvioNode
extends java.lang.Object
implements java.lang.Cloneable
Modifier and Type | Field and Description |
---|---|
(package private) java.util.ArrayList<EvioNode> |
allNodes
List of all nodes in the event including the top-level object
ordered according to placement in buffer.
|
BlockNode |
blockNode
Block containing this node.
|
(package private) java.nio.ByteBuffer |
buffer
ByteBuffer that this node is associated with.
|
(package private) java.util.ArrayList<EvioNode> |
childNodes
List of child nodes ordered according to placement in buffer.
|
(package private) int[] |
data
Store data in int array form if calculated.
|
(package private) int |
dataLen
Length of node's data in 32-bit words.
|
(package private) int |
dataPos
Position of node's data in buffer in bytes.
|
(package private) int |
dataType
Type of data stored in node.
|
(package private) EvioNode |
eventNode
Node of event containing this node.
|
(package private) boolean |
isEvent
Does this node represent an event (top-level bank)?
|
(package private) int |
len
Header's length value (32-bit words).
|
(package private) int |
num
Header's num value.
|
(package private) boolean |
obsolete
If the data this node represents is removed from the buffer,
then this object is obsolete.
|
(package private) int |
pad
Header's padding value.
|
(package private) EvioNode |
parentNode
Node containing this node.
|
(package private) int |
place
Place of containing event in file/buffer.
|
(package private) int |
poolId
If in pool, the pool's id.
|
(package private) int |
pos
Position of header in buffer in bytes.
|
(package private) int |
recordPos
Position of the record in buffer containing this node in bytes
|
(package private) boolean |
scanned
If top-level event node, was I scanned and all my banks
already placed into a list?
|
(package private) int |
tag
Header's tag value.
|
(package private) int |
type
This node's (evio container's) type.
|
Constructor and Description |
---|
EvioNode()
Constructor when fancy features not needed.
|
EvioNode(EvioNode firstNode)
Constructor used when swapping data.
|
EvioNode(int pos,
int place,
java.nio.ByteBuffer buffer,
BlockNode blockNode)
Constructor which creates an EvioNode associated with
an event (top level) evio container when parsing buffers
for evio data.
|
EvioNode(int pos,
int place,
int recordPos,
java.nio.ByteBuffer buffer)
Constructor which creates an EvioNode associated with
an event (top level) evio container when parsing buffers
for evio data.
|
EvioNode(int tag,
int num,
int pos,
int dataPos,
DataType type,
DataType dataType,
java.nio.ByteBuffer buffer)
Constructor which creates an EvioNode in the CompactEventBuilder.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
addChild(EvioNode node)
Add a child node to the end of the child list and
to the list of all nodes contained in event.
|
void |
clear()
Clear all data in this object.
|
void |
clearAll()
Clear everything in this object and set allNodes object to null.
|
void |
clearIntArray()
Only clear the data array.
|
void |
clearLists()
Clear childNodes.
|
void |
clearObjects()
Empty all lists and remove all other objects from this object.
|
java.lang.Object |
clone() |
static EvioNode |
extractEventNode(java.nio.ByteBuffer buffer,
EvioNodeSource pool,
BlockNode blockNode,
int position,
int place)
This method extracts an EvioNode object representing an
evio event (top level evio bank) from a given buffer, a
location in the buffer, and a few other things.
|
static EvioNode |
extractEventNode(java.nio.ByteBuffer buffer,
EvioNodeSource pool,
int recPosition,
int position,
int place)
This method extracts an EvioNode object representing an
evio event (top level evio bank) from a given buffer, a
location in the buffer, and a few other things.
|
static EvioNode |
extractNode(EvioNode bankNode,
int position)
This method populates an EvioNode object that will represent an
evio bank from that same node containing a reference to the
backing buffer and given a position in that buffer.
|
void |
getAllDescendants(java.util.List<EvioNode> descendants)
Get the list of all descendant nodes that this node contains -
not only the immediate children.
|
java.util.ArrayList<EvioNode> |
getAllNodes()
Get the list of all nodes that this node contains,
always including itself.
|
(package private) BlockNode |
getBlockNode()
Get the object representing the block header.
|
java.nio.ByteBuffer |
getBuffer()
Get the object containing the buffer that this node is associated with.
|
java.nio.ByteBuffer |
getByteData(boolean copy)
Get the data associated with this node in ByteBuffer form.
|
EvioNode |
getChildAt(int index)
Get the child node at the given index (starts at 0).
|
int |
getChildCount()
Get the number all children that this node contains.
|
java.util.ArrayList<EvioNode> |
getChildNodes()
Get the list of all child nodes that this node contains.
|
int |
getDataLength()
Get the length of this evio structure's data only (no header words)
in 32-bit words.
|
int |
getDataPosition()
Get the file/buffer byte position of this evio structure's data.
|
int |
getDataType()
Get the evio type of the data this evio structure contains.
|
DataType |
getDataTypeObj()
Get the evio type of the data this evio structure contains as an object.
|
int |
getEventNumber()
If this object represents an event (top-level, evio bank),
then returns its number (place in file or buffer) starting
with 1.
|
int[] |
getIntData()
Get the data associated with this node as an 32-bit integer array.
|
int[] |
getIntData(int[] intData,
int[] length)
Get the data associated with this node as an 32-bit integer array.
|
int |
getLength()
Get the length of this evio structure (not including length word itself)
in 32-bit words.
|
long[] |
getLongData()
Get the data associated with this node as an 64-bit integer array.
|
long[] |
getLongData(long[] longData,
int[] length)
Get the data associated with this node as an 64-bit integer array.
|
int |
getNum()
Get the num of this evio structure.
|
int |
getPad()
Get the padding of this evio structure.
|
EvioNode |
getParentNode()
Get this node's parent node.
|
int |
getPlace()
Get the place of containing event in file/buffer.
|
int |
getPosition()
Get the file/buffer byte position of this evio structure.
|
int |
getRecordPosition()
Get the file/buffer byte position of the record containing this node.
|
short[] |
getShortData()
Get the data associated with this node as an 16-bit integer array.
|
short[] |
getShortData(short[] shortData,
int[] length)
Get the data associated with this node as an 16-bit integer array.
|
java.nio.ByteBuffer |
getStructureBuffer(boolean copy)
Get this node's entire evio structure in ByteBuffer form.
|
int |
getTag()
Get the tag of this evio structure.
|
int |
getTotalBytes()
Get the length of this evio structure including entire header in bytes.
|
int |
getType()
Get the evio type of this evio structure, not what it contains.
|
DataType |
getTypeObj()
Get the evio type of this evio structure as an object.
|
boolean |
isEvent()
Does this object represent an event?
|
boolean |
isObsolete()
Has the data this node represents in the buffer been removed?
|
(package private) void |
removeChild(EvioNode node)
Remove a node from this child list and, along with its descendants,
from the list of all nodes contained in event.
|
(package private) static void |
scanStructure(EvioNode node)
This method recursively stores, in the given list, all the information
about an evio structure's children found in the given ByteBuffer object.
|
(package private) static void |
scanStructure(EvioNode node,
EvioNodeSource nodeSource)
This method recursively stores, in the given list, all the information
about an evio structure's children found in the given ByteBuffer object.
|
void |
setBuffer(java.nio.ByteBuffer buf)
Set the buffer.
|
(package private) void |
setData(int position,
int place,
java.nio.ByteBuffer buffer,
BlockNode blockNode)
Once this node is cleared, it may be reused and then re-initialized
with this method.
|
(package private) void |
setData(int position,
int place,
int recordPos,
java.nio.ByteBuffer buffer)
Once this node is cleared, it may be reused and then re-initialized
with this method.
|
void |
setObsolete(boolean obsolete)
Set whether this node and descendants are now obsolete because the
data they represent in the buffer has been removed.
|
EvioNode |
shift(int deltaPos)
Shift the positions (pos, dataPos, and recordPos) of this node and its
children by a fixed amount.
|
java.lang.String |
toString()
Return a String representation of this object.
|
void |
updateLengths(int deltaLen)
Update the length of this node in the buffer and all its parent nodes as well.
|
void |
updateNum(int newNum)
Update, in the buffer, the num of the bank header this object represents.
|
void |
updateTag(int newTag)
Update, in the buffer, the tag of the structure header this object represents.
|
int len
int tag
int num
int pad
int pos
int type
int dataLen
int dataPos
int dataType
int recordPos
int[] data
boolean isEvent
boolean obsolete
public BlockNode blockNode
java.nio.ByteBuffer buffer
java.util.ArrayList<EvioNode> childNodes
int place
boolean scanned
java.util.ArrayList<EvioNode> allNodes
EvioNode eventNode
EvioNode parentNode
int poolId
public EvioNode()
EvioNode(EvioNode firstNode)
firstNode
- node of event containing this node or null if this is an event node.public EvioNode(int pos, int place, java.nio.ByteBuffer buffer, BlockNode blockNode)
pos
- position of event in buffer (number of bytes)place
- containing event's place in buffer (starting at 0)buffer
- buffer containing this eventblockNode
- block containing this eventpublic EvioNode(int pos, int place, int recordPos, java.nio.ByteBuffer buffer)
pos
- position of event in buffer (number of bytes).place
- containing event's place in buffer (starting at 0).recordPos
- position of record containing this node.buffer
- buffer containing this event.EvioNode(int tag, int num, int pos, int dataPos, DataType type, DataType dataType, java.nio.ByteBuffer buffer)
tag
- the tag for the event (or bank) header.num
- the num for the event (or bank) header.pos
- position of event in buffer (bytes).dataPos
- position of event's data in buffer (bytes.)type
- the type of this evio structure.dataType
- the data type contained in this evio event.buffer
- buffer containing this event.public final EvioNode shift(int deltaPos)
deltaPos
- number of bytes to add to existing positions.public final java.lang.Object clone()
clone
in class java.lang.Object
public final java.lang.String toString()
toString
in class java.lang.Object
public final void clearLists()
public final void clear()
public final void clearObjects()
public final void clearAll()
public final void clearIntArray()
public void setBuffer(java.nio.ByteBuffer buf)
buf
- buffer associated with this object.void setData(int position, int place, java.nio.ByteBuffer buffer, BlockNode blockNode)
position
- position in bufferplace
- place of event in buffer (starting at 0)buffer
- buffer to examineblockNode
- object holding data about header of block containing eventvoid setData(int position, int place, int recordPos, java.nio.ByteBuffer buffer)
position
- position in bufferplace
- place of event in buffer (starting at 0)recordPos
- place of event in containing record (bytes)buffer
- buffer to examinepublic static final EvioNode extractEventNode(java.nio.ByteBuffer buffer, EvioNodeSource pool, BlockNode blockNode, int position, int place) throws EvioException
buffer
- buffer to examinepool
- pool of EvioNode objectsblockNode
- object holding data about block headerposition
- position in bufferplace
- place of event in buffer (starting at 0)EvioException
- if file/buffer too smallpublic static final EvioNode extractEventNode(java.nio.ByteBuffer buffer, EvioNodeSource pool, int recPosition, int position, int place) throws EvioException
buffer
- buffer to examinepool
- pool of EvioNode objectsrecPosition
- position of containing recordposition
- position in bufferplace
- place of event in buffer (starting at 0)EvioException
- if file/buffer too smallpublic static final EvioNode extractNode(EvioNode bankNode, int position) throws EvioException
bankNode
- EvioNode to represent a bank and containing,
at least, a reference to backing buffer.position
- position in backing bufferEvioException
- if file/buffer too smallstatic final void scanStructure(EvioNode node)
node
- node being scannedstatic final void scanStructure(EvioNode node, EvioNodeSource nodeSource)
node
- node being scannednodeSource
- source of EvioNode objects to use while parsing evio data.final void addChild(EvioNode node)
EvioCompactReader.addStructure(int, ByteBuffer)
, the structure or node
gets added at the very end - as the last child of the event.node
- child node to add to the end of the child list.final void removeChild(EvioNode node)
node
- node to remove from child and allNodes lists.final BlockNode getBlockNode()
public final boolean isObsolete()
public final void setObsolete(boolean obsolete)
obsolete
- true if node and descendants no longer represent valid
buffer data, else false.public final java.util.ArrayList<EvioNode> getAllNodes()
public final java.util.ArrayList<EvioNode> getChildNodes()
public final void getAllDescendants(java.util.List<EvioNode> descendants)
descendants
- list to be filled with EvioNodes of all descendantspublic final EvioNode getChildAt(int index)
index
- index of child nodepublic final int getChildCount()
public final java.nio.ByteBuffer getBuffer()
public final int getLength()
public final int getTotalBytes()
public final int getTag()
public final int getNum()
public final int getPad()
public final int getPosition()
public final int getType()
DataType.getDataType(int)
on the
returned value to get the object representation.public final DataType getTypeObj()
public final int getDataLength()
public final int getDataPosition()
public final int getDataType()
DataType.getDataType(int)
on the
returned value to get the object representation.public final DataType getDataTypeObj()
public int getRecordPosition()
public final int getPlace()
public final EvioNode getParentNode()
public final int getEventNumber()
public final boolean isEvent()
true
if this object represents an event,
else false
public final void updateLengths(int deltaLen)
deltaLen
- change in length (words). Negative value reduces lengths.public final void updateTag(int newTag)
newTag
- new tag valuepublic final void updateNum(int newNum)
newNum
- new num valuepublic final java.nio.ByteBuffer getByteData(boolean copy)
This method is not synchronized.
copy
- if true
, then return a copy as opposed to a
view into this node's buffer.public final int[] getIntData()
getByteData(boolean)
and converting
it to an int array which involves creating additional objects and calling
additional methods.
This method is not synchronized.public final int[] getIntData(int[] intData, int[] length)
getByteData(boolean)
and converting
it to an int array which involves creating additional objects and calling
additional methods.
This method is not synchronized.
This method is only used in Evio.java in emu package.intData
- integer array in which to store data.length
- set first element to contain number of valid array elements of the returned array.public final long[] getLongData()
getByteData(boolean)
and converting
it to a long array which involves creating additional objects and calling
additional methods.
This method is not synchronized.public final long[] getLongData(long[] longData, int[] length)
getByteData(boolean)
and converting
it to an long array which involves creating additional objects and calling
additional methods.
This method is not synchronized.longData
- long array in which to store data.length
- set first element to contain number of valid array elements of the returned array.public final short[] getShortData()
getByteData(boolean)
and converting
it to a short array which involves creating additional objects and calling
additional methods.
This method is not synchronized.public final short[] getShortData(short[] shortData, int[] length)
getByteData(boolean)
and converting
it to an short array which involves creating additional objects and calling
additional methods.
This method is not synchronized.shortData
- short array in which to store data.length
- set first element to contain number of valid array elements of the returned array.public final java.nio.ByteBuffer getStructureBuffer(boolean copy)
This method is not synchronized.
copy
- if true
, then return a copy as opposed to a
view into this node's buffer.