1 36 37 package jnlp.sample.servlet; 38 39 41 public class XMLAttribute { 42 private String _name; 43 private String _value; 44 private XMLAttribute _next; 45 46 public XMLAttribute(String name, String value) { 47 _name = name; 48 _value = value; 49 _next = null; 50 } 51 52 public XMLAttribute(String name, String value, XMLAttribute next) { 53 _name = name; 54 _value = value; 55 _next = next; 56 } 57 58 public String getName() { return _name; } 59 public String getValue() { return _value; } 60 public XMLAttribute getNext() { return _next; } 61 public void setNext(XMLAttribute next) { _next = next; } 62 63 public boolean equals(Object o) { 64 if (o == null || !(o instanceof XMLAttribute)) return false; 65 XMLAttribute other = (XMLAttribute)o; 66 return 67 match(_name, other._name) && 68 match(_value, other._value) && 69 match(_next, other._next); 70 } 71 72 private static boolean match(Object o1, Object o2) { 73 if (o1 == null) return (o2 == null); 74 return o1.equals(o2); 75 } 76 77 public String toString() { 78 if (_next != null) { 79 return _name + "=\"" + _value + "\" " + _next.toString(); 80 } else { 81 return _name + "=\"" + _value + "\""; 82 } 83 } 84 } 85 86 87 88 | Popular Tags |