00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 package org.objectweb.proactive.benchmarks.timit.config;
00032
00033 import java.util.HashMap;
00034 import java.util.Iterator;
00035
00036 import org.jdom.Attribute;
00037 import org.jdom.Element;
00038
00046 public abstract class Tag {
00047
00048 private HashMap<String, String> attributes;
00049
00053 public Tag() {
00054 this.attributes = new HashMap<String, String>();
00055 }
00056
00063 public Tag(Element eBench) {
00064 this();
00065 Iterator it = eBench.getAttributes().iterator();
00066 while (it.hasNext()) {
00067 Attribute attr = (Attribute) it.next();
00068 this.addAttribute(attr.getName(), attr.getValue());
00069 }
00070 }
00071
00078 public void addAttribute(String name, String value) {
00079 this.attributes.put(name.toLowerCase(), value);
00080 }
00081
00085 public String get(String name) {
00086 return this.attributes.get(name.toLowerCase());
00087 }
00088
00092 public String toString() {
00093 String result = "[";
00094 Iterator<String> it = this.attributes.keySet().iterator();
00095 while (it.hasNext()) {
00096 String key = it.next();
00097 String value = this.attributes.get(key);
00098 result += key + "=" + value + (it.hasNext() ? ", " : "");
00099 }
00100 return result + "]\n";
00101 }
00102 }