1 /* Copyright (C) 2003 Vladimir Roubtsov. All rights reserved. 2 * 3 * This program and the accompanying materials are made available under 4 * the terms of the Common Public License v1.0 which accompanies this distribution, 5 * and is available at http://www.eclipse.org/legal/cpl-v10.html 6 * 7 * $Id: Tag.java,v 1.1.1.1 2004/05/09 16:57:41 vlad_r Exp $ 8 */ 9 package com.vladium.emma.report.html.doc; 10 11 import com.vladium.util.asserts.$assert; 12 13 // ---------------------------------------------------------------------------- 14 /** 15 * @author Vlad Roubtsov, (C) 2003 16 */ 17 public 18 abstract class Tag implements IContent 19 { 20 // public: ................................................................ 21 22 public static final Tag HTML = new TagImpl ("HTML"); 23 public static final Tag HEAD = new TagImpl ("HEAD"); 24 public static final Tag BODY = new TagImpl ("BODY"); 25 public static final Tag META = new TagImpl ("META"); 26 public static final Tag STYLE = new TagImpl ("STYLE"); 27 28 public static final Tag TITLE = new TagImpl ("TITLE"); 29 public static final Tag H1 = new TagImpl ("H1"); 30 public static final Tag H2 = new TagImpl ("H2"); 31 public static final Tag H3 = new TagImpl ("H3"); 32 public static final Tag H4 = new TagImpl ("H4"); 33 public static final Tag H5 = new TagImpl ("H5"); 34 public static final Tag H6 = new TagImpl ("H6"); 35 public static final Tag LINK = new TagImpl ("LINK"); 36 37 public static final Tag A = new TagImpl ("A"); 38 39 public static final Tag TABLE = new TagImpl ("TABLE"); 40 public static final Tag CAPTION = new TagImpl ("CAPTION"); 41 public static final Tag TH = new TagImpl ("TH"); 42 public static final Tag TR = new TagImpl ("TR"); 43 public static final Tag TD = new TagImpl ("TD"); 44 45 public static final Tag HR = new TagImpl ("HR"); 46 public static final Tag P = new TagImpl ("P"); 47 public static final Tag SPAN = new TagImpl ("SPAN"); 48 49 public static final Tag [] Hs = new Tag [] {H1, H2, H3, H4, H4, H6}; 50 getName()51 public abstract String getName (); 52 53 // protected: ............................................................. 54 55 // package: ............................................................... 56 57 Tag()58 Tag () {} 59 60 // private: ............................................................... 61 62 private static final class TagImpl extends Tag 63 { emit(final HTMLWriter out)64 public void emit (final HTMLWriter out) 65 { 66 out.write (m_name); 67 } 68 getName()69 public String getName () 70 { 71 return m_name; 72 } 73 toString()74 public String toString () 75 { 76 return m_name; 77 } 78 TagImpl(final String name)79 TagImpl (final String name) 80 { 81 if ($assert.ENABLED) $assert.ASSERT (name != null, "name = null"); 82 83 m_name = name; 84 } 85 86 87 private final String m_name; 88 89 } // end of 90 91 } // end of class 92 // ----------------------------------------------------------------------------