org.jlab.coda.jevio
Class StructureFinder

java.lang.Object
  extended by org.jlab.coda.jevio.StructureFinder

public class StructureFinder
extends java.lang.Object

This is a set of convenient static methods used to find lists of structures within an event, bank, segment, or tagsegment that match certain criteria. For the most part it uses the List getMatchingStructures(IEvioFilter) method on the provided EvioEvent object by constructing the appropriate filter.

Author:
heddle, timmer

Constructor Summary
StructureFinder()
           
 
Method Summary
static java.util.List<BaseStructure> getMatchingBanks(BaseStructure structure, int tag, int number)
          Collect all the banks in an event that match a provided tag and number in their header.
static java.util.List<BaseStructure> getMatchingChild(BaseStructure structure, java.lang.String childName, INameProvider dictionary)
          Collect all structures in an event who has a child with the given dictionary name.
static java.util.List<BaseStructure> getMatchingNonBanks(BaseStructure structure, int tag)
          Collect all the non-banks (i.e., Segments and TagSegments) in an event that match a provided tag in their header.
static java.util.List<BaseStructure> getMatchingParent(BaseStructure structure, java.lang.String parentName, INameProvider dictionary)
          Collect all structures in an event whose parent has the given dictionary name.
static java.util.List<BaseStructure> getMatchingStructures(BaseStructure structure, IEvioFilter filter)
          Collect all the structures in an event that pass a filter.
static java.util.List<BaseStructure> getMatchingStructures(BaseStructure structure, int tag)
          Collect all the structures in an event that match a provided tag in their header.
static java.util.List<BaseStructure> getMatchingStructures(BaseStructure structure, java.lang.String name, INameProvider dictionary)
          Collect all structures in an event that match the given dictionary name.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StructureFinder

public StructureFinder()
Method Detail

getMatchingStructures

public static java.util.List<BaseStructure> getMatchingStructures(BaseStructure structure,
                                                                  IEvioFilter filter)
Collect all the structures in an event that pass a filter.

Parameters:
structure - the event/bank/seg/tagseg being queried.
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 for the provided event.

getMatchingBanks

public static java.util.List<BaseStructure> getMatchingBanks(BaseStructure structure,
                                                             int tag,
                                                             int number)
Collect all the banks in an event that match a provided tag and number in their header. Only Banks are returned, because only Banks have a number field.

Parameters:
structure - the event/bank/seg/tagseg being queried.
tag - the tag to match.
number - the number to match.
Returns:
a collection of all Banks that are accepted by a filter for the provided event.

getMatchingStructures

public static java.util.List<BaseStructure> getMatchingStructures(BaseStructure structure,
                                                                  int tag)
Collect all the structures in an event that match a provided tag in their header.

Parameters:
structure - the event/bank/seg/tagseg being queried.
tag - the tag to match.
Returns:
a collection of all structures that are accepted by a filter for the provided event.

getMatchingNonBanks

public static java.util.List<BaseStructure> getMatchingNonBanks(BaseStructure structure,
                                                                int tag)
Collect all the non-banks (i.e., Segments and TagSegments) in an event that match a provided tag in their header. No Banks are returned.

Parameters:
structure - the event/bank/seg/tagseg being queried.
tag - the tag to match.
Returns:
a collection of all non-bank structures that are accepted by a filter for the provided event.

getMatchingStructures

public static java.util.List<BaseStructure> getMatchingStructures(BaseStructure structure,
                                                                  java.lang.String name,
                                                                  INameProvider dictionary)
                                                           throws EvioException
Collect all structures in an event that match the given dictionary name.

Parameters:
structure - the event/bank/seg/tagseg being queried.
name - dictionary name of structures to be returned.
dictionary - dictionary to be used; if null, an existing global dictionary will be used.
Returns:
a list of BaseStructures that have the given name
Throws:
EvioException - if no dictionary is defined

getMatchingParent

public static java.util.List<BaseStructure> getMatchingParent(BaseStructure structure,
                                                              java.lang.String parentName,
                                                              INameProvider dictionary)
                                                       throws EvioException
Collect all structures in an event whose parent has the given dictionary name.

Parameters:
structure - the event/bank/seg/tagseg being queried.
parentName - dictionary name of parent of structures to be returned.
dictionary - dictionary to be used; if null, an existing global dictionary will be used.
Returns:
a list of BaseStructures whose parent has the given name
Throws:
EvioException - if no dictionary is defined

getMatchingChild

public static java.util.List<BaseStructure> getMatchingChild(BaseStructure structure,
                                                             java.lang.String childName,
                                                             INameProvider dictionary)
                                                      throws EvioException
Collect all structures in an event who has a child with the given dictionary name.

Parameters:
structure - the event/bank/seg/tagseg being queried.
childName - dictionary name of a child of structures to be returned.
dictionary - dictionary to be used; if null, an existing global dictionary will be used.
Returns:
a list of BaseStructures who has a child with the given name
Throws:
EvioException - if no dictionary is defined