/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!*/

package example;

// line 3 "../EnumerationTest_1.ump"
public class Student
{

  //------------------------
  // ENUMERATIONS
  //------------------------

  public enum Status { FullTime, PartTime }
  public enum Grade { High }
  public enum RelationshipStatus { Single, Married, Divorced }

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

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

  public Student()
  {}

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

  public void delete()
  {}

}
/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!*/

package example;
import java.util.*;

// line 3 "../EnumerationTest_2.ump"
public class X
{

  //------------------------
  // ENUMERATIONS
  //------------------------

  public enum Colour { Red, Blue, Green }

  //------------------------
  // STATIC VARIABLES
  //------------------------

  public static final int MY_CONST = 100;
  private static Map<String, X> xsByMyName = new HashMap<String, X>();

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

  //X Attributes
  private String myName;
  private String defaultAttr;

  //X State Machines
  public enum Sm { s1, s2 }
  private Sm sm;

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

  public X(String aDefaultAttr)
  {
    defaultAttr = aDefaultAttr;
    if (!setMyName(aMyName))
    {
      throw new RuntimeException("Cannot create due to duplicate myName. See https://manual.umple.org?RE003ViolationofUniqueness.html");
    }
    setSm(Sm.s1);
  }

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

  public boolean setMyName(String aMyName)
  {
    boolean wasSet = false;
    String anOldMyName = getMyName();
    if (anOldMyName != null && anOldMyName.equals(aMyName)) {
      return true;
    }
    if (hasWithMyName(aMyName)) {
      return wasSet;
    }
    myName = aMyName;
    wasSet = true;
    if (anOldMyName != null) {
      xsByMyName.remove(anOldMyName);
    }
    xsByMyName.put(aMyName, this);
    return wasSet;
  }

  public boolean setDefaultAttr(String aDefaultAttr)
  {
    boolean wasSet = false;
    defaultAttr = aDefaultAttr;
    wasSet = true;
    return wasSet;
  }

  public String getMyName()
  {
    return myName;
  }
  /* Code from template attribute_GetUnique */
  public static X getWithMyName(String aMyName)
  {
    return xsByMyName.get(aMyName);
  }
  /* Code from template attribute_HasUnique */
  public static boolean hasWithMyName(String aMyName)
  {
    return getWithMyName(aMyName) != null;
  }

  public String getDefaultAttr()
  {
    return defaultAttr;
  }

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

  public Sm getSm()
  {
    return sm;
  }

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

    return wasEventProcessed;
  }

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

  public void delete()
  {
    xsByMyName.remove(getMyName());
  }


  public String toString()
  {
    return super.toString() + "["+
            "myName" + ":" + getMyName()+ "," +
            "defaultAttr" + ":" + getDefaultAttr()+ "]";
  }
}
/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!*/

package example;

// line 6 "../EnumerationTest_3.ump"
public class C1
{

  //------------------------
  // ENUMERATIONS
  //------------------------

  public enum Status { Married, Single, Divorced }
  public enum Gender { Male, Female }

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

  //C1 Attributes
  private Status status;
  private Gender gender;

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

  public C1(Status aStatus, Gender aGender)
  {
    status = aStatus;
    gender = aGender;
  }

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

  public boolean setStatus(Status aStatus)
  {
    boolean wasSet = false;
    status = aStatus;
    wasSet = true;
    return wasSet;
  }

  public boolean setGender(Gender aGender)
  {
    boolean wasSet = false;
    gender = aGender;
    wasSet = true;
    return wasSet;
  }

  public Status getStatus()
  {
    return status;
  }

  public Gender getGender()
  {
    return gender;
  }

  public void delete()
  {}


  public String toString()
  {
    return super.toString() + "["+ "]" + System.getProperties().getProperty("line.separator") +
            "  " + "status" + "=" + (getStatus() != null ? !getStatus().equals(this)  ? getStatus().toString().replaceAll("  ","    ") : "this" : "null") + System.getProperties().getProperty("line.separator") +
            "  " + "gender" + "=" + (getGender() != null ? !getGender().equals(this)  ? getGender().toString().replaceAll("  ","    ") : "this" : "null");
  }
}
/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!*/

