s3games.util

## Class Switch

- java.lang.Object
- - s3games.util.Switch

-     public class Switch
      extends java.lang.Object

  A switch is used to hold a logical value on/off, and notify all its registered listeners whenever it changes its value

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Switch()` construct a new switch in off state

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addSwitchListener(SwitchListener l)` add a new listener to this switch
    `int` | `getValue()` retrieve the user value of this switch
    `boolean` | `isOff()` determine if the switch is in off position
    `boolean` | `isOn()` determine if the switch is in on position
    `void` | `off()` set the switch to the off position
    `void` | `on()` set the switch to on position
    `void` | `setValue(int newValue)` set new user value of this switch

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Switch

          public Switch()

      construct a new switch in off state

  - ### Method Detail

    - #### addSwitchListener

          public void addSwitchListener(SwitchListener l)

      add a new listener to this switch

    - #### on

          public void on()

      set the switch to on position

    - #### off

          public void off()

      set the switch to the off position

    - #### isOn

          public boolean isOn()

      determine if the switch is in on position

    - #### isOff

          public boolean isOff()

      determine if the switch is in off position

    - #### setValue

          public void setValue(int newValue)

      set new user value of this switch

    - #### getValue

          public int getValue()

      retrieve the user value of this switch