public class EvioNode
extends java.lang.Object
implements java.lang.Cloneable
Modifier and Type | Field and Description |
---|---|
BlockNode |
blockNode
Block containing this node.
|
Constructor and Description |
---|
EvioNode()
Constructor when fancy features not needed.
|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
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?
|
void |
setBuffer(java.nio.ByteBuffer buf)
Set the buffer.
|
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.
|
public BlockNode blockNode
public EvioNode()
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.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.public 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 smallpublic 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.