package example;

// line 11 "../EnumerationTest_3.ump"
public class C2
{

  //------------------------
  // ENUMERATIONS
  //------------------------

  public enum Status { Married, Single, Divorced }
  public enum Gender { Male, Female }

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

  //C2 Attributes
  private Status status;
  private Gender gender;

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

  public C2(Status aStatus, Gender aGender)
  {
    status = aStatus;
    gender = aGender;
  }

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

  public boolean setStatus(Status aStatus)
  {
    boolean wasSet = false;
    status = aStatus;
    wasSet = true;
    return wasSet;
  }

  public boolean setGender(Gender aGender)
  {
    boolean wasSet = false;
    gender = aGender;
    wasSet = true;
    return wasSet;
  }

  public Status getStatus()
  {
    return status;
  }

  public Gender getGender()
  {
    return gender;
  }

  public void delete()
  {}


  public String toString()
  {
    return super.toString() + "["+ "]" + System.getProperties().getProperty("line.separator") +
            "  " + "status" + "=" + (getStatus() != null ? !getStatus().equals(this)  ? getStatus().toString().replaceAll("  ","    ") : "this" : "null") + System.getProperties().getProperty("line.separator") +
            "  " + "gender" + "=" + (getGender() != null ? !getGender().equals(this)  ? getGender().toString().replaceAll("  ","    ") : "this" : "null");
  }
}
/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!*/

package example;

// line 5 "../EnumerationTest_4.ump"
public class C1
{

  //------------------------
  // ENUMERATIONS
  //------------------------

  public enum Status { Married, Single, Divorced }

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

  //C1 Attributes
  private Status status;

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

  public C1(Status aStatus)
  {
    status = aStatus;
  }

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

  public boolean setStatus(Status aStatus)
  {
    boolean wasSet = false;
    status = aStatus;
    wasSet = true;
    return wasSet;
  }

  public Status getStatus()
  {
    return status;
  }

  public void delete()
  {}


  public String toString()
  {
    return super.toString() + "["+ "]" + System.getProperties().getProperty("line.separator") +
            "  " + "status" + "=" + (getStatus() != null ? !getStatus().equals(this)  ? getStatus().toString().replaceAll("  ","    ") : "this" : "null");
  }
}
/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!*/

package example;

// line 9 "../EnumerationTest_4.ump"
public class C2
{

  //------------------------
  // ENUMERATIONS
  //------------------------

  public enum Status { Married, Single, Divorced }
  public enum Gender { Male, Female }

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

  //C2 Attributes
  private Gender gender;
  private Status status;

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

  public C2(Gender aGender, Status aStatus)
  {
    gender = aGender;
    status = aStatus;
  }

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

  public boolean setGender(Gender aGender)
  {
    boolean wasSet = false;
    gender = aGender;
    wasSet = true;
    return wasSet;
  }

  public boolean setStatus(Status aStatus)
  {
    boolean wasSet = false;
    status = aStatus;
    wasSet = true;
    return wasSet;
  }

  public Gender getGender()
  {
    return gender;
  }

  public Status getStatus()
  {
    return status;
  }

  public void delete()
  {}


  public String toString()
  {
    return super.toString() + "["+ "]" + System.getProperties().getProperty("line.separator") +
            "  " + "gender" + "=" + (getGender() != null ? !getGender().equals(this)  ? getGender().toString().replaceAll("  ","    ") : "this" : "null") + System.getProperties().getProperty("line.separator") +
            "  " + "status" + "=" + (getStatus() != null ? !getStatus().equals(this)  ? getStatus().toString().replaceAll("  ","    ") : "this" : "null");
  }
}
/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!*/

package example;

// line 6 "../EnumerationTest_5.ump"
public class X1
{

