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 / ExternalID.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-08-30  |  1.4 KB  |  86 lines

  1. package com.ibm.xml.parser;
  2.  
  3. import java.io.Serializable;
  4.  
  5. public class ExternalID implements Serializable {
  6.    static final long serialVersionUID = 4611817161873481189L;
  7.    private static final int T_SYSTEM = 0;
  8.    private static final int T_PUBLIC = 1;
  9.    int type = 1;
  10.    String publicID;
  11.    String systemID;
  12.  
  13.    public ExternalID(String var1) {
  14.       this.type = 0;
  15.       this.publicID = null;
  16.       this.systemID = var1;
  17.    }
  18.  
  19.    public ExternalID(String var1, String var2) {
  20.       this.type = 1;
  21.       this.publicID = var1;
  22.       this.systemID = var2;
  23.       if (this.publicID == null) {
  24.          this.type = 0;
  25.       }
  26.  
  27.    }
  28.  
  29.    public boolean isSystem() {
  30.       return this.type == 0;
  31.    }
  32.  
  33.    public boolean isPublic() {
  34.       return this.type == 1;
  35.    }
  36.  
  37.    public String getSystemLiteral() {
  38.       return this.systemID;
  39.    }
  40.  
  41.    public String getPubidLiteral() {
  42.       return this.publicID;
  43.    }
  44.  
  45.    public String toString() {
  46.       String var1;
  47.       if (this.isSystem()) {
  48.          var1 = "SYSTEM \"" + this.getSystemLiteral() + "\"";
  49.       } else if (this.getSystemLiteral() != null) {
  50.          var1 = "PUBLIC \"" + this.getPubidLiteral() + "\" \"" + this.getSystemLiteral() + "\"";
  51.       } else {
  52.          var1 = "PUBLIC \"" + this.getPubidLiteral() + "\"";
  53.       }
  54.  
  55.       return var1;
  56.    }
  57.  
  58.    public boolean equals(Object var1) {
  59.       if (var1 == null) {
  60.          return false;
  61.       } else if (!(var1 instanceof ExternalID)) {
  62.          return false;
  63.       } else {
  64.          ExternalID var2 = (ExternalID)var1;
  65.          if (var2.publicID == null && this.publicID == null || var2.publicID != null && var2.publicID.equals(this.publicID)) {
  66.             return var2.systemID == null && this.systemID == null || var2.systemID != null && var2.systemID.equals(this.systemID);
  67.          } else {
  68.             return false;
  69.          }
  70.       }
  71.    }
  72.  
  73.    public int hashCode() {
  74.       int var1 = 0;
  75.       if (this.publicID != null) {
  76.          var1 = this.publicID.hashCode();
  77.       }
  78.  
  79.       if (this.systemID != null) {
  80.          var1 += this.systemID.hashCode();
  81.       }
  82.  
  83.       return var1;
  84.    }
  85. }
  86.