1 package com.wutka.dtd;
2
3 import java.io.*;
4
5 /*** Represents an external Public ID in an entity declaration
6 *
7 * @author Mark Wutka
8 * @version $Revision: 1.16 $ $Date: 2002/07/19 01:20:11 $ by $Author: wutka $
9 */
10
11 public class DTDPublic extends DTDExternalID
12 {
13 public String pub;
14
15 public DTDPublic()
16 {
17 }
18
19 /*** Writes out a public external ID declaration */
20 public void write(PrintWriter out)
21 throws IOException
22 {
23 out.print("PUBLIC \"");
24 out.print(pub);
25 out.print("\"");
26 if (system != null)
27 {
28 out.print(" \"");
29 out.print(system);
30 out.print("\"");
31 }
32 }
33
34 public boolean equals(Object ob)
35 {
36 if (ob == this) return true;
37 if (!(ob instanceof DTDPublic)) return false;
38
39 if (!super.equals(ob)) return false;
40
41 DTDPublic other = (DTDPublic) ob;
42
43 if (pub == null)
44 {
45 if (other.pub != null) return false;
46 }
47 else
48 {
49 if (!pub.equals(other.pub)) return false;
50 }
51
52 return true;
53 }
54
55 /*** Sets the public identifier */
56 public void setPub(String aPub)
57 {
58 pub = aPub;
59 }
60
61 /*** Retrieves the public identifier */
62 public String getPub()
63 {
64 return pub;
65 }
66 }