  //------------------------
  // ENUMERATIONS
  //------------------------

  public enum Month { January, February, March }

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

  //X1 Attributes
  private Month month;

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

  public X1(Month aMonth)
  {
    month = aMonth;
  }

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

  public boolean setMonth(Month aMonth)
  {
    boolean wasSet = false;
    month = aMonth;
    wasSet = true;
    return wasSet;
  }

  public Month getMonth()
  {
    return month;
  }

  public void delete()
  {}


  public String toString()
  {
    return super.toString() + "["+ "]" + System.getProperties().getProperty("line.separator") +
            "  " + "month" + "=" + (getMonth() != null ? !getMonth().equals(this)  ? getMonth().toString().replaceAll("  ","    ") : "this" : "null");
  }
}
/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!*/

package example;

// line 10 "../EnumerationTest_5.ump"
public class X2
{

  //------------------------
  // ENUMERATIONS
  //------------------------

  public enum Fruit { Apple, Orange }

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

  //X2 Attributes
  private Fruit t;

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

  public X2(Fruit aT)
  {
    t = aT;
  }

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

  public boolean setT(Fruit aT)
  {
    boolean wasSet = false;
    t = aT;
    wasSet = true;
    return wasSet;
  }

  public Fruit getT()
  {
    return t;
  }

  public void delete()
  {}


  public String toString()
  {
    return super.toString() + "["+ "]" + System.getProperties().getProperty("line.separator") +
            "  " + "t" + "=" + (getT() != null ? !getT().equals(this)  ? getT().toString().replaceAll("  ","    ") : "this" : "null");
  }
}
/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!*/

package example;

// line 6 "../EnumerationTest_6.ump"
public class X
{

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

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

  public X()
  {}

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

  public void delete()
  {}

}
/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!*/

package example;

// line 1 "../EnumerationTest_6.ump"
public class X2
{

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

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

  public X2()
  {}

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

  public void delete()
  {}

}
/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!*/

package example;

// line 5 "../EnumerationTest_7.ump"
public class X
{

  //------------------------
  // ENUMERATIONS
  //------------------------

  public enum Month { Jan, Feb, Mar }

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

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

  public X()
  {}

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

  public void delete()
  {}

  // line 6 "../EnumerationTest_7.ump"
  public String displayMonth(Month m){
    return(m.toString())
  }

}
/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!*/

package example;

// line 9 "../EnumerationTest_7.ump"
public class Y
{

  //------------------------
  // ENUMERATIONS
  //------------------------

  public enum Month { Jan, Feb, Mar }

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

  //Y State Machines
  public enum Sm { s1, s2 }
  private Sm sm;

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

  public Y()
  {
    setSm(Sm.s1);
  }

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

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

  public Sm getSm()
  {
    return sm;
  }

  public boolean goToS2(Month m)
  {
    boolean wasEventProcessed = false;
    
    Sm aSm = sm;
    switch (aSm)
    {
      case s1:
        // line 12 "../EnumerationTest_7.ump"
        System.out.println(m);
        setSm(Sm.s2);
        wasEventProcessed = true;
        break;
      default:
        // Other states do respond to this event
    }

    return wasEventProcessed;
  }

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

  public void delete()
  {}

}
/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!*/

package example;

// line 18 "../EnumerationTest_7.ump"
public class Z
{

  //------------------------
  // ENUMERATIONS
  //------------------------

  public enum Month { Jan, Feb, Mar }

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

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

  public Z()
  {}

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

  public void delete()
  {}

  // line 19 "../EnumerationTest_7.ump"
  public Month getBirthMonth(){
    return Month.Jan;
  }

}
/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!*/

package example;

// line 7 "../EnumerationTest_8.ump"
public class A
{

  //------------------------
  // ENUMERATIONS
  //------------------------

  public enum Month { O, P, Q }

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

  //A Attributes
  private Month m;
  private Month p;

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

  public A(Month aM, Month aP)
  {
    m = aM;
    p = aP;
  }

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

