|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.moyoman.module.Mode
This class represents the different modes that the server can use. The ordering of module and helper implementations for a given type is done per mode. There are standard modes, and there can be user-defined modes as well.
Field Summary | |
static Mode |
BEST
|
static Mode |
FAST
|
private String |
mode
The name of the mode, e.g, Best. |
private static HashMap |
standard
The key is the mode name converted to lower case, and the value is the mode object. |
private static HashMap |
user
The key is the mode name converted to lower case, and the value is the mode object. |
Constructor Summary | |
protected |
Mode(String type)
Create a user defined mode. |
private |
Mode(String type,
boolean isStandard)
Create a new Mode object. |
Method Summary | |
protected static void |
addMode(String name)
Add a new user defined mode. |
protected static void |
cancel()
Cancel any changes to the user defined modes, and reread the information from file. |
protected void |
deleteMode()
Delete the user defined mode. |
boolean |
equals(Object o)
Override the Object.equals() method. |
static Mode |
get(String name)
Get the Mode object of the given name. |
static Mode[] |
getAllModes()
Return an array of all of the modes. |
private static String |
getFileName()
Get the name of the file in which the user defined modes are listed. |
static Mode[] |
getUserModes()
Return an array of all of the user defined modes. |
int |
hashCode()
Return a hash code value for the mode. |
boolean |
isUserMode()
Determine if the mode is a user mode. |
private static void |
readUserModes()
Read the file which lists the user defined modes. |
protected static void |
save()
Write out any user defined mode information to a file. |
private void |
setVars(String type,
boolean isStandard)
Set the internal variables of this object. |
String |
toString()
Return a String representation of the mode. |
private static void |
writeUserModes()
Write out the user defined mode information to a file. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final Mode BEST
public static final Mode FAST
private static HashMap standard
private static HashMap user
private String mode
Constructor Detail |
private Mode(String type, boolean isStandard)
type
- The name of the mode.isStandard
- If true, then this is a standard mode, otherwise, false.protected Mode(String type) throws DataAlreadyExistsException
type
- The mode to be used.
DataAlreadyExistsException
- Thrown if the mode already exists.Method Detail |
private void setVars(String type, boolean isStandard)
type
- The mode nameisStandard
- if true, then the mode is a standard mode.protected static void addMode(String name) throws DataAlreadyExistsException
name
- The name of the mode.
DataAlreadyExistsException
- Thrown if the mode name is already in use.protected void deleteMode() throws NoSuchDataException, PermissionsException
PermissionsException
- - Thrown if the mode is a standard one.
NoSuchDataException
public static Mode get(String name) throws NoSuchDataException
name
- The name of the mode.
NoSuchDataException
- - Thrown if there is no such mode.public static Mode[] getAllModes()
public static Mode[] getUserModes()
private static void readUserModes()
private static void writeUserModes()
protected static void save()
protected static void cancel()
private static String getFileName()
public boolean isUserMode()
public String toString()
toString
in class Object
public int hashCode()
hashCode
in class Object
public boolean equals(Object o)
equals
in class Object
o
- The object being tested.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |