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 / accessibility / AccessibleRelationSet.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  1.8 KB  |  116 lines

  1. package javax.accessibility;
  2.  
  3. import java.util.Vector;
  4.  
  5. public class AccessibleRelationSet {
  6.    protected Vector relations = null;
  7.  
  8.    public AccessibleRelationSet() {
  9.       this.relations = null;
  10.    }
  11.  
  12.    public AccessibleRelationSet(AccessibleRelation[] var1) {
  13.       if (var1.length != 0) {
  14.          this.relations = new Vector(var1.length);
  15.  
  16.          for(int var2 = 0; var2 < var1.length; ++var2) {
  17.             if (!this.relations.contains(var1[var2])) {
  18.                this.relations.addElement(var1[var2]);
  19.             }
  20.          }
  21.       }
  22.  
  23.    }
  24.  
  25.    public boolean add(AccessibleRelation var1) {
  26.       if (this.relations == null) {
  27.          this.relations = new Vector();
  28.       }
  29.  
  30.       if (!this.relations.contains(var1)) {
  31.          this.relations.addElement(var1);
  32.          return true;
  33.       } else {
  34.          return false;
  35.       }
  36.    }
  37.  
  38.    public void addAll(AccessibleRelation[] var1) {
  39.       if (var1.length != 0) {
  40.          if (this.relations == null) {
  41.             this.relations = new Vector(var1.length);
  42.          }
  43.  
  44.          for(int var2 = 0; var2 < var1.length; ++var2) {
  45.             if (!this.relations.contains(var1[var2])) {
  46.                this.relations.addElement(var1[var2]);
  47.             }
  48.          }
  49.       }
  50.  
  51.    }
  52.  
  53.    public boolean remove(AccessibleRelation var1) {
  54.       return this.relations == null ? false : this.relations.removeElement(var1);
  55.    }
  56.  
  57.    public void clear() {
  58.       if (this.relations != null) {
  59.          this.relations.removeAllElements();
  60.       }
  61.  
  62.    }
  63.  
  64.    public int size() {
  65.       return this.relations == null ? 0 : this.relations.size();
  66.    }
  67.  
  68.    public boolean contains(String var1) {
  69.       return this.get(var1) != null;
  70.    }
  71.  
  72.    public AccessibleRelation get(String var1) {
  73.       if (this.relations == null) {
  74.          return null;
  75.       } else {
  76.          int var2 = this.relations.size();
  77.  
  78.          for(int var3 = 0; var3 < var2; ++var3) {
  79.             AccessibleRelation var4 = (AccessibleRelation)this.relations.elementAt(var3);
  80.             if (var4 != null && var4.getKey().equals(var1)) {
  81.                return var4;
  82.             }
  83.          }
  84.  
  85.          return null;
  86.       }
  87.    }
  88.  
  89.    public AccessibleRelation[] toArray() {
  90.       if (this.relations == null) {
  91.          return new AccessibleRelation[0];
  92.       } else {
  93.          AccessibleRelation[] var1 = new AccessibleRelation[this.relations.size()];
  94.  
  95.          for(int var2 = 0; var2 < var1.length; ++var2) {
  96.             var1[var2] = (AccessibleRelation)this.relations.elementAt(var2);
  97.          }
  98.  
  99.          return var1;
  100.       }
  101.    }
  102.  
  103.    public String toString() {
  104.       String var1 = "";
  105.       if (this.relations != null && this.relations.size() > 0) {
  106.          var1 = ((AccessibleRelation)this.relations.elementAt(0)).toDisplayString();
  107.  
  108.          for(int var2 = 1; var2 < this.relations.size(); ++var2) {
  109.             var1 = var1 + "," + ((AccessibleRelation)this.relations.elementAt(var2)).toDisplayString();
  110.          }
  111.       }
  112.  
  113.       return var1;
  114.    }
  115. }
  116.