us.asciiroth.client.core
Class State

java.lang.Object
  extended by us.asciiroth.client.core.State

public class State
extends java.lang.Object

A typesafe enum that represents anything that has a boolean state, such as doors (open or closed), switches (on or off), etc.


Field Summary
static State OFF
          A piece in the off state.
static State ON
          A piece in the on state.
 
Method Summary
static State byName(java.lang.String name)
          Retrieve the state by name (either "on" or "off").
 java.lang.String getName()
          Get the name of the current state
 boolean isOff()
          Is this state the OFF state?
 boolean isOn()
          Is this state the ON state?
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OFF

public static final State OFF
A piece in the off state.


ON

public static final State ON
A piece in the on state.

Method Detail

byName

public static State byName(java.lang.String name)
Retrieve the state by name (either "on" or "off").

Parameters:
name - the name of the state object to retrieve
Returns:
a state constant, or null if the name matches none

getName

public java.lang.String getName()
Get the name of the current state

Returns:
either "on" or "off"

isOff

public boolean isOff()
Is this state the OFF state?

Returns:
true if equal to State.OFF, false otherwise

isOn

public boolean isOn()
Is this state the ON state?

Returns:
true if equal to State.ON, false otherwise

0.7

2009 Alx Dark