com.qualcomm.robotcore.hardware

## Class LightMultiplexor

- java.lang.Object
- - com.qualcomm.robotcore.hardware.LightMultiplexor

- All Implemented Interfaces:
    Light, SwitchableLight

      public class LightMultiplexor
      extends java.lang.Object
      implements SwitchableLight

  A `LightMultiplexor` adapts a second `SwitchableLight` by adding reference counting to `SwitchableLight.enableLight(boolean)`: the light will be lit if the net number of enables is greater than zero.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `enableCount`
    `protected static java.util.Set<LightMultiplexor>` | `extantMultiplexors`
    `protected SwitchableLight` | `target`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `LightMultiplexor(SwitchableLight target)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `enableLight(boolean enable)` Turns the light on or off.
    `static LightMultiplexor` | `forLight(SwitchableLight target)`
    `boolean` | `isLightOn()` Answers whether the light is on or off

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

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

- - ### Field Detail

    - #### extantMultiplexors

          protected static final java.util.Set<LightMultiplexor> extantMultiplexors

    - #### target

          protected final SwitchableLight target

    - #### enableCount

          protected int enableCount

  - ### Constructor Detail

    - #### LightMultiplexor

          protected LightMultiplexor(SwitchableLight target)

  - ### Method Detail

    - #### forLight

          public static LightMultiplexor forLight(SwitchableLight target)

    - #### isLightOn

          public boolean isLightOn()

      Description copied from interface: `Light`
      Answers whether the light is on or off
      Specified by:
        `isLightOn` in interface `Light`
      Returns:
        whether the light is on or off

    - #### enableLight

          public void enableLight(boolean enable)

      Description copied from interface: `SwitchableLight`
      Turns the light on or off.
      Specified by:
        `enableLight` in interface `SwitchableLight`
      Parameters:
        `enable` - if true, the light turns on; otherwise the light turns off