  public boolean setM(Month aM)
  {
    boolean wasSet = false;
    m = aM;
    wasSet = true;
    return wasSet;
  }

  public boolean setP(Month aP)
  {
    boolean wasSet = false;
    p = aP;
    wasSet = true;
    return wasSet;
  }

  public Month getM()
  {
    return m;
  }

  public Month getP()
  {
    return p;
  }

  public void delete()
  {}


  public String toString()
  {
    return super.toString() + "["+ "]" + System.getProperties().getProperty("line.separator") +
            "  " + "m" + "=" + (getM() != null ? !getM().equals(this)  ? getM().toString().replaceAll("  ","    ") : "this" : "null") + System.getProperties().getProperty("line.separator") +
            "  " + "p" + "=" + (getP() != null ? !getP().equals(this)  ? getP().toString().replaceAll("  ","    ") : "this" : "null");
  }
}
/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!*/


import java.util.*;

// line 7 "EnumerationTest_9.ump"
public class Bar
{

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

  //Bar Associations
  private List<Foo> foos;

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

  public Bar()
  {
    foos = new ArrayList<Foo>();
  }

  //------------------------
  // INTERFACE
  //------------------------
  /* Code from template association_GetMany */
  public Foo getFoo(int index)
  {
    Foo aFoo = foos.get(index);
    return aFoo;
  }

  public List<Foo> getFoos()
  {
    List<Foo> newFoos = Collections.unmodifiableList(foos);
    return newFoos;
  }

  public int numberOfFoos()
  {
    int number = foos.size();
    return number;
  }

  public boolean hasFoos()
  {
    boolean has = foos.size() > 0;
    return has;
  }

  public int indexOfFoo(Foo aFoo)
  {
    int index = foos.indexOf(aFoo);
    return index;
  }
  /* Code from template association_MinimumNumberOfMethod */
  public static int minimumNumberOfFoos()
  {
    return 0;
  }
  /* Code from template association_AddManyToOne */
  public Foo addFoo(Foo.Baz aMyBaz, String aMyStr)
  {
    return new Foo(aMyBaz, aMyStr, this);
  }

  public boolean addFoo(Foo aFoo)
  {
    boolean wasAdded = false;
    if (foos.contains(aFoo)) { return false; }
    Bar existingBar = aFoo.getBar();
    boolean isNewBar = existingBar != null && !this.equals(existingBar);
    if (isNewBar)
    {
      aFoo.setBar(this);
    }
    else
    {
      foos.add(aFoo);
    }
    wasAdded = true;
    return wasAdded;
  }

  public boolean removeFoo(Foo aFoo)
  {
    boolean wasRemoved = false;
    //Unable to remove aFoo, as it must always have a bar
    if (!this.equals(aFoo.getBar()))
    {
      foos.remove(aFoo);
      wasRemoved = true;
    }
    return wasRemoved;
  }
  /* Code from template association_AddIndexControlFunctions */
  public boolean addFooAt(Foo aFoo, int index)
  {  
    boolean wasAdded = false;
    if(addFoo(aFoo))
    {
      if(index < 0 ) { index = 0; }
      if(index > numberOfFoos()) { index = numberOfFoos() - 1; }
      foos.remove(aFoo);
      foos.add(index, aFoo);
      wasAdded = true;
    }
    return wasAdded;
  }

  public boolean addOrMoveFooAt(Foo aFoo, int index)
  {
    boolean wasAdded = false;
    if(foos.contains(aFoo))
    {
      if(index < 0 ) { index = 0; }
      if(index > numberOfFoos()) { index = numberOfFoos() - 1; }
      foos.remove(aFoo);
      foos.add(index, aFoo);
      wasAdded = true;
    } 
    else 
    {
      wasAdded = addFooAt(aFoo, index);
    }
    return wasAdded;
  }

  public void delete()
  {
    for(int i=foos.size(); i > 0; i--)
    {
      Foo aFoo = foos.get(i - 1);
      aFoo.delete();
    }
  }

}
/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!*/

