org.jlab.coda.jevio
Class EvioXMLDictionary

java.lang.Object
  extended by org.jlab.coda.jevio.EvioXMLDictionary
All Implemented Interfaces:
INameProvider

public class EvioXMLDictionary
extends java.lang.Object
implements INameProvider

This was developed to read the xml dictionary that Maurizio uses for GEMC. It implements INameProvider, just like all other dictionary readers. An assumption in the following class is that each unique tag/num pair corresponds to an equally unique name. In other words, 2 different tag/numm pairs cannot have the same name.

Author:
heddle, timmer

Field Summary
 
Fields inherited from interface org.jlab.coda.jevio.INameProvider
NO_NAME_STRING
 
Constructor Summary
EvioXMLDictionary(org.w3c.dom.Document domDocument)
          Create an EvioXMLDictionary from an xml Document object.
EvioXMLDictionary(org.w3c.dom.Document domDocument, java.lang.String delimiter)
          Create an EvioXMLDictionary from an xml Document object.
EvioXMLDictionary(java.io.File file)
          Create an EvioXMLDictionary from an xml file.
EvioXMLDictionary(java.io.File file, java.lang.String delimiter)
          Create an EvioXMLDictionary from an xml file.
EvioXMLDictionary(java.lang.String xmlString)
          Create an EvioXMLDictionary from an xml string.
EvioXMLDictionary(java.lang.String xmlString, java.lang.String delimiter)
          Create an EvioXMLDictionary from an xml string.
 
Method Summary
 java.lang.String getName(BaseStructure structure)
          Returns the name of a given evio structure.
 java.lang.String getName(int tag, int num)
          Returns the name associated with the given tag and num.
 int[] getTagNum(java.lang.String name)
          Returns the tag/num pair, in an int array, corresponding to the name of a dictionary entry.
 java.lang.String toString()
          Get a string representation of the dictionary.
 java.lang.String toXML()
          Get an xml representation of the dictionary.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EvioXMLDictionary

public EvioXMLDictionary(java.io.File file)
Create an EvioXMLDictionary from an xml file.

Parameters:
file - file containing xml.

EvioXMLDictionary

public EvioXMLDictionary(java.io.File file,
                         java.lang.String delimiter)
Create an EvioXMLDictionary from an xml file.

Parameters:
file - file containing xml.
delimiter - character used to separate hierarchical parts of names.

EvioXMLDictionary

public EvioXMLDictionary(java.lang.String xmlString)
Create an EvioXMLDictionary from an xml string.

Parameters:
xmlString - string containing xml.

EvioXMLDictionary

public EvioXMLDictionary(java.lang.String xmlString,
                         java.lang.String delimiter)
Create an EvioXMLDictionary from an xml string.

Parameters:
xmlString - string containing xml.
delimiter - character used to separate hierarchical parts of names.

EvioXMLDictionary

public EvioXMLDictionary(org.w3c.dom.Document domDocument)
Create an EvioXMLDictionary from an xml Document object.

Parameters:
domDocument - DOM object representing xml dictionary.

EvioXMLDictionary

public EvioXMLDictionary(org.w3c.dom.Document domDocument,
                         java.lang.String delimiter)
Create an EvioXMLDictionary from an xml Document object.

Parameters:
domDocument - DOM object representing xml dictionary.
delimiter - character used to separate hierarchical parts of names.
Method Detail

getName

public java.lang.String getName(BaseStructure structure)
Returns the name of a given evio structure.

Specified by:
getName in interface INameProvider
Parameters:
structure - the structure to find the name of.
Returns:
a descriptive name or ??? if none found

getName

public java.lang.String getName(int tag,
                                int num)
Returns the name associated with the given tag and num.

Parameters:
tag - to find the name of
num - to find the name of
Returns:
a descriptive name or ??? if none found

getTagNum

public int[] getTagNum(java.lang.String name)
Returns the tag/num pair, in an int array, corresponding to the name of a dictionary entry.

Parameters:
name - dictionary name
Returns:
an integer array in which the first element is the tag and the second is the num; null if name is unknown

toXML

public java.lang.String toXML()
Get an xml representation of the dictionary.

Returns:
an xml representation of the dictionary.

toString

public java.lang.String toString()
Get a string representation of the dictionary.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the dictionary.