Token2.java

Go to the documentation of this file.
00001 package edu.rice.cs.hpc.data.experiment.xml;
00002 
00003 import java.util.Map;
00004 import java.util.HashMap;
00005 
00006 public class Token2 {
00007     // to add a new token, declare a new element in the enum TokenXML
00008     // and add an appropriate `put' invocation in the static constructor,
00009     // which you may find below.  a benefit of doing it this way is that
00010     // if the element names happen to change, we can simply add aliases
00011     // for them here.  it also looks a lot cleaner with a Map than
00012 
00013     static public enum TokenXML {
00014         T_INVALID_ELEMENT_NAME,
00015         
00016         T_HPCTOOLKIT_EXPERIMENT,
00017         // header
00018         T_HEADER, T_INFO, T_NAME_VALUE,
00019         // section
00020         T_SEC_CALLPATH_PROFILE, T_SEC_HEADER,
00021         // data
00022         T_SEC_CALLPATH_PROFILE_DATA, 
00023         T_CALLPATH_PROFILE_DATA,// @deprecated
00024         T_PR, T_PF, T_L, T_C, T_S,
00025         // metrics
00026         T_METRIC_TABLE, T_METRIC, T_METRIC_FORMULA, T_M,
00027         T_METRIC_RAW_TABLE, T_METRIC_RAW,
00028         
00029         // trace database
00030         T_TRACE_DB_TABLE, T_TRACE_DB,
00031         
00032         // procedures
00033         T_PROCEDURE_TABLE, T_PROCEDURE, 
00034         // files
00035         T_FILE_TABLE, T_FILE, 
00036         // load modules
00037         T_LOAD_MODULE_TABLE, T_LOAD_MODULE, 
00038         T_SEC_FLAT_PROFILE, T_SEC_FLAT_PROFILE_DATA,
00039         // flat data
00040         T_LM, T_F, T_A, T_P,
00041         
00042         // token for old XML file
00043         T_CSPROFILE, T_HPCVIEWER,
00044         
00045         // token for XML v. 3.0
00046         T_SUMMARY_DB_FILE, T_TRACE_DB_FILE, T_PLOT_DB_FILE
00047     }
00048     
00049     private static Map<String, TokenXML> tokenMap;
00050 
00051     static {
00052         tokenMap = new HashMap<String, TokenXML>();
00053 
00054         // additional information tags
00055         tokenMap.put("Info", TokenXML.T_INFO);
00056         tokenMap.put("NV",   TokenXML.T_NAME_VALUE);
00057         
00058         // metrics
00059         tokenMap.put("Metric",        TokenXML.T_METRIC);
00060         tokenMap.put("MetricTable",   TokenXML.T_METRIC_TABLE);
00061         tokenMap.put("MetricFormula", TokenXML.T_METRIC_FORMULA);
00062         tokenMap.put("M",             TokenXML.T_M);
00063         tokenMap.put("MetricDBTable", TokenXML.T_METRIC_RAW_TABLE);
00064         tokenMap.put("MetricDB",      TokenXML.T_METRIC_RAW);
00065         
00066         // trace database
00067         tokenMap.put("TraceDBTable", TokenXML.T_TRACE_DB_TABLE);
00068         tokenMap.put("TraceDB",      TokenXML.T_TRACE_DB);
00069 
00070         // head of xml
00071         tokenMap.put("HPCToolkitExperiment", TokenXML.T_HPCTOOLKIT_EXPERIMENT);
00072         tokenMap.put("Header",               TokenXML.T_HEADER);
00073         tokenMap.put("SecCallPathProfile",   TokenXML.T_SEC_CALLPATH_PROFILE);
00074         tokenMap.put("SecHeader",            TokenXML.T_SEC_HEADER);
00075         
00076         tokenMap.put("LoadModuleTable", TokenXML.T_LOAD_MODULE_TABLE);
00077         tokenMap.put("LoadModule",      TokenXML.T_LOAD_MODULE);
00078         tokenMap.put("FileTable",       TokenXML.T_FILE_TABLE);
00079         tokenMap.put("File",            TokenXML.T_FILE);
00080         tokenMap.put("ProcedureTable",  TokenXML.T_PROCEDURE_TABLE);
00081         tokenMap.put("Procedure",       TokenXML.T_PROCEDURE);
00082         
00083         tokenMap.put("SecCallPathProfileData", TokenXML.T_SEC_CALLPATH_PROFILE_DATA);
00084         tokenMap.put("CallPathProfileData",    TokenXML.T_CALLPATH_PROFILE_DATA);   // @deprecated
00085         tokenMap.put("Pr", TokenXML.T_PR);
00086         tokenMap.put("PF", TokenXML.T_PF);
00087         tokenMap.put("L",  TokenXML.T_L);
00088         tokenMap.put("C",  TokenXML.T_C);
00089         tokenMap.put("S",  TokenXML.T_S);
00090         
00091         tokenMap.put("SecFlatProfile",     TokenXML.T_SEC_FLAT_PROFILE);
00092         tokenMap.put("SecFlatProfileData", TokenXML.T_SEC_FLAT_PROFILE_DATA);
00093         tokenMap.put("LM", TokenXML.T_LM);
00094         tokenMap.put("F",  TokenXML.T_F);
00095         tokenMap.put("P",  TokenXML.T_P);
00096         tokenMap.put("A",  TokenXML.T_A);
00097         
00098         // token for old XML
00099         tokenMap.put("CSPROFILE", TokenXML.T_CSPROFILE);
00100         tokenMap.put("HPCVIEWER", TokenXML.T_HPCVIEWER);
00101         
00102         // token for XML v 3.0
00103         tokenMap.put("SummaryDBFile", TokenXML.T_SUMMARY_DB_FILE);
00104         tokenMap.put("TraceDBFile",   TokenXML.T_TRACE_DB_FILE);
00105         tokenMap.put("PlotDBFile",    TokenXML.T_PLOT_DB_FILE);
00106     }
00107 
00108     public static TokenXML map(String element) {
00109         TokenXML objToken = tokenMap.get(element);
00110 
00111         if(objToken == null) {
00112             return TokenXML.T_INVALID_ELEMENT_NAME;
00113         }
00114         else {
00115             return objToken;
00116         }
00117     }
00118 }

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1