home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / xml4j.jar / com / ibm / xml / parser / AttDef.class (.txt) next >
Encoding:
Java Class File  |  1999-08-30  |  3.4 KB  |  163 lines

  1. package com.ibm.xml.parser;
  2.  
  3. import java.util.Enumeration;
  4. import java.util.Vector;
  5. import org.w3c.dom.Node;
  6.  
  7. public class AttDef extends Child {
  8.    static final long serialVersionUID = 3041229546206616963L;
  9.    public static final int CDATA = 1;
  10.    // $FF: renamed from: ID int
  11.    public static final int field_0 = 2;
  12.    public static final int IDREF = 3;
  13.    public static final int IDREFS = 4;
  14.    public static final int ENTITY = 5;
  15.    public static final int ENTITIES = 6;
  16.    public static final int NMTOKEN = 7;
  17.    public static final int NMTOKENS = 8;
  18.    public static final int NOTATION = 9;
  19.    public static final int NAME_TOKEN_GROUP = 10;
  20.    public static final String[] S_TYPESTR = new String[]{"*UNKNOWN*", "CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS", "NOTATION", "ENUMERATION"};
  21.    public static final int FIXED = 1;
  22.    public static final int REQUIRED = 2;
  23.    public static final int IMPLIED = 3;
  24.    public static final int NOFIXED = -1;
  25.    public static final int UNKNOWN = 0;
  26.    String name;
  27.    int declaredValueType = 0;
  28.    String value;
  29.    Vector tokens;
  30.    int defaultValueType = -1;
  31.  
  32.    public AttDef(String var1) {
  33.       this.name = var1;
  34.    }
  35.  
  36.    public synchronized Object clone() {
  37.       ((Child)this).checkFactory();
  38.       AttDef var1 = super.factory.createAttDef(this.name);
  39.       ((Child)var1).setFactory(((Child)this).getFactory());
  40.       var1.value = this.value;
  41.       var1.defaultValueType = this.defaultValueType;
  42.       var1.declaredValueType = this.declaredValueType;
  43.       if (this.tokens != null) {
  44.          var1.tokens = (Vector)this.tokens.clone();
  45.       }
  46.  
  47.       return var1;
  48.    }
  49.  
  50.    public synchronized boolean equals(Node var1, boolean var2) {
  51.       if (var1.getNodeType() != 22) {
  52.          return false;
  53.       } else {
  54.          AttDef var3 = (AttDef)var1;
  55.          if (!var3.getName().equals(this.getName())) {
  56.             return false;
  57.          } else if (var3.getDefaultType() != this.defaultValueType) {
  58.             return false;
  59.          } else if (var3.getDeclaredType() != this.declaredValueType) {
  60.             return false;
  61.          } else if (var3.getDefaultStringValue() == null && this.value == null || this.value != null && this.value.equals(var3.getDefaultStringValue())) {
  62.             if (var3.size() == 0 && this.size() == 0) {
  63.                return true;
  64.             } else if (var3.size() != this.size()) {
  65.                return false;
  66.             } else {
  67.                for(int var4 = 0; var4 < var3.size(); ++var4) {
  68.                   String var5 = var3.elementAt(var4);
  69.                   if (!var5.equals(this.elementAt(var4))) {
  70.                      return false;
  71.                   }
  72.                }
  73.  
  74.                return true;
  75.             }
  76.          } else {
  77.             return false;
  78.          }
  79.       }
  80.    }
  81.  
  82.    public short getNodeType() {
  83.       return 22;
  84.    }
  85.  
  86.    public String getNodeName() {
  87.       return "#attribute-definition";
  88.    }
  89.  
  90.    public String getName() {
  91.       return this.name;
  92.    }
  93.  
  94.    public void setName(String var1) {
  95.       this.name = var1;
  96.    }
  97.  
  98.    public int getDeclaredType() {
  99.       return this.declaredValueType;
  100.    }
  101.  
  102.    public void setDeclaredType(int var1) {
  103.       this.declaredValueType = var1;
  104.    }
  105.  
  106.    public String getDefaultStringValue() {
  107.       return this.value;
  108.    }
  109.  
  110.    public void setDefaultStringValue(String var1) {
  111.       this.value = TXAttribute.normalize(this.getDeclaredType(), var1);
  112.    }
  113.  
  114.    public boolean addElement(String var1) {
  115.       if (this.tokens == null) {
  116.          this.tokens = new Vector();
  117.       }
  118.  
  119.       if (this.tokens.indexOf(var1) >= 0) {
  120.          return false;
  121.       } else {
  122.          this.tokens.addElement(var1);
  123.          return true;
  124.       }
  125.    }
  126.  
  127.    public String elementAt(int var1) {
  128.       return this.tokens == null ? null : (String)this.tokens.elementAt(var1);
  129.    }
  130.  
  131.    public boolean contains(String var1) {
  132.       if (this.tokens == null) {
  133.          return false;
  134.       } else {
  135.          return this.tokens.indexOf(var1) >= 0;
  136.       }
  137.    }
  138.  
  139.    public int size() {
  140.       return this.tokens == null ? 0 : this.tokens.size();
  141.    }
  142.  
  143.    public Enumeration elements() {
  144.       return this.tokens == null ? null : this.tokens.elements();
  145.    }
  146.  
  147.    public int getDefaultType() {
  148.       return this.defaultValueType;
  149.    }
  150.  
  151.    public void setDefaultType(int var1) {
  152.       this.defaultValueType = var1;
  153.    }
  154.  
  155.    public void acceptPre(Visitor var1) throws Exception {
  156.       var1.visitAttDefPre(this);
  157.    }
  158.  
  159.    public void acceptPost(Visitor var1) throws Exception {
  160.       var1.visitAttDefPost(this);
  161.    }
  162. }
  163.