| 1 9 package com.vladium.emma.report.html.doc; 10 11 import com.vladium.util.asserts.$assert; 12 13 17 public 18 abstract class Attribute implements IContent 19 { 20 22 public static final Attribute ID = new AttributeImpl ("ID"); 23 public static final Attribute NAME = new AttributeImpl ("NAME"); 24 public static final Attribute TITLE = new AttributeImpl ("TITLE"); 25 public static final Attribute TYPE = new AttributeImpl ("TYPE"); 26 public static final Attribute CLASS = new AttributeImpl ("CLASS"); 27 public static final Attribute HTTP_EQUIV = new AttributeImpl ("HTTP-EQUIV"); 28 public static final Attribute CONTENT = new AttributeImpl ("CONTENT"); 29 public static final Attribute HREF = new AttributeImpl ("HREF"); 30 public static final Attribute SRC = new AttributeImpl ("SRC"); 31 public static final Attribute REL = new AttributeImpl ("REL"); 32 public static final Attribute WIDTH = new AttributeImpl ("WIDTH"); 33 public static final Attribute SIZE = new AttributeImpl ("SIZE"); 34 public static final Attribute BORDER = new AttributeImpl ("BORDER"); 35 public static final Attribute CELLPADDING = new AttributeImpl ("CELLPADDING"); 36 public static final Attribute CELLSPACING = new AttributeImpl ("CELLSPACING"); 37 public static final Attribute ALIGN = new AttributeImpl ("ALIGN"); 38 public static final Attribute COLSPAN = new AttributeImpl ("COLSPAN"); 39 40 public abstract String getName (); 41 42 public abstract boolean equals (final Object rhs); 43 public abstract int hashCode (); 44 45 46 48 50 51 Attribute () {} 52 53 55 56 private static final class AttributeImpl extends Attribute 57 { 58 59 public boolean equals (final Object rhs) 60 { 61 if (this == rhs) return true; 62 if (! (rhs instanceof AttributeImpl)) return false; 63 64 return m_name.equals (((AttributeImpl) rhs).m_name); 65 } 66 67 public int hashCode () 68 { 69 return m_name.hashCode (); 70 } 71 72 public String toString () 73 { 74 return m_name; 75 } 76 77 public void emit (final HTMLWriter out) 78 { 79 out.write (m_name); } 81 82 public String getName () 83 { 84 return m_name; 85 } 86 87 88 AttributeImpl (final String name) 89 { 90 if ($assert.ENABLED) $assert.ASSERT (name != null, "name = null"); 91 92 m_name = name; 93 } 94 95 96 private final String m_name; 97 98 } 100 } | Popular Tags |