|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jlab.coda.jevio.BaseStructure
public abstract class BaseStructure
This is the base class for all evio structures: Banks, Segments, and TagSegments. It implements
MutableTreeNode
because a tree representation of events is created when a new event is parsed.
Constructor Summary | |
---|---|
BaseStructure(BaseStructureHeader header)
Constructor using a provided header |
Method Summary | |
---|---|
void |
appendByteData(byte[] data)
Appends byte data to the structure. |
void |
appendCharData(char[] data)
Appends char data to the structure (as ascii). |
void |
appendDoubleData(double[] data)
Appends double data to the structure. |
void |
appendFloatData(float[] data)
Appends float data to the structure. |
void |
appendIntData(int[] data)
Appends int data to the structure. |
void |
appendLongData(long[] data)
Appends long data to the structure. |
void |
appendShortData(short[] data)
Appends short data to the structure. |
java.util.Enumeration<?> |
children()
Get an enumeration of all the children of this structure. |
boolean |
getAllowsChildren()
Checks whether children are allowed. |
byte[] |
getByteData()
This is a method from the IEvioStructure Interface. |
java.nio.ByteOrder |
getByteOrder()
What is the byte order of this data? |
javax.swing.tree.TreeNode |
getChildAt(int index)
Obtain the child at the given index. |
int |
getChildCount()
Get the count of the number of children. |
java.util.Vector<BaseStructure> |
getChildren()
Get the children of this structure. |
java.lang.String |
getDescription()
Get the description from the name provider (dictionary), if there is one. |
double[] |
getDoubleData()
This is a method from the IEvioStructure Interface. |
float[] |
getFloatData()
This is a method from the IEvioStructure Interface. |
BaseStructureHeader |
getHeader()
This is a method from the IEvioStructure Interface. |
int |
getIndex(javax.swing.tree.TreeNode node)
Get the index of a node. |
int[] |
getIntData()
This is a method from the IEvioStructure Interface. |
long[] |
getLongData()
This is a method from the IEvioStructure Interface. |
BaseStructure |
getParent()
Get the parent of this structure. |
byte[] |
getRawBytes()
Get the raw data of the structure. |
short[] |
getShortData()
This is a method from the IEvioStructure Interface. |
java.lang.String |
getStringData()
This is a method from the IEvioStructure Interface. |
abstract StructureType |
getStructureType()
A convenience method use instead of "instanceof" to see what type of structure we have. |
int |
getTotalBytes()
Get the length of this structure in bytes, including the header. |
abstract java.lang.String |
getXMLElementName()
Get the element name for the structure for writing to XML. |
void |
insert(javax.swing.tree.MutableTreeNode child)
Convenience method to add a child at the end of the child list. |
void |
insert(javax.swing.tree.MutableTreeNode child,
int index)
Add a child at the given index. |
boolean |
isContainer()
Checks whether this structure is a container, i.e. |
boolean |
isLeaf()
Checks whether this is a leaf. |
boolean |
isSwap()
Is a byte swap required? Since this is java, code is big endian. |
void |
remove(int index)
Removes the child at index from the receiver. |
void |
remove(javax.swing.tree.MutableTreeNode child)
Removes the child. |
void |
removeFromParent()
Remove this node from its parent. |
int |
setAllHeaderLengths()
Compute the and set length of all header fields for this structure and all its descendants. |
void |
setByteOrder(java.nio.ByteOrder byteOrder)
Set the byte order of this data. |
void |
setParent(javax.swing.tree.MutableTreeNode parent)
Set the parent for this node. |
void |
setRawBytes(byte[] rawBytes)
Set the data for the structure. |
void |
setUserObject(java.lang.Object arg0)
This method is not relevant for this implementation. |
java.lang.String |
toString()
Obtain a string representation of the structure. |
abstract void |
toXML(javax.xml.stream.XMLStreamWriter xmlWriter)
This is a method that must be filled in by subclasses. |
int |
write(java.nio.ByteBuffer byteBuffer)
Write myself out a byte buffer. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BaseStructure(BaseStructureHeader header)
header
- the header to use.BaseStructureHeader
Method Detail |
---|
public abstract StructureType getStructureType()
getStructureType
in interface IEvioStructure
StructureType
of this structure.StructureType
public abstract void toXML(javax.xml.stream.XMLStreamWriter xmlWriter)
xmlWriter
- the writer used to write the events. It is tied to an open file.public abstract java.lang.String getXMLElementName()
public java.nio.ByteOrder getByteOrder()
ByteOrder.BIG_ENDIAN
or ByteOrder.LITTLE_ENDIAN
public void setByteOrder(java.nio.ByteOrder byteOrder)
byteOrder
- ByteOrder.BIG_ENDIAN
or ByteOrder.LITTLE_ENDIAN
public boolean isSwap()
true
if byte swapping is required (data is little endian).public java.lang.String getDescription()
getDescription
in interface IEvioStructure
public java.lang.String toString()
toString
in class java.lang.Object
public BaseStructureHeader getHeader()
getHeader
in interface IEvioStructure
public int getTotalBytes()
public byte[] getRawBytes()
public void setRawBytes(byte[] rawBytes)
rawBytes
- the structure raw data.public int[] getIntData()
getIntData
in interface IEvioStructure
null
if this makes no sense for the given content type.public long[] getLongData()
getLongData
in interface IEvioStructure
null
if this makes no sense for the given content type.public float[] getFloatData()
getFloatData
in interface IEvioStructure
null
if this makes no sense for the given contents type.public double[] getDoubleData()
getDoubleData
in interface IEvioStructure
null
if this makes no sense for the given content type.public short[] getShortData()
getShortData
in interface IEvioStructure
null
if this makes no sense for the given contents type.public byte[] getByteData()
getByteData
in interface IEvioStructure
null
if this makes no sense for the given contents type.public java.lang.String getStringData()
getStringData
in interface IEvioStructure
null
if this makes no sense for the given type.public BaseStructure getParent()
null
parent (the only orphan). All other structures have non-null parent giving the container in which they
were embedded. Part of the MutableTreeNode
interface.
getParent
in interface javax.swing.tree.TreeNode
public java.util.Enumeration<?> children()
MutableTreeNode
interface.
children
in interface javax.swing.tree.TreeNode
public void insert(javax.swing.tree.MutableTreeNode child, int index)
insert
in interface javax.swing.tree.MutableTreeNode
child
- the child to add.index
- the target index. Part of the MutableTreeNode
interface.public void insert(javax.swing.tree.MutableTreeNode child)
child
- the child to add. It will be added to the end of child list.public void remove(int index)
MutableTreeNode
interface.
remove
in interface javax.swing.tree.MutableTreeNode
index
- the target index for removal.public void remove(javax.swing.tree.MutableTreeNode child)
MutableTreeNode
interface.
remove
in interface javax.swing.tree.MutableTreeNode
child
- the child node being removed.public void removeFromParent()
MutableTreeNode
interface.
removeFromParent
in interface javax.swing.tree.MutableTreeNode
public void setParent(javax.swing.tree.MutableTreeNode parent)
MutableTreeNode
interface.
setParent
in interface javax.swing.tree.MutableTreeNode
public void setUserObject(java.lang.Object arg0)
MutableTreeNode
interface.
setUserObject
in interface javax.swing.tree.MutableTreeNode
public boolean getAllowsChildren()
MutableTreeNode
interface.
getAllowsChildren
in interface javax.swing.tree.TreeNode
true
if this node does not hold primitive data,
i.e., if it is a structure of structures (a container).public javax.swing.tree.TreeNode getChildAt(int index)
MutableTreeNode
interface.
getChildAt
in interface javax.swing.tree.TreeNode
index
- the target index.
public int getChildCount()
MutableTreeNode
interface.
getChildCount
in interface javax.swing.tree.TreeNode
public int getIndex(javax.swing.tree.TreeNode node)
MutableTreeNode
interface.
getIndex
in interface javax.swing.tree.TreeNode
public boolean isLeaf()
MutableTreeNode
interface.
isLeaf
in interface javax.swing.tree.TreeNode
true
if this is a structure with a primitive data type, i.e., it is not a container
structure that contains other structures.public boolean isContainer()
true
if this structure is a container. This is the same check as
getAllowsChildren()
.public java.util.Vector<BaseStructure> getChildren()
public int setAllHeaderLengths()
public int write(java.nio.ByteBuffer byteBuffer)
write
in interface IEvioWriter
byteBuffer
- the byteBuffer to write to.
public void appendIntData(int[] data) throws EvioException
data
- the int data to append, or set if there is no existing data.
EvioException
public void appendShortData(short[] data) throws EvioException
data
- the short data to append, or set if there is no existing data.
EvioException
public void appendLongData(long[] data) throws EvioException
data
- the long data to append, or set if there is no existing data.
EvioException
public void appendByteData(byte[] data) throws EvioException
data
- the byte data to append, or set if there is no existing data.
EvioException
public void appendFloatData(float[] data) throws EvioException
data
- the float data to append, or set if there is no existing data.
EvioException
public void appendCharData(char[] data) throws EvioException
data
- the char data to append (as ascii), or set if there is no existing data.
EvioException
public void appendDoubleData(double[] data) throws EvioException
data
- the double data to append, or set if there is no existing data.
EvioException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |