1 package com.wutka.dtd;
2
3 import java.io.*;
4
5 /*** Represents a Notation defined in a 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 DTDNotation implements DTDOutput
11 {
12 public String name;
13 public DTDExternalID externalID;
14
15 public DTDNotation()
16 {
17 }
18
19 public DTDNotation(String aName)
20 {
21 name = aName;
22 }
23
24 /*** Writes out a declaration for this notation */
25 public void write(PrintWriter out)
26 throws IOException
27 {
28 out.print("<!NOTATION ");
29 out.print(name);
30 out.print(" ");
31 externalID.write(out);
32 out.println(">");
33 }
34
35 public boolean equals(Object ob)
36 {
37 if (ob == this) return true;
38 if (!(ob instanceof DTDNotation)) return false;
39
40 DTDNotation other = (DTDNotation) ob;
41
42 if (name == null)
43 {
44 if (other.name != null) return false;
45 }
46 else
47 {
48 if (!name.equals(other.name)) return false;
49 }
50
51 if (externalID == null)
52 {
53 if (other.externalID != null) return false;
54 }
55 else
56 {
57 if (!externalID.equals(other.externalID)) return false;
58 }
59
60 return true;
61 }
62
63 /*** Sets the notation name */
64 public void setName(String aName)
65 {
66 name = aName;
67 }
68
69 /*** Retrieves the notation name */
70 public String getName()
71 {
72 return name;
73 }
74
75 /*** Sets the external ID */
76 public void setExternalID(DTDExternalID theExternalID)
77 {
78 externalID = theExternalID;
79 }
80
81 /*** Retrieves the external ID */
82 public DTDExternalID getExternalID()
83 {
84 return externalID;
85 }
86 }