uk.ac.ic.doc.game
Enum Key

java.lang.Object
  extended by java.lang.Enum<Key>
      extended by uk.ac.ic.doc.game.Key
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Key>

public enum Key
extends java.lang.Enum<Key>

Represents keys on the keyboard that a game can respond to.


Enum Constant Summary
down
           
left
           
right
           
space
           
up
           
 
Method Summary
static Key fromKeyCode(int keyCode)
          Returns the Key that matches the given key code, or null if no such Key could be found.
static Key valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static Key[] values()
          Returns an array containing the constants of this enum type, in the order they're declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

up

public static final Key up

down

public static final Key down

left

public static final Key left

right

public static final Key right

space

public static final Key space
Method Detail

values

public static final Key[] values()
Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants as follows:
for(Key c : Key.values())
        System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they're declared

valueOf

public static Key valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name

fromKeyCode

public static final Key fromKeyCode(int keyCode)
Returns the Key that matches the given key code, or null if no such Key could be found.

Parameters:
keyCode - The key code to return the corresponding Key of.
Returns:
The Key with the given key code.