src/share/classes/javax/swing/text/SimpleAttributeSet.java
Print this page
*** 170,180 ****
* @return true if the list contains all the name/value pairs
*/
public boolean containsAttributes(AttributeSet attributes) {
boolean result = true;
! Enumeration names = attributes.getAttributeNames();
while (result && names.hasMoreElements()) {
Object name = names.nextElement();
result = attributes.getAttribute(name).equals(getAttribute(name));
}
--- 170,180 ----
* @return true if the list contains all the name/value pairs
*/
public boolean containsAttributes(AttributeSet attributes) {
boolean result = true;
! Enumeration<?> names = attributes.getAttributeNames();
while (result && names.hasMoreElements()) {
Object name = names.nextElement();
result = attributes.getAttribute(name).equals(getAttribute(name));
}
*** 195,205 ****
* Adds a set of attributes to the list.
*
* @param attributes the set of attributes to add
*/
public void addAttributes(AttributeSet attributes) {
! Enumeration names = attributes.getAttributeNames();
while (names.hasMoreElements()) {
Object name = names.nextElement();
addAttribute(name, attributes.getAttribute(name));
}
}
--- 195,205 ----
* Adds a set of attributes to the list.
*
* @param attributes the set of attributes to add
*/
public void addAttributes(AttributeSet attributes) {
! Enumeration<?> names = attributes.getAttributeNames();
while (names.hasMoreElements()) {
Object name = names.nextElement();
addAttribute(name, attributes.getAttribute(name));
}
}
*** 231,241 ****
public void removeAttributes(AttributeSet attributes) {
if (attributes == this) {
table.clear();
}
else {
! Enumeration names = attributes.getAttributeNames();
while (names.hasMoreElements()) {
Object name = names.nextElement();
Object value = attributes.getAttribute(name);
if (value.equals(getAttribute(name)))
removeAttribute(name);
--- 231,241 ----
public void removeAttributes(AttributeSet attributes) {
if (attributes == this) {
table.clear();
}
else {
! Enumeration<?> names = attributes.getAttributeNames();
while (names.hasMoreElements()) {
Object name = names.nextElement();
Object value = attributes.getAttribute(name);
if (value.equals(getAttribute(name)))
removeAttribute(name);
*** 270,279 ****
--- 270,280 ----
/**
* Clones a set of attributes.
*
* @return the new set of attributes
*/
+ @SuppressWarnings("unchecked") // Cast of result of clone
public Object clone() {
SimpleAttributeSet attr;
try {
attr = (SimpleAttributeSet) super.clone();
attr.table = (LinkedHashMap) table.clone();
*** 315,325 ****
*
* @return the string
*/
public String toString() {
String s = "";
! Enumeration names = getAttributeNames();
while (names.hasMoreElements()) {
Object key = names.nextElement();
Object value = getAttribute(key);
if (value instanceof AttributeSet) {
// don't go recursive
--- 316,326 ----
*
* @return the string
*/
public String toString() {
String s = "";
! Enumeration<?> names = getAttributeNames();
while (names.hasMoreElements()) {
Object key = names.nextElement();
Object value = getAttribute(key);
if (value instanceof AttributeSet) {
// don't go recursive
*** 362,372 ****
return this;
}
public Object getAttribute(Object key) {
return null;
}
! public Enumeration getAttributeNames() {
return Collections.emptyEnumeration();
}
public boolean containsAttribute(Object name, Object value) {
return false;
}
--- 363,373 ----
return this;
}
public Object getAttribute(Object key) {
return null;
}
! public Enumeration<?> getAttributeNames() {
return Collections.emptyEnumeration();
}
public boolean containsAttribute(Object name, Object value) {
return false;
}