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 /** 186 * Returns the relation that matches the specified key. 187 * @param key the AccessibleRelation key 188 * @return the relation, if one exists, that matches the specified key. 189 * Otherwise, null is returned. 190 */ 191 public AccessibleRelation get(String key) { 192 if (relations == null) { 193 return null; 194 } else { 195 int len = relations.size(); 196 for (int i = 0; i < len; i++) { 197 AccessibleRelation relation = 198 (AccessibleRelation)relations.elementAt(i); 199 if (relation != null && relation.getKey().equals(key)) { 200 return relation; 201 } 202 } 203 return null; 204 } 205 } 206 207 /** 208 * Returns the current relation set as an array of AccessibleRelation 209 * @return AccessibleRelation array contacting the current relation. 210 */ 211 public AccessibleRelation[] toArray() { 212 if (relations == null) { 213 return new AccessibleRelation[0]; 214 } else { 215 AccessibleRelation[] relationArray 216 = new AccessibleRelation[relations.size()]; 217 for (int i = 0; i < relationArray.length; i++) { 218 relationArray[i] = (AccessibleRelation) relations.elementAt(i); 219 } 220 return relationArray; 221 } 222 } 223 224 /** 225 * Creates a localized String representing all the relations in the set 226 * using the default locale. 227 * 228 * @return comma separated localized String 229 * @see AccessibleBundle#toDisplayString 230 */ 231 public String toString() { 232 String ret = ""; 233 if ((relations != null) && (relations.size() > 0)) { 234 ret = ((AccessibleRelation) (relations.elementAt(0))).toDisplayString(); 235 for (int i = 1; i < relations.size(); i++) { 236 ret = ret + "," 237 + ((AccessibleRelation) (relations.elementAt(i))). 238 toDisplayString(); 239 } 240 } 241 return ret; 242 } 243 } | 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 /** 186 * Returns the relation that matches the specified key. 187 * @param key the AccessibleRelation key 188 * @return the relation, if one exists, that matches the specified key. 189 * Otherwise, null is returned. 190 */ 191 public AccessibleRelation get(String key) { 192 if (relations == null) { 193 return null; 194 } else { 195 int len = relations.size(); 196 for (int i = 0; i < len; i++) { 197 AccessibleRelation relation = relations.elementAt(i); 198 if (relation != null && relation.getKey().equals(key)) { 199 return relation; 200 } 201 } 202 return null; 203 } 204 } 205 206 /** 207 * Returns the current relation set as an array of AccessibleRelation 208 * @return AccessibleRelation array contacting the current relation. 209 */ 210 public AccessibleRelation[] toArray() { 211 if (relations == null) { 212 return new AccessibleRelation[0]; 213 } else { 214 AccessibleRelation[] relationArray 215 = new AccessibleRelation[relations.size()]; 216 for (int i = 0; i < relationArray.length; i++) { 217 relationArray[i] = relations.elementAt(i); 218 } 219 return relationArray; 220 } 221 } 222 223 /** 224 * Creates a localized String representing all the relations in the set 225 * using the default locale. 226 * 227 * @return comma separated localized String 228 * @see AccessibleBundle#toDisplayString 229 */ 230 public String toString() { 231 String ret = ""; 232 if ((relations != null) && (relations.size() > 0)) { 233 ret = relations.elementAt(0).toDisplayString(); 234 for (int i = 1; i < relations.size(); i++) { 235 ret = ret + "," + relations.elementAt(i).toDisplayString(); 236 } 237 } 238 return ret; 239 } 240 } |