public abstract class DefaultAttributes extends java.lang.Object implements Attributes
DefaultAttributes
class represents each flag as an int
. The state of each flag can be tested, set, and unset (i.e. cleared).
Client classes of DefaultAttributes
must not make any assumptions about the meaning of the int
that represents a particular flag. There is no guarantee that the DefaultAttributes
implementation will behave as a bitset, array of int
s, or otherwise. The reason is that the implementation of DefaultAttributes
may change without notice to address scaling or performance issues. The only safe ways to query and modify an DefaultAttributes
instance is through its methods.
Special care must be taken when implementing subclasses of DefaultAttributes
to avoid the tendency to depend on the implementation details of a superclass.
Modifier and Type | Field and Description |
---|---|
static Attributes |
EMPTY_ATTRIBUTES
Classes that define no attributes should use
EMPTY_ATTRIBUTES |
static int |
NONE
NONE is used to represent that no attributes are set. |
Constructor and Description |
---|
DefaultAttributes()
Creates a new
Attributes object initialized with all attributes unset. |
DefaultAttributes(DefaultAttributes attributes) |
DefaultAttributes(int attribute)
Creates a new
Attributes object initialized with the specified attribute set. |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears all attributes by resetting the attributes to Attributes.NONE.
|
protected static int |
decAttr(int curAttr)
The caller must not make any assumptions about the format of the returned
int and how the Attributes class uses it. |
boolean |
equals(java.lang.Object o) |
protected boolean |
equalsImpl(DefaultAttributes other) |
protected static int |
incAttr(int curAttr)
The caller must not make any assumptions about the format of the returned
int and how the Attributes class uses it. |
boolean |
isSet(int attr) |
protected static int |
maxAttr()
The caller must not make any assumptions about the format of the returned
int and how the Attributes class uses it. |
protected static int |
minAttr()
The caller must not make any assumptions about the format of the returned
int and how the Attributes class uses it. |
protected static int |
noneAttr()
The caller must not make any assumptions about the format of the returned
int and how the Attributes class uses it. |
void |
set(int attr)
This method sets the specified attribute.
|
void |
unset(int attr)
This method unsets (i.e.
|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
duplicate
public static final Attributes EMPTY_ATTRIBUTES
EMPTY_ATTRIBUTES
public static final int NONE
NONE
is used to represent that no attributes are set.public DefaultAttributes()
Attributes
object initialized with all attributes unset.public DefaultAttributes(int attribute)
Attributes
object initialized with the specified attribute
set.public DefaultAttributes(DefaultAttributes attributes)
public boolean isSet(int attr)
isSet
in interface Attributes
public void set(int attr)
set
in interface Attributes
public void unset(int attr)
unset
in interface Attributes
public void clear()
clear
in interface Attributes
protected static final int noneAttr()
int
and how the Attributes
class uses it. The implementation may change without notice to address scaling or performance issues.protected static final int minAttr()
int
and how the Attributes
class uses it. The implementation may change without notice to address scaling or performance issues.protected static final int maxAttr()
int
and how the Attributes
class uses it. The implementation may change without notice to address scaling or performance issues.protected static final int incAttr(int curAttr)
int
and how the Attributes
class uses it. The implementation may change without notice to address scaling or performance issues.protected static final int decAttr(int curAttr)
int
and how the Attributes
class uses it. The implementation may change without notice to address scaling or performance issues.public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
protected final boolean equalsImpl(DefaultAttributes other)