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

// A guard on an entry or exit action guards the body each language selects, tagged or not
class Lamp
{

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

  //Lamp Attributes
  private $n;

  //Lamp State Machines
  private static $SmOff = 1;
  private static $SmOn = 2;
  private $sm;

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

  public function __construct()
  {
    $this->n = 0;
    $this->setSm(self::$SmOff);
  }

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

  public function setN($aN)
  {
    $wasSet = false;
    $this->n = $aN;
    $wasSet = true;
    return $wasSet;
  }

  public function getN()
  {
    return $this->n;
  }

  public function getSmFullName()
  {
    $answer = $this->getSm();
    return $answer;
  }

  public function getSm()
  {
    if ($this->sm == self::$SmOff) { return "SmOff"; }
    elseif ($this->sm == self::$SmOn) { return "SmOn"; }
    return null;
  }

  public function flip()
  {
    $wasEventProcessed = false;
    
    $aSm = $this->sm;
    if ($aSm == self::$SmOff)
    {
      $this->exitSm();
      $this->setSm(self::$SmOn);
      $wasEventProcessed = true;
    }
    elseif ($aSm == self::$SmOn)
    {
      $this->setSm(self::$SmOff);
      $wasEventProcessed = true;
    }
    return $wasEventProcessed;
  }

  private function exitSm()
  {
    if ($this->sm == self::$SmOff)
    {
      if (n < 9)
        {
          n = 4;
        }
    }
  }

  private function setSm($aSm)
  {
    $this->sm = $aSm;

    // entry actions and do activities
    if ($this->sm == self::$SmOff)
    {
      if (n > 1)
        {
          $this->n = 3;
        }
    }
  }

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

  public function delete()
  {}

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

// Each pre or postcondition belongs to its method and to the body written with it (#2250)
class Account
{

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

  //Account Attributes
  private $balance;

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

  public function __construct()
  {
    $this->balance = 0;
  }

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

  public function setBalance($aBalance)
  {
    $wasSet = false;
    $this->balance = $aBalance;
    $wasSet = true;
    return $wasSet;
  }

  public function getBalance()
  {
    return $this->balance;
  }

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

  public function delete()
  {}

  public function deposit(int $amount)
  {
    $result = depositOriginal(int $amount);
    if ($this->amount>=1000)
    {
        throw new RuntimeException("Please provide a valid amount");
    }
    return $result;
  }

  public function depositOriginal(int $amount)
  {

    if ($this->amount<=0)
    {
        throw new RuntimeException("Please provide a valid amount");
    }
    return amount;
  }

  public function deposit($note)
  {

    if ($this->note==$this->null)
    {
        throw new RuntimeException("Please provide a valid note and null");
    }
    return 0;
  }

  public function withdraw(int $amount)
  {

    if ($this->amount>=200)
    {
        throw new RuntimeException("Please provide a valid amount");
    }
    return $amount;
  }

  public function close(int $code)
  {

    if ($this->code<=1)
    {
        throw new RuntimeException("Please provide a valid code");
    }
    return code;
  }

  public function limit(int $v)
  {

    if ($this->v<=0)
    {
        throw new RuntimeException("Please provide a valid v");
    }
    return $v;
  }

  public function refine(int $v)
  {

    if ($this->v>=50)
    {
        throw new RuntimeException("Please provide a valid v");
    }
    return v;
  }

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

// An untagged body is every language's fallback; a method with bodies only for other languages is left out
abstract class Shape
{

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

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

  public function __construct()
  {}

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

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

  public function delete()
  {}

  public function area()
  {
    return 1;
  }

  public function resize()
  {
    $x = 1;
  }

  public abstract function perimeter();
}
?>