home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &n…he Search for Life DVD 2 / DVD-ROM.iso / install / jre1_3 / lib / rt.jar / javax / swing / text / html / parser / Element.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  2.2 KB  |  98 lines

  1. package javax.swing.text.html.parser;
  2.  
  3. import java.io.Serializable;
  4. import java.util.BitSet;
  5. import java.util.Hashtable;
  6.  
  7. public final class Element implements DTDConstants, Serializable {
  8.    public int index;
  9.    public String name;
  10.    public boolean oStart;
  11.    public boolean oEnd;
  12.    public BitSet inclusions;
  13.    public BitSet exclusions;
  14.    public int type = 19;
  15.    public ContentModel content;
  16.    public AttributeList atts;
  17.    static int maxIndex = 0;
  18.    public Object data;
  19.    static Hashtable contentTypes = new Hashtable();
  20.  
  21.    Element() {
  22.    }
  23.  
  24.    Element(String var1, int var2) {
  25.       this.name = var1;
  26.       this.index = var2;
  27.       maxIndex = Math.max(maxIndex, var2);
  28.    }
  29.  
  30.    public String getName() {
  31.       return this.name;
  32.    }
  33.  
  34.    public boolean omitStart() {
  35.       return this.oStart;
  36.    }
  37.  
  38.    public boolean omitEnd() {
  39.       return this.oEnd;
  40.    }
  41.  
  42.    public int getType() {
  43.       return this.type;
  44.    }
  45.  
  46.    public ContentModel getContent() {
  47.       return this.content;
  48.    }
  49.  
  50.    public AttributeList getAttributes() {
  51.       return this.atts;
  52.    }
  53.  
  54.    public int getIndex() {
  55.       return this.index;
  56.    }
  57.  
  58.    public boolean isEmpty() {
  59.       return this.type == 17;
  60.    }
  61.  
  62.    public String toString() {
  63.       return this.name;
  64.    }
  65.  
  66.    public AttributeList getAttribute(String var1) {
  67.       for(AttributeList var2 = this.atts; var2 != null; var2 = var2.next) {
  68.          if (var2.name.equals(var1)) {
  69.             return var2;
  70.          }
  71.       }
  72.  
  73.       return null;
  74.    }
  75.  
  76.    public AttributeList getAttributeByValue(String var1) {
  77.       for(AttributeList var2 = this.atts; var2 != null; var2 = var2.next) {
  78.          if (var2.values != null && var2.values.contains(var1)) {
  79.             return var2;
  80.          }
  81.       }
  82.  
  83.       return null;
  84.    }
  85.  
  86.    public static int name2type(String var0) {
  87.       Integer var1 = (Integer)contentTypes.get(var0);
  88.       return var1 != null ? var1 : 0;
  89.    }
  90.  
  91.    static {
  92.       contentTypes.put("CDATA", new Integer(1));
  93.       contentTypes.put("RCDATA", new Integer(16));
  94.       contentTypes.put("EMPTY", new Integer(17));
  95.       contentTypes.put("ANY", new Integer(19));
  96.    }
  97. }
  98.