/[classpath]/classpath/javax/swing/text/SimpleAttributeSet.java
ViewVC logotype

Diff of /classpath/javax/swing/text/SimpleAttributeSet.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.11 by abalkiss, Tue Sep 27 19:37:41 2005 UTC revision 1.12 by abalkiss, Tue Sep 27 21:31:36 2005 UTC
# Line 87  public class SimpleAttributeSet Line 87  public class SimpleAttributeSet
87      return s;      return s;
88    }    }
89    
90      /**
91       * Returns true if the given name and value represent an attribute
92       * found either in this AttributeSet or in its resolve parent hierarchy.
93       * @param name the key for the attribute
94       * @param value the value for the attribute
95       * @return true if the attribute is found here or in this set's resolve
96       * parent hierarchy
97       */
98    public boolean containsAttribute(Object name, Object value)    public boolean containsAttribute(Object name, Object value)
99    {    {
100        return (tab.containsKey(name) && tab.get(name).equals(value)) ||
101          (getResolveParent() != null && getResolveParent().
102           containsAttribute(name, value));
103      }
104      
105      /**
106       * Returns true if the given name and value are found in this AttributeSet.
107       * Does not check the resolve parent.
108       * @param name the key for the attribute
109       * @param value the value for the attribute
110       * @return true if the attribute is found in this AttributeSet
111       */
112      boolean containsAttributeLocally(Object name, Object value)
113      {
114      return tab.containsKey(name)      return tab.containsKey(name)
115        && tab.get(name).equals(value);        && tab.get(name).equals(value);
116    }    }
# Line 160  public class SimpleAttributeSet Line 182  public class SimpleAttributeSet
182    {    {
183      return tab.isEmpty();            return tab.isEmpty();      
184    }    }
185            
186      /**
187       * Returns true if the given set has the same number of attributes
188       * as this set and <code>containsAttributes(attr)</code> returns
189       * true.
190       */
191    public boolean isEqual(AttributeSet attr)    public boolean isEqual(AttributeSet attr)
192    {    {
193      return attr != null      return getAttributeCount() == attr.getAttributeCount()
       && attr.containsAttributes(this)  
194        && this.containsAttributes(attr);        && this.containsAttributes(attr);
195    }    }
196            
# Line 185  public class SimpleAttributeSet Line 211  public class SimpleAttributeSet
211        {        {
212          Object name = e.nextElement();          Object name = e.nextElement();
213          Object val = attributes.getAttribute(name);          Object val = attributes.getAttribute(name);
214          if (containsAttribute(name, val))          if (containsAttributeLocally(name, val))
215            removeAttribute(name);                removeAttribute(name);    
216        }        }
217    }    }

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26