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:
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.
EvioEvent(int tag, int dataType, int num)
          This is a general constructor to use for an EvioEvent.
 
Method Summary
 int getEventNumber()
          This returns a number [1..] indicating which event this was in the event file from which it was read.
 java.util.List<BaseStructure> getMatchingStructures(IEvioFilter filter)
          Visit all the descendant structures, and collect those that pass a filter.
 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.
 void insert(BaseStructure child, BaseStructure parent)
          Inserts a child structure into the event's JTree.
 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.
 void vistAllStructures(IEvioListener listener)
          Visit all the structures in this event (including the event itself--which is considered its own descendant).
 void vistAllStructures(IEvioListener listener, IEvioFilter filter)
          Visit all the structures in this event (including the event itself--which is considered its own descendant) in a depth first manner.
 
Methods inherited from class org.jlab.coda.jevio.EvioBank
getStructureType
 
Methods inherited from class org.jlab.coda.jevio.BaseStructure
appendByteData, appendCharData, appendDoubleData, appendFloatData, appendIntData, appendLongData, appendShortData, children, getAllowsChildren, getByteData, getByteOrder, getChildAt, getChildCount, getChildren, getDescription, getDoubleData, getFloatData, getHeader, getIndex, getIntData, getLongData, getParent, getRawBytes, getShortData, getStringData, getTotalBytes, insert, insert, isContainer, isLeaf, isSwap, remove, remove, removeFromParent, setAllHeaderLengths, setByteOrder, setParent, setRawBytes, setUserObject, 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.

EvioEvent

public EvioEvent(int tag,
                 int 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 (int) data type for the content of the bank.
num - sometimes, but not necessarily, an ordinal enumeration.
Method Detail

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.

vistAllStructures

public void vistAllStructures(IEvioListener listener)
Visit all the structures in this event (including the event itself--which is considered its own descendant). This is similar to listening to the event as it is being parsed, but is done to a complete (already) parsed event.

Parameters:
listener - an listener to notify as each structure is visited.

vistAllStructures

public void vistAllStructures(IEvioListener listener,
                              IEvioFilter filter)
Visit all the structures in this event (including the event itself--which is considered its own descendant) in a depth first manner.

Parameters:
listener - an listener to notify as each structure is visited.
filter - an optional filter that must "accept" structures before they are passed to the listener. If null, all structures are passed. In this way, specific types of structures can be captured.

getMatchingStructures

public java.util.List<BaseStructure> getMatchingStructures(IEvioFilter filter)
Visit all the descendant structures, and collect those that pass a filter.

Parameters:
filter - the filter that must be passed. If null, this will return all the structures.
Returns:
a collection of all structures that are accepted by a filter.

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.