src/share/classes/javax/accessibility/AccessibleRelationSet.java

Print this page


   1 /*
   2  * Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 146      */
 147     public boolean remove(AccessibleRelation relation) {
 148         if (relations == null) {
 149             return false;
 150         } else {
 151             return relations.removeElement(relation);
 152         }
 153     }
 154 
 155     /**
 156      * Removes all the relations from the current relation set.
 157      */
 158     public void clear() {
 159         if (relations != null) {
 160             relations.removeAllElements();
 161         }
 162     }
 163 
 164     /**
 165      * Returns the number of relations in the relation set.

 166      */
 167     public int size() {
 168         if (relations == null) {
 169             return 0;
 170         } else {
 171             return relations.size();
 172         }
 173     }
 174 
 175     /**
 176      * Returns whether the relation set contains a relation
 177      * that matches the specified key.
 178      * @param key the AccessibleRelation key
 179      * @return true if the relation is in the relation set; otherwise false
 180      */
 181     public boolean contains(String key) {
 182         return get(key) != null;
 183     }
 184 
 185     /**


   1 /*
   2  * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 146      */
 147     public boolean remove(AccessibleRelation relation) {
 148         if (relations == null) {
 149             return false;
 150         } else {
 151             return relations.removeElement(relation);
 152         }
 153     }
 154 
 155     /**
 156      * Removes all the relations from the current relation set.
 157      */
 158     public void clear() {
 159         if (relations != null) {
 160             relations.removeAllElements();
 161         }
 162     }
 163 
 164     /**
 165      * Returns the number of relations in the relation set.
 166      * @return the number of relations in the relation set
 167      */
 168     public int size() {
 169         if (relations == null) {
 170             return 0;
 171         } else {
 172             return relations.size();
 173         }
 174     }
 175 
 176     /**
 177      * Returns whether the relation set contains a relation
 178      * that matches the specified key.
 179      * @param key the AccessibleRelation key
 180      * @return true if the relation is in the relation set; otherwise false
 181      */
 182     public boolean contains(String key) {
 183         return get(key) != null;
 184     }
 185 
 186     /**