/*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
 */
// line 2 "LanguageAlternativesGuards.ump"
public class Lamp
{

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

  //Lamp Attributes
  private int n;

  //Lamp State Machines
  public enum Sm { Off, On }
  private Sm sm;

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

  public Lamp()
  {
    n = 0;
    setSm(Sm.Off);
  }

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

  public boolean setN(int aN)
  {
    boolean wasSet = false;
    n = aN;
    wasSet = true;
    return wasSet;
  }

  public int getN()
  {
    return n;
  }

  public String getSmFullName()
  {
    String answer = sm.toString();
    return answer;
  }

  public Sm getSm()
  {
    return sm;
  }

  public boolean flip()
  {
    boolean wasEventProcessed = false;
    
    Sm aSm = sm;
    switch (aSm)
    {
      case Off:
        exitSm();
        setSm(Sm.On);
        wasEventProcessed = true;
        break;
      case On:
        setSm(Sm.Off);
        wasEventProcessed = true;
        break;
      default:
        // Other states do respond to this event
    }

    return wasEventProcessed;
  }

  private void exitSm()
  {
    switch(sm)
    {
      case Off:
        // line 7 "LanguageAlternativesGuards.ump"
        if (n < 9)
        {
          n = 5;
        }
        break;
    }
  }

  private void setSm(Sm aSm)
  {
    sm = aSm;

    // entry actions and do activities
    switch(sm)
    {
      case Off:
        // line 6 "LanguageAlternativesGuards.ump"
        if (n > 1)
        {
          n = 2;
        }
        break;
    }
  }

  public void delete()
  {}


  public String toString()
  {
    return super.toString() + "["+
            "n" + ":" + getN()+ "]";
  }
}
/*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)
 */
// line 2 "LanguageAlternativesContracts.ump"
public class Account
{

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

  //Account Attributes
  private int balance;

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

  public Account()
  {
    balance = 0;
  }

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

  public boolean setBalance(int aBalance)
  {
    boolean wasSet = false;
    balance = aBalance;
    wasSet = true;
    return wasSet;
  }

  public int getBalance()
  {
    return balance;
  }

  public void delete()
  {}

  // line 7 "LanguageAlternativesContracts.ump"
  // line 7 "LanguageAlternativesContracts.ump"
  public int deposit(int amount){
    int result = deposit_Original(amount);
    if (amount>=1000)
    {
        throw new RuntimeException("Please provide a valid amount");
    }
    return result;
  }

  public int deposit_Original(int amount){

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

  // line 11 "LanguageAlternativesContracts.ump"
  public int deposit(String note){

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

  // line 15 "LanguageAlternativesContracts.ump"
  public int withdraw(int amount){

    if (amount>=100)
    {
        throw new RuntimeException("Please provide a valid amount");
    }
    return amount;
  }

  // line 25 "LanguageAlternativesContracts.ump"
  public int close(int code){

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

  // line 33 "LanguageAlternativesContracts.ump"
  public int limit(int v){

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

  // line 42 "LanguageAlternativesContracts.ump"
  public int refine(int v){

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


  public String toString()
  {
    return super.toString() + "["+
            "balance" + ":" + getBalance()+ "]";
  }
}
/*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
 */
// line 2 "LanguageAlternativesBodies.ump"
public abstract class Shape
{

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

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

  public Shape()
  {}

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

  public void delete()
  {}

  // line 3 "LanguageAlternativesBodies.ump"
  public int area(){
    return 1;
  }

  // line 5 "LanguageAlternativesBodies.ump"
  public void resize(){
    int y = 2;
  }

  public abstract int perimeter();

}