1 /*
2 * Copyright (c) 2000, 2004, 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
365 category != null &&
366 AttributeSetUtilities.
367 verifyAttributeCategory(category, Attribute.class) != null &&
368 attrMap.get(category) != null;
369 }
370
371 /**
372 * Returns <tt>true</tt> if this attribute set contains the given
373 * attribute.
374 *
375 * @param attribute value whose presence in this attribute set is
376 * to be tested.
377 *
378 * @return <tt>true</tt> if this attribute set contains the given
379 * attribute value.
380 */
381 public boolean containsValue(Attribute attribute) {
382 return
383 attribute != null &&
384 attribute instanceof Attribute &&
385 attribute.equals(attrMap.get(((Attribute)attribute).getCategory()));
386 }
387
388 /**
389 * Adds all of the elements in the specified set to this attribute.
390 * The outcome is the same as if the
391 * {@link #add(Attribute) add(Attribute)}
392 * operation had been applied to this attribute set successively with
393 * each element from the specified set.
394 * The behavior of the <CODE>addAll(AttributeSet)</CODE>
395 * operation is unspecified if the specified set is modified while
396 * the operation is in progress.
397 * <P>
398 * If the <CODE>addAll(AttributeSet)</CODE> operation throws an exception,
399 * the effect on this attribute set's state is implementation dependent;
400 * elements from the specified set before the point of the exception may
401 * or may not have been added to this attribute set.
402 *
403 * @param attributes whose elements are to be added to this attribute
404 * set.
405 *
|
1 /*
2 * Copyright (c) 2000, 2014, 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
365 category != null &&
366 AttributeSetUtilities.
367 verifyAttributeCategory(category, Attribute.class) != null &&
368 attrMap.get(category) != null;
369 }
370
371 /**
372 * Returns <tt>true</tt> if this attribute set contains the given
373 * attribute.
374 *
375 * @param attribute value whose presence in this attribute set is
376 * to be tested.
377 *
378 * @return <tt>true</tt> if this attribute set contains the given
379 * attribute value.
380 */
381 public boolean containsValue(Attribute attribute) {
382 return
383 attribute != null &&
384 attribute instanceof Attribute &&
385 attribute.equals(attrMap.get(attribute.getCategory()));
386 }
387
388 /**
389 * Adds all of the elements in the specified set to this attribute.
390 * The outcome is the same as if the
391 * {@link #add(Attribute) add(Attribute)}
392 * operation had been applied to this attribute set successively with
393 * each element from the specified set.
394 * The behavior of the <CODE>addAll(AttributeSet)</CODE>
395 * operation is unspecified if the specified set is modified while
396 * the operation is in progress.
397 * <P>
398 * If the <CODE>addAll(AttributeSet)</CODE> operation throws an exception,
399 * the effect on this attribute set's state is implementation dependent;
400 * elements from the specified set before the point of the exception may
401 * or may not have been added to this attribute set.
402 *
403 * @param attributes whose elements are to be added to this attribute
404 * set.
405 *
|