<?php
/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.22.0.5146 modeling language!*/

class LightFixture
{

  //------------------------
  // MEMBER VARIABLES
  //------------------------

  //LightFixture Attributes
  private $brightness;

  //LightFixture State Machines
  private static $BulbOn = 1;
  private static $BulbOff = 2;
  private static $BulbAmber = 3;
  private $bulb;

  //------------------------
  // CONSTRUCTOR
  //------------------------

  public function __construct()
  {
    $this->brightness = 0;
    $this->setBulb(self::$BulbOn);
  }

  //------------------------
  // INTERFACE
  //------------------------

  public function setBrightness($aBrightness)
  {
    $wasSet = false;
    $this->brightness = $aBrightness;
    $wasSet = true;
    return $wasSet;
  }

  public function getBrightness()
  {
    return $this->brightness;
  }

  public function getBulbFullName()
  {
    $answer = $this->getBulb();
    return $answer;
  }

  public function getBulb()
  {
    if ($this->bulb == self::$BulbOn) { return "BulbOn"; }
    elseif ($this->bulb == self::$BulbOff) { return "BulbOff"; }
    elseif ($this->bulb == self::$BulbAmber) { return "BulbAmber"; }
    return null;
  }

  public function push()
  {
    $wasEventProcessed = false;
    
    $aBulb = $this->bulb;
    if ($aBulb == self::$BulbOn)
    {
      if ($this->getBrightness()<1)
      {
        $this->setBulb(self::$BulbOff);
        $wasEventProcessed = true;
      }
      if ($this->getBrightness()>10)
      {
        $this->setBulb(self::$BulbAmber);
        $wasEventProcessed = true;
      }
    }
    return $wasEventProcessed;
  }

  private function setBulb($aBulb)
  {
    $this->bulb = $aBulb;
  }

  public function equals($compareTo)
  {
    return $this == $compareTo;
  }

  public function delete()
  {}

}
?>