home *** CD-ROM | disk | FTP | other *** search
/ Online Today 2000 January / Onto0100.iso / pc / JAVA / MSJAVX86.EXE / xmldso.cab / XML4IE3.cab / com / ms / xml / util / Attributes.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-10-10  |  1.5 KB  |  69 lines

  1. package com.ms.xml.util;
  2.  
  3. import java.util.Vector;
  4.  
  5. public class Attributes extends ReadOnlyAttributes {
  6.    public void removeAll() {
  7.       super.attributes.removeAllElements();
  8.    }
  9.  
  10.    public Attributes() {
  11.    }
  12.  
  13.    public Attributes(int var1) {
  14.       super(var1);
  15.    }
  16.  
  17.    public Attributes(ReadOnlyAttributes var1) {
  18.       Vector var2 = var1.attributes;
  19.       if (var2 != null) {
  20.          int var3 = var2.size();
  21.          super.attributes = new Vector(var3);
  22.          super.attributes.setSize(var3);
  23.  
  24.          for(int var4 = 0; var4 < var3; ++var4) {
  25.             Attribute var5 = (Attribute)var2.elementAt(var4);
  26.             super.attributes.setElementAt(new Attribute(var5.name, var5.getValue()), var4);
  27.          }
  28.       }
  29.  
  30.    }
  31.  
  32.    public Attributes(Vector var1) {
  33.       super(var1);
  34.    }
  35.  
  36.    public Object put(Name var1, Object var2) {
  37.       Attribute var3 = ((ReadOnlyAttributes)this).lookup(var1);
  38.       Object var4 = null;
  39.       if (var3 != null) {
  40.          var4 = var3.getValue();
  41.          var3.setValue(var2);
  42.       } else {
  43.          super.attributes.addElement(new Attribute(var1, var2));
  44.       }
  45.  
  46.       return var4;
  47.    }
  48.  
  49.    public Object put(Attribute var1) {
  50.       Object var2 = null;
  51.       Attribute var3 = ((ReadOnlyAttributes)this).lookup(var1.getName());
  52.       if (var3 != null) {
  53.          var2 = var3.getValue();
  54.          super.attributes.removeElement(var3);
  55.       }
  56.  
  57.       super.attributes.addElement(var1);
  58.       return var2;
  59.    }
  60.  
  61.    public void remove(Name var1) {
  62.       Attribute var2 = ((ReadOnlyAttributes)this).lookup(var1);
  63.       if (var2 != null) {
  64.          super.attributes.removeElement(var2);
  65.       }
  66.  
  67.    }
  68. }
  69.