1 package com.wutka.dtd;
2
3 import java.io.*;
4
5 /*** Represents the possible values for an attribute declaration
6 *
7 * @author Mark Wutka
8 * @version $Revision: 1.16 $ $Date: 2002/07/19 01:20:11 $ by $Author: wutka $
9 */
10 public class DTDDecl implements DTDOutput
11 {
12 public static final DTDDecl FIXED = new DTDDecl(0, "FIXED");
13 public static final DTDDecl REQUIRED = new DTDDecl(1, "REQUIRED");
14 public static final DTDDecl IMPLIED = new DTDDecl(2, "IMPLIED");
15 public static final DTDDecl VALUE = new DTDDecl(3, "VALUE");
16
17 public int type;
18 public String name;
19
20 public DTDDecl(int aType, String aName)
21 {
22 type = aType;
23 name = aName;
24 }
25
26 public boolean equals(Object ob)
27 {
28 if (ob == this) return true;
29 if (!(ob instanceof DTDDecl)) return false;
30
31 DTDDecl other = (DTDDecl) ob;
32 if (other.type == type) return true;
33 return false;
34 }
35
36 public void write(PrintWriter out)
37 throws IOException
38 {
39 if (this == FIXED)
40 {
41 out.print(" #FIXED");
42 }
43 else if (this == REQUIRED)
44 {
45 out.print(" #REQUIRED");
46 }
47 else if (this == IMPLIED)
48 {
49 out.print(" #IMPLIED");
50 }
51
52 }
53 }