1 package com.wutka.dtd;
2
3 import java.io.*;
4
5 /*** Represents a comment in the DTD
6 *
7 * @author Mark Wutka
8 * @version $Revision: 1.16 $ $Date: 2002/07/19 01:20:11 $ by $Author: wutka $
9 */
10 public class DTDComment implements DTDOutput
11 {
12 /*** The comment text */
13 public String text;
14
15 public DTDComment()
16 {
17 }
18
19 public DTDComment(String theText)
20 {
21 text = theText;
22 }
23
24 public String toString()
25 {
26 return text;
27 }
28
29 public void write(PrintWriter out)
30 throws IOException
31 {
32 out.print("<!--");
33 out.print(text);
34 out.println("-->");
35 }
36
37 public boolean equals(Object ob)
38 {
39 if (ob == this) return true;
40 if (!(ob instanceof DTDComment)) return false;
41
42 DTDComment other = (DTDComment) ob;
43 if ((text == null) && (other.text != null)) return false;
44 if ((text != null) && !text.equals(other.text)) return false;
45
46 return true;
47 }
48
49 /*** Sets the comment text */
50 public void setText(String theText)
51 {
52 text = theText;
53 }
54
55 /*** Returns the comment text */
56 public String getText()
57 {
58 return text;
59 }
60 }