|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectnet.lucidviews.util.Enumeration
An enumerated list of values.
An enumeration is a finite set of distinct values.
Each value in an Enumeration is an instance of an
EnumValue. Creating an enumeration simply requires you to
create a sub-class of EnumValue - see the documentation of that
class for more information.
Note: Java version 1.5 contains support for enum types. These classes
(Enumeration and EnumValue) are provided to give
backwards compatibiity with previous versions of Java.
EnumValue| Field Summary | |
protected java.lang.Class |
_enumType
The type of enumeration values. |
protected java.util.ArrayList |
_values
The values in this enumeration. |
| Constructor Summary | |
Enumeration()
Create an enumeration. |
|
Enumeration(int initialCapacity)
Create an enumeration, specifying the number of values so that the enumeration list can be sized at creation, thereby improving performance. |
|
| Method Summary | |
(package private) int |
addValue(EnumValue value)
Add a value to this enumeration. |
boolean |
equals(java.lang.Object obj)
|
java.lang.Class |
getType()
Returns the type of enum value being stored in this enumeration. |
int |
hashCode()
|
boolean |
isEmpty()
Tests if this enumeration has no values. |
java.util.ListIterator |
listIterator()
Returns an iterator of the values in this enumeration (in proper sequence). |
EnumValue |
lookupValue(java.lang.Object value)
Lookup a value in this enumeration. |
int |
size()
Returns the number of values in this enumeration. |
java.lang.Object[] |
toArray()
Returns an array containing all of the values in this enumeration in the correct order. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected java.util.ArrayList _values
protected java.lang.Class _enumType
| Constructor Detail |
public Enumeration(int initialCapacity)
initialCapacity - the expected number of values in this enumerationpublic Enumeration()
| Method Detail |
int addValue(EnumValue value)
throws java.lang.IllegalStateException
EnumValue class. Attempting to add a
different type of value to the enumeration will result in an exception.
Enumerations are not editable once they have been created.
This method should only be called from within the EnumValue
class while the list of enumeration values is being built. Therefore this
method has been given package scope to prevent the list being changed
after it has been created.
value - enumeration value to be added to this list
java.lang.IllegalStateException - invalid value for this list
public EnumValue lookupValue(java.lang.Object value)
throws java.util.NoSuchElementException
value parameter can be any Object. The
return value is always an EnumValue that is considered equal
(using the equals method to compare values) to the specified
value.
Enumeration contains an EnumValue
with id 6 and string-value "yard":
lookupValue( "yard" );
lookupValue( new Integer( 6 ) );
EnumValue instance.
value - the value to find
java.util.NoSuchElementException - the value could not be foundpublic java.lang.Class getType()
null if no values have been added to this
enumeration list.
public int size()
public boolean isEmpty()
true if no values have been defined in this
enuemration; false otherwisepublic java.lang.Object[] toArray()
public java.util.ListIterator listIterator()
EnumValuepublic java.lang.String toString()
public int hashCode()
public boolean equals(java.lang.Object obj)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||