org.jlab.coda.jevio
Class EvioEvent

java.lang.Object
  extended by org.jlab.coda.jevio.BaseStructure
      extended by org.jlab.coda.jevio.EvioBank
          extended by org.jlab.coda.jevio.EvioEvent
All Implemented Interfaces:
java.lang.Cloneable, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode, IEvioStructure, IEvioWriter

public class EvioEvent
extends EvioBank

An event is really just the outer, primary bank. That is, the first structure in an event (aka logical record, aka buffer) must be a bank, probably a bank of banks. The Event trivially extends bank, just so there can be a distinct EvioEvent class, for clarity.

Author:
heddle

Field Summary
static java.lang.String ELEMENT_NAME
          The XML record tag for an event.
 
Constructor Summary
EvioEvent()
          Explicit null constructor for evio event.
EvioEvent(BankHeader bankHeader)
          Constructor using a provided BankHeader.
EvioEvent(int tag, DataType dataType, int num)
          This is a general constructor to use for an EvioEvent.
 
Method Summary
 java.lang.Object clone()
          Deep clone of BaseStructure does most of the work.
 java.lang.String getDictionaryXML()
          Get the XML dictionary associated with this event if there is one.
 int getEventNumber()
          This returns a number [1..] indicating which event this was in the event file from which it was read.
 javax.swing.tree.DefaultTreeModel getTreeModel()
          Get the tree model representing this event.
 java.lang.String getXMLElementName()
          Get the element name for the bank for writing to XML.
 boolean hasDictionaryXML()
          Is there an XML dictionary associated with this event?
 void insert(BaseStructure child, BaseStructure parent)
          Inserts a child structure into the event's JTree.
 void setDictionaryXML(java.lang.String dictionaryXML)
          Set the XML dictionary associated with this event.
 void setEventNumber(int eventNumber)
          This sets a number [1..] indicating which event this was in the event file from which it was read.
 java.lang.String toString()
          Create a string representation of the event.
 void toXML(javax.xml.stream.XMLStreamWriter xmlWriter)
          Write this event structure out as an XML record.
 
Methods inherited from class org.jlab.coda.jevio.EvioBank
getAttachment, getStructureType, setAttachment
 
Methods inherited from class org.jlab.coda.jevio.BaseStructure
appendByteData, appendCompositeData, appendDoubleData, appendFloatData, appendIntData, appendLongData, appendShortData, appendStringData, children, getAllowsChildren, getByteData, getByteOrder, getChildAt, getChildCount, getChildren, getCompositeData, getDescription, getDoubleData, getFloatData, getHeader, getIndex, getIntData, getLongData, getMatchingStructures, getNumberDataItems, getParent, getRawBytes, getShortData, getStringData, getTotalBytes, insert, insert, isContainer, isLeaf, isSwap, remove, remove, removeFromParent, setAllHeaderLengths, setByteData, setByteOrder, setCompositeData, setDoubleData, setFloatData, setIntData, setLongData, setParent, setRawBytes, setShortData, setStringData, setUserObject, stringsToRawBytes, stringsToRawSize, toXML, transform, unpackRawBytesToStrings, vistAllStructures, vistAllStructures, write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ELEMENT_NAME

public static final java.lang.String ELEMENT_NAME
The XML record tag for an event.

See Also:
Constant Field Values
Constructor Detail

EvioEvent

public EvioEvent()
Explicit null constructor for evio event.


EvioEvent

public EvioEvent(BankHeader bankHeader)
Constructor using a provided BankHeader.

Parameters:
bankHeader - the header to use.
See Also:
BankHeader

EvioEvent

public EvioEvent(int tag,
                 DataType dataType,
                 int num)
This is a general constructor to use for an EvioEvent.

Parameters:
tag - the tag for the event header (which is just a bank header).
dataType - the (enum) data type for the content of the bank.
num - sometimes, but not necessarily, an ordinal enumeration.
Method Detail

clone

public java.lang.Object clone()
Deep clone of BaseStructure does most of the work. Leave EvioBank's attachment as a reference. Only thing we need to do get rid of any cloned treeModel.

Overrides:
clone in class BaseStructure

hasDictionaryXML

public boolean hasDictionaryXML()
Is there an XML dictionary associated with this event?

Returns:
true if there is an XML dictionary associated with this event, else false

getDictionaryXML

public java.lang.String getDictionaryXML()
Get the XML dictionary associated with this event if there is one.

Returns:
the XML dictionary associated with this event if there is one, else null

setDictionaryXML

public void setDictionaryXML(java.lang.String dictionaryXML)
Set the XML dictionary associated with this event.

Parameters:
dictionaryXML - the XML dictionary associated with this event.

toString

public java.lang.String toString()
Create a string representation of the event.

Overrides:
toString in class BaseStructure
Returns:
a string representation of the event.

getTreeModel

public javax.swing.tree.DefaultTreeModel getTreeModel()
Get the tree model representing this event. This would have been generated as the event was being parsed.

Returns:
the tree model representing this event.

insert

public void insert(BaseStructure child,
                   BaseStructure parent)
Inserts a child structure into the event's JTree. This is called when the event is being parsed, and when an event is being created.

Parameters:
child - the child structure being added to the tree.
parent - the parent structure of the new child.

getEventNumber

public int getEventNumber()
This returns a number [1..] indicating which event this was in the event file from which it was read. It is not the "num" field from the header.

Returns:
a number [1..] indicating which event this was in the event file from which it was read.

setEventNumber

public void setEventNumber(int eventNumber)
This sets a number [1..] indicating which event this was in the event file from which it was read. It is not the "num" field from the header.

Parameters:
eventNumber - a number [1..] indicating which event this was in the event file from which it was read.

toXML

public void toXML(javax.xml.stream.XMLStreamWriter xmlWriter)
Write this event structure out as an XML record.

Overrides:
toXML in class EvioBank
Parameters:
xmlWriter - the writer used to write the events.

getXMLElementName

public java.lang.String getXMLElementName()
Get the element name for the bank for writing to XML.

Overrides:
getXMLElementName in class EvioBank
Returns:
the element name for the structure for writing to XML.