|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--shared.MEnum
The MEnum class implements a dynamic enumeration type. This type is implemented using a list of (name, value) pairs which define the enumeration. The same name is assumed not to appear twice in the list. We do not check for this condition until the destructor because it requires time quadratic on the length of the list to check.
| Constructor Summary | |
MEnum()
Constructor. |
|
MEnum(MEnum other)
Copy constructor. |
|
MEnum(java.lang.String name,
int value)
Constructor which takes a name and a value. |
|
| Method Summary | |
void |
append(MEnum other)
Appends one enumeration onto another. |
void |
assign(MEnum src)
Makes this MEnum object equivalent to the given MEnum object. |
boolean |
check_value(int value)
Checks if the value is not in this MEnum object. |
void |
display(java.io.Writer out)
Displays the enumeration. |
void |
display(java.io.Writer out,
boolean full)
Displays the enumeration. |
java.lang.String |
name_from_value(int value)
Finds the name given a value. |
void |
OK()
Invariant checker. |
int |
value_from_name(java.lang.String name)
Finds a value given its name. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Constructor Detail |
public MEnum()
public MEnum(java.lang.String name,
int value)
name - The name of a value to be placed in this MEnum object.value - The value to be placed in this MEnum object.public MEnum(MEnum other)
other - The MEnum object to be copied.| Method Detail |
public void OK()
public void append(MEnum other)
other - The MEnum object to be appended to this MEnum object.public void assign(MEnum src)
src - The MEnum object to which this MEnum object will be equivalent.
public void display(java.io.Writer out,
boolean full)
out - The Writer to which this MEnum object will be displayed.full - TRUE if values are to be displayed with their names, FALSE if only names
are to be displayed.public void display(java.io.Writer out)
out - The Writer to which this MEnum object will be displayed.public int value_from_name(java.lang.String name)
name - The name for which a value is requested.public java.lang.String name_from_value(int value)
value - The value for which a name is requested.value_from_name(String)public boolean check_value(int value)
value - The value to be checked.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||