package enumerations;
import java.util.*;

// line 3 "../EnumerationTest_innerQualified_1.ump"
public class Driver
{

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

  //Driver Associations
  private List<DriverSchedule> driverSchedules;

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

  public Driver()
  {
    driverSchedules = new ArrayList<DriverSchedule>();
  }

  //------------------------
  // INTERFACE
  //------------------------
  /* Code from template association_GetMany */
  public DriverSchedule getDriverSchedule(int index)
  {
    DriverSchedule aDriverSchedule = driverSchedules.get(index);
    return aDriverSchedule;
  }

  public List<DriverSchedule> getDriverSchedules()
  {
    List<DriverSchedule> newDriverSchedules = Collections.unmodifiableList(driverSchedules);
    return newDriverSchedules;
  }

  public int numberOfDriverSchedules()
  {
    int number = driverSchedules.size();
    return number;
  }

  public boolean hasDriverSchedules()
  {
    boolean has = driverSchedules.size() > 0;
    return has;
  }

  public int indexOfDriverSchedule(DriverSchedule aDriverSchedule)
  {
    int index = driverSchedules.indexOf(aDriverSchedule);
    return index;
  }
  /* Code from template association_MinimumNumberOfMethod */
  public static int minimumNumberOfDriverSchedules()
  {
    return 0;
  }
  /* Code from template association_AddManyToOne */
  public DriverSchedule addDriverSchedule(DriverSchedule.Shift aShift, DriverSchedule.Status aStatus)
  {
    return new DriverSchedule(aShift, aStatus, this);
  }

  public boolean addDriverSchedule(DriverSchedule aDriverSchedule)
  {
    boolean wasAdded = false;
    if (driverSchedules.contains(aDriverSchedule)) { return false; }
    Driver existingDriver = aDriverSchedule.getDriver();
    boolean isNewDriver = existingDriver != null && !this.equals(existingDriver);
    if (isNewDriver)
    {
      aDriverSchedule.setDriver(this);
    }
    else
    {
      driverSchedules.add(aDriverSchedule);
    }
    wasAdded = true;
    return wasAdded;
  }

  public boolean removeDriverSchedule(DriverSchedule aDriverSchedule)
  {
    boolean wasRemoved = false;
    //Unable to remove aDriverSchedule, as it must always have a driver
    if (!this.equals(aDriverSchedule.getDriver()))
    {
      driverSchedules.remove(aDriverSchedule);
      wasRemoved = true;
    }
    return wasRemoved;
  }
  /* Code from template association_AddIndexControlFunctions */
  public boolean addDriverScheduleAt(DriverSchedule aDriverSchedule, int index)
  {  
    boolean wasAdded = false;
    if(addDriverSchedule(aDriverSchedule))
    {
      if(index < 0 ) { index = 0; }
      if(index > numberOfDriverSchedules()) { index = numberOfDriverSchedules() - 1; }
      driverSchedules.remove(aDriverSchedule);
      driverSchedules.add(index, aDriverSchedule);
      wasAdded = true;
    }
    return wasAdded;
  }

  public boolean addOrMoveDriverScheduleAt(DriverSchedule aDriverSchedule, int index)
  {
    boolean wasAdded = false;
    if(driverSchedules.contains(aDriverSchedule))
    {
      if(index < 0 ) { index = 0; }
      if(index > numberOfDriverSchedules()) { index = numberOfDriverSchedules() - 1; }
      driverSchedules.remove(aDriverSchedule);
      driverSchedules.add(index, aDriverSchedule);
      wasAdded = true;
    } 
    else 
    {
      wasAdded = addDriverScheduleAt(aDriverSchedule, index);
    }
    return wasAdded;
  }

  public void delete()
  {
    for(int i=driverSchedules.size(); i > 0; i--)
    {
      DriverSchedule aDriverSchedule = driverSchedules.get(i - 1);
      aDriverSchedule.delete();
    }
  }

}