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 / naming / CompoundName.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  3.4 KB  |  145 lines

  1. package javax.naming;
  2.  
  3. import java.io.IOException;
  4. import java.io.ObjectInputStream;
  5. import java.io.ObjectOutputStream;
  6. import java.io.StreamCorruptedException;
  7. import java.util.Enumeration;
  8. import java.util.Properties;
  9.  
  10. public class CompoundName implements Name {
  11.    protected transient NameImpl impl;
  12.    protected transient Properties mySyntax;
  13.    private static final long serialVersionUID = 3513100557083972036L;
  14.  
  15.    protected CompoundName(Enumeration var1, Properties var2) {
  16.       this.mySyntax = var2;
  17.       this.impl = new NameImpl(var2, var1);
  18.    }
  19.  
  20.    public CompoundName(String var1, Properties var2) throws InvalidNameException {
  21.       this.mySyntax = var2;
  22.       this.impl = new NameImpl(var2, var1);
  23.    }
  24.  
  25.    public String toString() {
  26.       return this.impl.toString();
  27.    }
  28.  
  29.    public boolean equals(Object var1) {
  30.       return var1 != null && var1 instanceof CompoundName && this.impl.equals(((CompoundName)var1).impl);
  31.    }
  32.  
  33.    public int hashCode() {
  34.       return this.impl.hashCode();
  35.    }
  36.  
  37.    public Object clone() {
  38.       return new CompoundName(this.getAll(), this.mySyntax);
  39.    }
  40.  
  41.    public int compareTo(Object var1) {
  42.       if (!(var1 instanceof CompoundName)) {
  43.          throw new ClassCastException("Not a CompoundName");
  44.       } else {
  45.          return this.impl.compareTo(((CompoundName)var1).impl);
  46.       }
  47.    }
  48.  
  49.    public int size() {
  50.       return this.impl.size();
  51.    }
  52.  
  53.    public boolean isEmpty() {
  54.       return this.impl.isEmpty();
  55.    }
  56.  
  57.    public Enumeration getAll() {
  58.       return this.impl.getAll();
  59.    }
  60.  
  61.    public String get(int var1) {
  62.       return this.impl.get(var1);
  63.    }
  64.  
  65.    public Name getPrefix(int var1) {
  66.       Enumeration var2 = this.impl.getPrefix(var1);
  67.       return new CompoundName(var2, this.mySyntax);
  68.    }
  69.  
  70.    public Name getSuffix(int var1) {
  71.       Enumeration var2 = this.impl.getSuffix(var1);
  72.       return new CompoundName(var2, this.mySyntax);
  73.    }
  74.  
  75.    public boolean startsWith(Name var1) {
  76.       return var1 instanceof CompoundName ? this.impl.startsWith(var1.size(), var1.getAll()) : false;
  77.    }
  78.  
  79.    public boolean endsWith(Name var1) {
  80.       return var1 instanceof CompoundName ? this.impl.endsWith(var1.size(), var1.getAll()) : false;
  81.    }
  82.  
  83.    public Name addAll(Name var1) throws InvalidNameException {
  84.       if (var1 instanceof CompoundName) {
  85.          this.impl.addAll(var1.getAll());
  86.          return this;
  87.       } else {
  88.          throw new InvalidNameException("Not a compound name: " + var1.toString());
  89.       }
  90.    }
  91.  
  92.    public Name addAll(int var1, Name var2) throws InvalidNameException {
  93.       if (var2 instanceof CompoundName) {
  94.          this.impl.addAll(var1, var2.getAll());
  95.          return this;
  96.       } else {
  97.          throw new InvalidNameException("Not a compound name: " + var2.toString());
  98.       }
  99.    }
  100.  
  101.    public Name add(String var1) throws InvalidNameException {
  102.       this.impl.add(var1);
  103.       return this;
  104.    }
  105.  
  106.    public Name add(int var1, String var2) throws InvalidNameException {
  107.       this.impl.add(var1, var2);
  108.       return this;
  109.    }
  110.  
  111.    public Object remove(int var1) throws InvalidNameException {
  112.       return this.impl.remove(var1);
  113.    }
  114.  
  115.    private void writeObject(ObjectOutputStream var1) throws IOException {
  116.       var1.writeObject(this.mySyntax);
  117.       var1.writeInt(this.size());
  118.       Enumeration var2 = this.getAll();
  119.  
  120.       while(var2.hasMoreElements()) {
  121.          var1.writeObject(var2.nextElement());
  122.       }
  123.  
  124.    }
  125.  
  126.    private void readObject(ObjectInputStream var1) throws IOException, ClassNotFoundException {
  127.       this.mySyntax = (Properties)var1.readObject();
  128.       this.impl = new NameImpl(this.mySyntax);
  129.       int var2 = var1.readInt();
  130.  
  131.       try {
  132.          while(true) {
  133.             --var2;
  134.             if (var2 < 0) {
  135.                return;
  136.             }
  137.  
  138.             this.add((String)var1.readObject());
  139.          }
  140.       } catch (InvalidNameException var4) {
  141.          throw new StreamCorruptedException("Invalid name");
  142.       }
  143.    }
  144. }
  145.