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


import java.util.*;

// line 1 "DuplicateInterfaceAssociationMethodsTest1.ump"
public class First implements I
{

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

  //First Associations
  private List<Second> seconds;

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

  public First()
  {
    seconds = new ArrayList<Second>();
  }

  //------------------------
  // INTERFACE
  //------------------------
  /* Code from template association_GetMany */
  public Second getSecond(int index)
  {
    Second aSecond = seconds.get(index);
    return aSecond;
  }

  public List<Second> getSeconds()
  {
    List<Second> newSeconds = Collections.unmodifiableList(seconds);
    return newSeconds;
  }

  public int numberOfSeconds()
  {
    int number = seconds.size();
    return number;
  }

  public boolean hasSeconds()
  {
    boolean has = seconds.size() > 0;
    return has;
  }

  public int indexOfSecond(Second aSecond)
  {
    int index = seconds.indexOf(aSecond);
    return index;
  }
  /* Code from template association_MinimumNumberOfMethod */
  public static int minimumNumberOfSeconds()
  {
    return 0;
  }
  /* Code from template association_AddManyToManyMethod */
  public boolean addSecond(Second aSecond)
  {
    boolean wasAdded = false;
    if (seconds.contains(aSecond)) { return false; }
    seconds.add(aSecond);
    if (aSecond.indexOfFirst(this) != -1)
    {
      wasAdded = true;
    }
    else
    {
      wasAdded = aSecond.addFirst(this);
      if (!wasAdded)
      {
        seconds.remove(aSecond);
      }
    }
    return wasAdded;
  }
  /* Code from template association_RemoveMany */
  public boolean removeSecond(Second aSecond)
  {
    boolean wasRemoved = false;
    if (!seconds.contains(aSecond))
    {
      return wasRemoved;
    }

    int oldIndex = seconds.indexOf(aSecond);
    seconds.remove(oldIndex);
    if (aSecond.indexOfFirst(this) == -1)
    {
      wasRemoved = true;
    }
    else
    {
      wasRemoved = aSecond.removeFirst(this);
      if (!wasRemoved)
      {
        seconds.add(oldIndex,aSecond);
      }
    }
    return wasRemoved;
  }
  /* Code from template association_AddIndexControlFunctions */
  public boolean addSecondAt(Second aSecond, int index)
  {  
    boolean wasAdded = false;
    if(addSecond(aSecond))
    {
      if(index < 0 ) { index = 0; }
      if(index > numberOfSeconds()) { index = numberOfSeconds() - 1; }
      seconds.remove(aSecond);
      seconds.add(index, aSecond);
      wasAdded = true;
    }
    return wasAdded;
  }

  public boolean addOrMoveSecondAt(Second aSecond, int index)
  {
    boolean wasAdded = false;
    if(seconds.contains(aSecond))
    {
      if(index < 0 ) { index = 0; }
      if(index > numberOfSeconds()) { index = numberOfSeconds() - 1; }
      seconds.remove(aSecond);
      seconds.add(index, aSecond);
      wasAdded = true;
    } 
    else 
    {
      wasAdded = addSecondAt(aSecond, index);
    }
    return wasAdded;
  }

  public void delete()
  {
    ArrayList<Second> copyOfSeconds = new ArrayList<Second>(seconds);
    seconds.clear();
    for(Second aSecond : copyOfSeconds)
    {
      aSecond.removeFirst(this);
    }
  }

  @Override
  public boolean setSecond(Second aSecond){
          return false;
  }

  @Override
  public boolean setSeconds(Second... newSeconds){
          return false;
  }

  @Override
  public boolean isNumberOfSecondsValid(){
          return false;
  }

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



// line 1 "DuplicateInterfaceAssociationMethodsTest2.ump"
public class First implements I
{

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

  //First Associations
  private Second second;

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

  public First(Second aSecond)
  {
    boolean didAddSecond = setSecond(aSecond);
    if (!didAddSecond)
    {
      throw new RuntimeException("Unable to create first due to second. See https://manual.umple.org?RE002ViolationofAssociationMultiplicity.html");
    }
  }

  //------------------------
  // INTERFACE
  //------------------------
  /* Code from template association_GetOne */
  public Second getSecond()
  {
    return second;
  }
  /* Code from template association_SetOneToMany */
  public boolean setSecond(Second aSecond)
  {
    boolean wasSet = false;
    if (aSecond == null)
    {
      return wasSet;
    }

    Second existingSecond = second;
    second = aSecond;
    if (existingSecond != null && !existingSecond.equals(aSecond))
    {
      existingSecond.removeFirst(this);
    }
    second.addFirst(this);
    wasSet = true;
    return wasSet;
  }

  public void delete()
  {
    Second placeholderSecond = second;
    this.second = null;
    if(placeholderSecond != null)
    {
      placeholderSecond.removeFirst(this);
    }
  }

  @Override
  public boolean addSecond(Second aSecond){
          return false;
  }

  @Override
  public List<Second> getSeconds(){
          return null;
  }

  @Override
  public boolean setSeconds(Second... newSeconds){
          return false;
  }

  @Override
  public int numberOfSeconds(){
          return 0;
  }

  @Override
  public boolean hasSeconds(){
          return false;
  }

  @Override
  public int indexOfSecond(Second second){
          return 0;
  }

  @Override
  public boolean isNumberOfSecondsValid(){
          return false;
  }

  @Override
  public boolean removeSecond(Second second){
          return false;
  }

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


import java.util.*;

// line 1 "DuplicateInterfaceAssociationMethodsTest3.ump"
public class First implements I
{

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

  //First Associations
  private List<Second> seconds;

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

  public First(Second... allSeconds)
  {
    seconds = new ArrayList<Second>();
    boolean didAddSeconds = setSeconds(allSeconds);
    if (!didAddSeconds)
    {
      throw new RuntimeException("Unable to create First, must have 1 to 5 seconds. See https://manual.umple.org?RE002ViolationofAssociationMultiplicity.html");
    }
  }

  //------------------------
  // INTERFACE
  //------------------------
  /* Code from template association_GetMany */
  public Second getSecond(int index)
  {
    Second aSecond = seconds.get(index);
    return aSecond;
  }

  public List<Second> getSeconds()
  {
    List<Second> newSeconds = Collections.unmodifiableList(seconds);
    return newSeconds;
  }

  public int numberOfSeconds()
  {
    int number = seconds.size();
    return number;
  }

  public boolean hasSeconds()
  {
    boolean has = seconds.size() > 0;
    return has;
  }

  public int indexOfSecond(Second aSecond)
  {
    int index = seconds.indexOf(aSecond);
    return index;
  }
  /* Code from template association_IsNumberOfValidMethod */
  public boolean isNumberOfSecondsValid()
  {
    boolean isValid = numberOfSeconds() >= minimumNumberOfSeconds() && numberOfSeconds() <= maximumNumberOfSeconds();
    return isValid;
  }
  /* Code from template association_MinimumNumberOfMethod */
  public static int minimumNumberOfSeconds()
  {
    return 1;
  }
  /* Code from template association_MaximumNumberOfMethod */
  public static int maximumNumberOfSeconds()
  {
    return 5;
  }
  /* Code from template association_AddManyToManyMethod */
  public boolean addSecond(Second aSecond)
  {
    boolean wasAdded = false;
    if (seconds.contains(aSecond)) { return false; }
    if (numberOfSeconds() >= maximumNumberOfSeconds())
    {
      return wasAdded;
    }

    seconds.add(aSecond);
    if (aSecond.indexOfFirst(this) != -1)
    {
      wasAdded = true;
    }
    else
    {
      wasAdded = aSecond.addFirst(this);
      if (!wasAdded)
      {
        seconds.remove(aSecond);
      }
    }
    return wasAdded;
  }
  /* Code from template association_AddMNToMany */
  public boolean removeSecond(Second aSecond)
  {
    boolean wasRemoved = false;
    if (!seconds.contains(aSecond))
    {
      return wasRemoved;
    }

    if (numberOfSeconds() <= minimumNumberOfSeconds())
    {
      return wasRemoved;
    }

    int oldIndex = seconds.indexOf(aSecond);
    seconds.remove(oldIndex);
    if (aSecond.indexOfFirst(this) == -1)
    {
      wasRemoved = true;
    }
    else
    {
      wasRemoved = aSecond.removeFirst(this);
      if (!wasRemoved)
      {
        seconds.add(oldIndex,aSecond);
      }
    }
    return wasRemoved;
  }
  /* Code from template association_SetMNToMany */
  public boolean setSeconds(Second... newSeconds)
  {
    boolean wasSet = false;
    ArrayList<Second> verifiedSeconds = new ArrayList<Second>();
    for (Second aSecond : newSeconds)
    {
      if (verifiedSeconds.contains(aSecond))
      {
        continue;
      }
      verifiedSeconds.add(aSecond);
    }

    if (verifiedSeconds.size() != newSeconds.length || verifiedSeconds.size() < minimumNumberOfSeconds() || verifiedSeconds.size() > maximumNumberOfSeconds())
    {
      return wasSet;
    }

    ArrayList<Second> oldSeconds = new ArrayList<Second>(seconds);
    seconds.clear();
    for (Second aNewSecond : verifiedSeconds)
    {
      seconds.add(aNewSecond);
      if (oldSeconds.contains(aNewSecond))
      {
        oldSeconds.remove(aNewSecond);
      }
      else
      {
        aNewSecond.addFirst(this);
      }
    }

    for (Second anOldSecond : oldSeconds)
    {
      anOldSecond.removeFirst(this);
    }
    wasSet = true;
    return wasSet;
  }
  /* Code from template association_AddIndexControlFunctions */
  public boolean addSecondAt(Second aSecond, int index)
  {  
    boolean wasAdded = false;
    if(addSecond(aSecond))
    {
      if(index < 0 ) { index = 0; }
      if(index > numberOfSeconds()) { index = numberOfSeconds() - 1; }
      seconds.remove(aSecond);
      seconds.add(index, aSecond);
      wasAdded = true;
    }
    return wasAdded;
  }

  public boolean addOrMoveSecondAt(Second aSecond, int index)
  {
    boolean wasAdded = false;
    if(seconds.contains(aSecond))
    {
      if(index < 0 ) { index = 0; }
      if(index > numberOfSeconds()) { index = numberOfSeconds() - 1; }
      seconds.remove(aSecond);
      seconds.add(index, aSecond);
      wasAdded = true;
    } 
    else 
    {
      wasAdded = addSecondAt(aSecond, index);
    }
    return wasAdded;
  }

  public void delete()
  {
    ArrayList<Second> copyOfSeconds = new ArrayList<Second>(seconds);
    seconds.clear();
    for(Second aSecond : copyOfSeconds)
    {
      aSecond.removeFirst(this);
    }
  }

  @Override
  public boolean setSecond(Second aSecond){
          return false;
  }

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


import java.util.*;

// line 1 "DuplicateInterfaceAssociationMethodsTest4.ump"
public class First implements I
{

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

  //First Associations
  private List<Second> seconds;

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

  public First(Second... allSeconds)
  {
    seconds = new ArrayList<Second>();
    boolean didAddSeconds = setSeconds(allSeconds);
    if (!didAddSeconds)
    {
      throw new RuntimeException("Unable to create First, must have at least 1 seconds. See https://manual.umple.org?RE002ViolationofAssociationMultiplicity.html");
    }
  }

  //------------------------
  // INTERFACE
  //------------------------
  /* Code from template association_GetMany */
  public Second getSecond(int index)
  {
    Second aSecond = seconds.get(index);
    return aSecond;
  }

  public List<Second> getSeconds()
  {
    List<Second> newSeconds = Collections.unmodifiableList(seconds);
    return newSeconds;
  }

  public int numberOfSeconds()
  {
    int number = seconds.size();
    return number;
  }

  public boolean hasSeconds()
  {
    boolean has = seconds.size() > 0;
    return has;
  }

  public int indexOfSecond(Second aSecond)
  {
    int index = seconds.indexOf(aSecond);
    return index;
  }
  /* Code from template association_IsNumberOfValidMethod */
  public boolean isNumberOfSecondsValid()
  {
    boolean isValid = numberOfSeconds() >= minimumNumberOfSeconds();
    return isValid;
  }
  /* Code from template association_MinimumNumberOfMethod */
  public static int minimumNumberOfSeconds()
  {
    return 1;
  }
  /* Code from template association_AddManyToManyMethod */
  public boolean addSecond(Second aSecond)
  {
    boolean wasAdded = false;
    if (seconds.contains(aSecond)) { return false; }
    seconds.add(aSecond);
    if (aSecond.indexOfFirst(this) != -1)
    {
      wasAdded = true;
    }
    else
    {
      wasAdded = aSecond.addFirst(this);
      if (!wasAdded)
      {
        seconds.remove(aSecond);
      }
    }
    return wasAdded;
  }
  /* Code from template association_AddMStarToMany */
  public boolean removeSecond(Second aSecond)
  {
    boolean wasRemoved = false;
    if (!seconds.contains(aSecond))
    {
      return wasRemoved;
    }

    if (numberOfSeconds() <= minimumNumberOfSeconds())
    {
      return wasRemoved;
    }

    int oldIndex = seconds.indexOf(aSecond);
    seconds.remove(oldIndex);
    if (aSecond.indexOfFirst(this) == -1)
    {
      wasRemoved = true;
    }
    else
    {
      wasRemoved = aSecond.removeFirst(this);
      if (!wasRemoved)
      {
        seconds.add(oldIndex,aSecond);
      }
    }
    return wasRemoved;
  }
  /* Code from template association_SetMStarToMany */
  public boolean setSeconds(Second... newSeconds)
  {
    boolean wasSet = false;
    ArrayList<Second> verifiedSeconds = new ArrayList<Second>();
    for (Second aSecond : newSeconds)
    {
      if (verifiedSeconds.contains(aSecond))
      {
        continue;
      }
      verifiedSeconds.add(aSecond);
    }

    if (verifiedSeconds.size() != newSeconds.length || verifiedSeconds.size() < minimumNumberOfSeconds())
    {
      return wasSet;
    }

    ArrayList<Second> oldSeconds = new ArrayList<Second>(seconds);
    seconds.clear();
    for (Second aNewSecond : verifiedSeconds)
    {
      seconds.add(aNewSecond);
      if (oldSeconds.contains(aNewSecond))
      {
        oldSeconds.remove(aNewSecond);
      }
      else
      {
        aNewSecond.addFirst(this);
      }
    }

    for (Second anOldSecond : oldSeconds)
    {
      anOldSecond.removeFirst(this);
    }
    wasSet = true;
    return wasSet;
  }
  /* Code from template association_AddIndexControlFunctions */
  public boolean addSecondAt(Second aSecond, int index)
  {  
    boolean wasAdded = false;
    if(addSecond(aSecond))
    {
      if(index < 0 ) { index = 0; }
      if(index > numberOfSeconds()) { index = numberOfSeconds() - 1; }
      seconds.remove(aSecond);
      seconds.add(index, aSecond);
      wasAdded = true;
    }
    return wasAdded;
  }

  public boolean addOrMoveSecondAt(Second aSecond, int index)
  {
    boolean wasAdded = false;
    if(seconds.contains(aSecond))
    {
      if(index < 0 ) { index = 0; }
      if(index > numberOfSeconds()) { index = numberOfSeconds() - 1; }
      seconds.remove(aSecond);
      seconds.add(index, aSecond);
      wasAdded = true;
    } 
    else 
    {
      wasAdded = addSecondAt(aSecond, index);
    }
    return wasAdded;
  }

  public void delete()
  {
    ArrayList<Second> copyOfSeconds = new ArrayList<Second>(seconds);
    seconds.clear();
    for(Second aSecond : copyOfSeconds)
    {
      aSecond.removeFirst(this);
    }
  }

  @Override
  public boolean setSecond(Second aSecond){
          return false;
  }

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


import java.util.*;

// line 1 "DuplicateInterfaceAssociationMethodsTest5.ump"
public class First implements I
{

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

  //First Associations
  private List<Second> seconds;

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

  public First(Second... allSeconds)
  {
    seconds = new ArrayList<Second>();
    boolean didAddSeconds = setSeconds(allSeconds);
    if (!didAddSeconds)
    {
      throw new RuntimeException("Unable to create First, must have 5 seconds. See https://manual.umple.org?RE002ViolationofAssociationMultiplicity.html");
    }
  }

  //------------------------
  // INTERFACE
  //------------------------
  /* Code from template association_GetMany */
  public Second getSecond(int index)
  {
    Second aSecond = seconds.get(index);
    return aSecond;
  }

  public List<Second> getSeconds()
  {
    List<Second> newSeconds = Collections.unmodifiableList(seconds);
    return newSeconds;
  }

  public int numberOfSeconds()
  {
    int number = seconds.size();
    return number;
  }

  public boolean hasSeconds()
  {
    boolean has = seconds.size() > 0;
    return has;
  }

  public int indexOfSecond(Second aSecond)
  {
    int index = seconds.indexOf(aSecond);
    return index;
  }
  /* Code from template association_IsNumberOfValidMethod */
  public boolean isNumberOfSecondsValid()
  {
    boolean isValid = numberOfSeconds() >= minimumNumberOfSeconds() && numberOfSeconds() <= maximumNumberOfSeconds();
    return isValid;
  }
  /* Code from template association_RequiredNumberOfMethod */
  public static int requiredNumberOfSeconds()
  {
    return 5;
  }
  /* Code from template association_MinimumNumberOfMethod */
  public static int minimumNumberOfSeconds()
  {
    return 5;
  }
  /* Code from template association_MaximumNumberOfMethod */
  public static int maximumNumberOfSeconds()
  {
    return 5;
  }
  /* Code from template association_AddManyToManyMethod */
  public boolean addSecond(Second aSecond)
  {
    boolean wasAdded = false;
    if (seconds.contains(aSecond)) { return false; }
    if (numberOfSeconds() >= maximumNumberOfSeconds())
    {
      return wasAdded;
    }

    seconds.add(aSecond);
    if (aSecond.indexOfFirst(this) != -1)
    {
      wasAdded = true;
    }
    else
    {
      wasAdded = aSecond.addFirst(this);
      if (!wasAdded)
      {
        seconds.remove(aSecond);
      }
    }
    return wasAdded;
  }
  /* Code from template association_AddMNToMany */
  public boolean removeSecond(Second aSecond)
  {
    boolean wasRemoved = false;
    if (!seconds.contains(aSecond))
    {
      return wasRemoved;
    }

    if (numberOfSeconds() <= minimumNumberOfSeconds())
    {
      return wasRemoved;
    }

    int oldIndex = seconds.indexOf(aSecond);
    seconds.remove(oldIndex);
    if (aSecond.indexOfFirst(this) == -1)
    {
      wasRemoved = true;
    }
    else
    {
      wasRemoved = aSecond.removeFirst(this);
      if (!wasRemoved)
      {
        seconds.add(oldIndex,aSecond);
      }
    }
    return wasRemoved;
  }
  /* Code from template association_SetMNToMany */
  public boolean setSeconds(Second... newSeconds)
  {
    boolean wasSet = false;
    ArrayList<Second> verifiedSeconds = new ArrayList<Second>();
    for (Second aSecond : newSeconds)
    {
      if (verifiedSeconds.contains(aSecond))
      {
        continue;
      }
      verifiedSeconds.add(aSecond);
    }

    if (verifiedSeconds.size() != newSeconds.length || verifiedSeconds.size() < minimumNumberOfSeconds() || verifiedSeconds.size() > maximumNumberOfSeconds())
    {
      return wasSet;
    }

    ArrayList<Second> oldSeconds = new ArrayList<Second>(seconds);
    seconds.clear();
    for (Second aNewSecond : verifiedSeconds)
    {
      seconds.add(aNewSecond);
      if (oldSeconds.contains(aNewSecond))
      {
        oldSeconds.remove(aNewSecond);
      }
      else
      {
        aNewSecond.addFirst(this);
      }
    }

    for (Second anOldSecond : oldSeconds)
    {
      anOldSecond.removeFirst(this);
    }
    wasSet = true;
    return wasSet;
  }

  public void delete()
  {
    ArrayList<Second> copyOfSeconds = new ArrayList<Second>(seconds);
    seconds.clear();
    for(Second aSecond : copyOfSeconds)
    {
      aSecond.removeFirst(this);
    }
  }

  @Override
  public boolean setSecond(Second aSecond){
          return false;
  }

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


import java.util.*;

// line 1 "DuplicateInterfaceAssociationMethodsTest6.ump"
public class First implements I
{

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

  //First Associations
  private List<Second> seconds;

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

  public First()
  {
    seconds = new ArrayList<Second>();
  }

  //------------------------
  // INTERFACE
  //------------------------
  /* Code from template association_GetMany */
  public Second getSecond(int index)
  {
    Second aSecond = seconds.get(index);
    return aSecond;
  }

  public List<Second> getSeconds()
  {
    List<Second> newSeconds = Collections.unmodifiableList(seconds);
    return newSeconds;
  }

  public int numberOfSeconds()
  {
    int number = seconds.size();
    return number;
  }

  public boolean hasSeconds()
  {
    boolean has = seconds.size() > 0;
    return has;
  }

  public int indexOfSecond(Second aSecond)
  {
    int index = seconds.indexOf(aSecond);
    return index;
  }
  /* Code from template association_MinimumNumberOfMethod */
  public static int minimumNumberOfSeconds()
  {
    return 0;
  }
  /* Code from template association_MaximumNumberOfMethod */
  public static int maximumNumberOfSeconds()
  {
    return 5;
  }
  /* Code from template association_AddManyToManyMethod */
  public boolean addSecond(Second aSecond)
  {
    boolean wasAdded = false;
    if (seconds.contains(aSecond)) { return false; }
    if (numberOfSeconds() >= maximumNumberOfSeconds())
    {
      return wasAdded;
    }

    seconds.add(aSecond);
    if (aSecond.indexOfFirst(this) != -1)
    {
      wasAdded = true;
    }
    else
    {
      wasAdded = aSecond.addFirst(this);
      if (!wasAdded)
      {
        seconds.remove(aSecond);
      }
    }
    return wasAdded;
  }
  /* Code from template association_RemoveMany */
  public boolean removeSecond(Second aSecond)
  {
    boolean wasRemoved = false;
    if (!seconds.contains(aSecond))
    {
      return wasRemoved;
    }

    int oldIndex = seconds.indexOf(aSecond);
    seconds.remove(oldIndex);
    if (aSecond.indexOfFirst(this) == -1)
    {
      wasRemoved = true;
    }
    else
    {
      wasRemoved = aSecond.removeFirst(this);
      if (!wasRemoved)
      {
        seconds.add(oldIndex,aSecond);
      }
    }
    return wasRemoved;
  }
  /* Code from template association_SetOptionalNToMany */
  public boolean setSeconds(Second... newSeconds)
  {
    boolean wasSet = false;
    ArrayList<Second> verifiedSeconds = new ArrayList<Second>();
    for (Second aSecond : newSeconds)
    {
      if (verifiedSeconds.contains(aSecond))
      {
        continue;
      }
      verifiedSeconds.add(aSecond);
    }

    if (verifiedSeconds.size() != newSeconds.length || verifiedSeconds.size() > maximumNumberOfSeconds())
    {
      return wasSet;
    }

    ArrayList<Second> oldSeconds = new ArrayList<Second>(seconds);
    seconds.clear();
    for (Second aNewSecond : verifiedSeconds)
    {
      seconds.add(aNewSecond);
      if (oldSeconds.contains(aNewSecond))
      {
        oldSeconds.remove(aNewSecond);
      }
      else
      {
        aNewSecond.addFirst(this);
      }
    }

    for (Second anOldSecond : oldSeconds)
    {
      anOldSecond.removeFirst(this);
    }
    wasSet = true;
    return wasSet;
  }
  /* Code from template association_AddIndexControlFunctions */
  public boolean addSecondAt(Second aSecond, int index)
  {  
    boolean wasAdded = false;
    if(addSecond(aSecond))
    {
      if(index < 0 ) { index = 0; }
      if(index > numberOfSeconds()) { index = numberOfSeconds() - 1; }
      seconds.remove(aSecond);
      seconds.add(index, aSecond);
      wasAdded = true;
    }
    return wasAdded;
  }

  public boolean addOrMoveSecondAt(Second aSecond, int index)
  {
    boolean wasAdded = false;
    if(seconds.contains(aSecond))
    {
      if(index < 0 ) { index = 0; }
      if(index > numberOfSeconds()) { index = numberOfSeconds() - 1; }
      seconds.remove(aSecond);
      seconds.add(index, aSecond);
      wasAdded = true;
    } 
    else 
    {
      wasAdded = addSecondAt(aSecond, index);
    }
    return wasAdded;
  }

  public void delete()
  {
    ArrayList<Second> copyOfSeconds = new ArrayList<Second>(seconds);
    seconds.clear();
    for(Second aSecond : copyOfSeconds)
    {
      aSecond.removeFirst(this);
    }
  }

  @Override
  public boolean setSecond(Second aSecond){
          return false;
  }

  @Override
  public boolean isNumberOfSecondsValid(){
          return false;
  }

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


import java.util.*;

// line 1 "DuplicateInterfaceAssociationMethodsTest7.ump"
public class First implements I
{

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

  //First Associations
  private List<Second> seconds;

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

  public First()
  {
    seconds = new ArrayList<Second>();
  }

  //------------------------
  // INTERFACE
  //------------------------
  /* Code from template association_GetMany */
  public Second getSecond(int index)
  {
    Second aSecond = seconds.get(index);
    return aSecond;
  }

  public List<Second> getSeconds()
  {
    List<Second> newSeconds = Collections.unmodifiableList(seconds);
    return newSeconds;
  }

  public int numberOfSeconds()
  {
    int number = seconds.size();
    return number;
  }

  public boolean hasSeconds()
  {
    boolean has = seconds.size() > 0;
    return has;
  }

  public int indexOfSecond(Second aSecond)
  {
    int index = seconds.indexOf(aSecond);
    return index;
  }
  /* Code from template association_MinimumNumberOfMethod */
  public static int minimumNumberOfSeconds()
  {
    return 0;
  }
  /* Code from template association_AddManyToManyMethod */
  public boolean addSecond(Second aSecond)
  {
    boolean wasAdded = false;
    if (seconds.contains(aSecond)) { return false; }
    seconds.add(aSecond);
    if (aSecond.indexOfFirst(this) != -1)
    {
      wasAdded = true;
    }
    else
    {
      wasAdded = aSecond.addFirst(this);
      if (!wasAdded)
      {
        seconds.remove(aSecond);
      }
    }
    return wasAdded;
  }
  /* Code from template association_RemoveMany */
  public boolean removeSecond(Second aSecond)
  {
    boolean wasRemoved = false;
    if (!seconds.contains(aSecond))
    {
      return wasRemoved;
    }

    int oldIndex = seconds.indexOf(aSecond);
    seconds.remove(oldIndex);
    if (aSecond.indexOfFirst(this) == -1)
    {
      wasRemoved = true;
    }
    else
    {
      wasRemoved = aSecond.removeFirst(this);
      if (!wasRemoved)
      {
        seconds.add(oldIndex,aSecond);
      }
    }
    return wasRemoved;
  }
  /* Code from template association_AddIndexControlFunctions */
  public boolean addSecondAt(Second aSecond, int index)
  {  
    boolean wasAdded = false;
    if(addSecond(aSecond))
    {
      if(index < 0 ) { index = 0; }
      if(index > numberOfSeconds()) { index = numberOfSeconds() - 1; }
      seconds.remove(aSecond);
      seconds.add(index, aSecond);
      wasAdded = true;
    }
    return wasAdded;
  }

  public boolean addOrMoveSecondAt(Second aSecond, int index)
  {
    boolean wasAdded = false;
    if(seconds.contains(aSecond))
    {
      if(index < 0 ) { index = 0; }
      if(index > numberOfSeconds()) { index = numberOfSeconds() - 1; }
      seconds.remove(aSecond);
      seconds.add(index, aSecond);
      wasAdded = true;
    } 
    else 
    {
      wasAdded = addSecondAt(aSecond, index);
    }
    return wasAdded;
  }

  public void delete()
  {
    ArrayList<Second> copyOfSeconds = new ArrayList<Second>(seconds);
    seconds.clear();
    for(Second aSecond : copyOfSeconds)
    {
      aSecond.removeFirst(this);
    }
  }

  @Override
  public boolean setSecond(Second aSecond){
          return false;
  }

  @Override
  public boolean setSeconds(Second... newSeconds){
          return false;
  }

  @Override
  public boolean isNumberOfSecondsValid(){
          return false;
  }

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



// line 1 "DuplicateInterfaceAssociationMethodsTest8.ump"
public class First implements I
{

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

  //First Associations
  private Second second;

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

  public First(Second aSecond)
  {
    if (aSecond == null || aSecond.getFirst() != null)
    {
      throw new RuntimeException("Unable to create First due to aSecond. See https://manual.umple.org?RE002ViolationofAssociationMultiplicity.html");
    }
    second = aSecond;
  }

  public First()
  {
    second = new Second(this);
  }

  //------------------------
  // INTERFACE
  //------------------------
  /* Code from template association_GetOne */
  public Second getSecond()
  {
    return second;
  }

  public void delete()
  {
    Second existingSecond = second;
    second = null;
    if (existingSecond != null)
    {
      existingSecond.delete();
    }
  }

  @Override
  public boolean addSecond(Second aSecond){
          return false;
  }

  @Override
  public List<Second> getSeconds(){
          return null;
  }

  @Override
  public boolean setSecond(Second aSecond){
          return false;
  }

  @Override
  public boolean setSeconds(Second... newSeconds){
          return false;
  }

  @Override
  public int numberOfSeconds(){
          return 0;
  }

  @Override
  public boolean hasSeconds(){
          return false;
  }

  @Override
  public int indexOfSecond(Second second){
          return 0;
  }

  @Override
  public boolean isNumberOfSecondsValid(){
          return false;
  }

  @Override
  public boolean removeSecond(Second second){
          return false;
  }

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


import java.util.*;

// line 1 "DuplicateInterfaceAssociationMethodsTest9.ump"
public class First implements I
{

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

  //First Associations
  private List<Second> seconds;

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

  public First()
  {
    seconds = new ArrayList<Second>();
  }

  //------------------------
  // INTERFACE
  //------------------------
  /* Code from template association_GetMany */
  public Second getSecond(int index)
  {
    Second aSecond = seconds.get(index);
    return aSecond;
  }

  public List<Second> getSeconds()
  {
    List<Second> newSeconds = Collections.unmodifiableList(seconds);
    return newSeconds;
  }

  public int numberOfSeconds()
  {
    int number = seconds.size();
    return number;
  }

  public boolean hasSeconds()
  {
    boolean has = seconds.size() > 0;
    return has;
  }

  public int indexOfSecond(Second aSecond)
  {
    int index = seconds.indexOf(aSecond);
    return index;
  }
  /* Code from template association_IsNumberOfValidMethod */
  public boolean isNumberOfSecondsValid()
  {
    boolean isValid = numberOfSeconds() >= minimumNumberOfSeconds() && numberOfSeconds() <= maximumNumberOfSeconds();
    return isValid;
  }
  /* Code from template association_RequiredNumberOfMethod */
  public static int requiredNumberOfSeconds()
  {
    return 5;
  }
  /* Code from template association_MinimumNumberOfMethod */
  public static int minimumNumberOfSeconds()
  {
    return 5;
  }
  /* Code from template association_MaximumNumberOfMethod */
  public static int maximumNumberOfSeconds()
  {
    return 5;
  }
  /* Code from template association_AddManyToManyMethod */
  public boolean addSecond(Second aSecond)
  {
    boolean wasAdded = false;
    if (seconds.contains(aSecond)) { return false; }
    if (numberOfSeconds() >= maximumNumberOfSeconds())
    {
      return wasAdded;
    }

    seconds.add(aSecond);
    if (aSecond.indexOfFirst(this) != -1)
    {
      wasAdded = true;
    }
    else
    {
      wasAdded = aSecond.addFirst(this);
      if (!wasAdded)
      {
        seconds.remove(aSecond);
      }
    }
    return wasAdded;
  }
  /* Code from template association_AddMNToMany */
  public boolean removeSecond(Second aSecond)
  {
    boolean wasRemoved = false;
    if (!seconds.contains(aSecond))
    {
      return wasRemoved;
    }

    if (numberOfSeconds() <= minimumNumberOfSeconds())
    {
      return wasRemoved;
    }

    int oldIndex = seconds.indexOf(aSecond);
    seconds.remove(oldIndex);
    if (aSecond.indexOfFirst(this) == -1)
    {
      wasRemoved = true;
    }
    else
    {
      wasRemoved = aSecond.removeFirst(this);
      if (!wasRemoved)
      {
        seconds.add(oldIndex,aSecond);
      }
    }
    return wasRemoved;
  }
  /* Code from template association_SetMNToMany */
  public boolean setSeconds(Second... newSeconds)
  {
    boolean wasSet = false;
    ArrayList<Second> verifiedSeconds = new ArrayList<Second>();
    for (Second aSecond : newSeconds)
    {
      if (verifiedSeconds.contains(aSecond))
      {
        continue;
      }
      verifiedSeconds.add(aSecond);
    }

    if (verifiedSeconds.size() != newSeconds.length || verifiedSeconds.size() < minimumNumberOfSeconds() || verifiedSeconds.size() > maximumNumberOfSeconds())
    {
      return wasSet;
    }

    ArrayList<Second> oldSeconds = new ArrayList<Second>(seconds);
    seconds.clear();
    for (Second aNewSecond : verifiedSeconds)
    {
      seconds.add(aNewSecond);
      if (oldSeconds.contains(aNewSecond))
      {
        oldSeconds.remove(aNewSecond);
      }
      else
      {
        aNewSecond.addFirst(this);
      }
    }

    for (Second anOldSecond : oldSeconds)
    {
      anOldSecond.removeFirst(this);
    }
    wasSet = true;
    return wasSet;
  }

  public void delete()
  {
    ArrayList<Second> copyOfSeconds = new ArrayList<Second>(seconds);
    seconds.clear();
    for(Second aSecond : copyOfSeconds)
    {
      if (aSecond.numberOfFirsts() <= Second.minimumNumberOfFirsts())
      {
        aSecond.delete();
      }
      else
      {
        aSecond.removeFirst(this);
      }
    }
  }

  @Override
  public boolean setSecond(Second aSecond){
          return false;
  }

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


import java.util.*;

// line 1 "DuplicateInterfaceAssociationMethodsTest10.ump"
public class First implements I
{

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

  //First Associations
  private List<Second> seconds;

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

  public First()
  {
    seconds = new ArrayList<Second>();
  }

  //------------------------
  // INTERFACE
  //------------------------
  /* Code from template association_GetMany */
  public Second getSecond(int index)
  {
    Second aSecond = seconds.get(index);
    return aSecond;
  }

  public List<Second> getSeconds()
  {
    List<Second> newSeconds = Collections.unmodifiableList(seconds);
    return newSeconds;
  }

  public int numberOfSeconds()
  {
    int number = seconds.size();
    return number;
  }

  public boolean hasSeconds()
  {
    boolean has = seconds.size() > 0;
    return has;
  }

  public int indexOfSecond(Second aSecond)
  {
    int index = seconds.indexOf(aSecond);
    return index;
  }
  /* Code from template association_IsNumberOfValidMethod */
  public boolean isNumberOfSecondsValid()
  {
    boolean isValid = numberOfSeconds() >= minimumNumberOfSeconds() && numberOfSeconds() <= maximumNumberOfSeconds();
    return isValid;
  }
  /* Code from template association_MinimumNumberOfMethod */
  public static int minimumNumberOfSeconds()
  {
    return 2;
  }
  /* Code from template association_MaximumNumberOfMethod */
  public static int maximumNumberOfSeconds()
  {
    return 4;
  }
  /* Code from template association_AddManyToManyMethod */
  public boolean addSecond(Second aSecond)
  {
    boolean wasAdded = false;
    if (seconds.contains(aSecond)) { return false; }
    if (numberOfSeconds() >= maximumNumberOfSeconds())
    {
      return wasAdded;
    }

    seconds.add(aSecond);
    if (aSecond.indexOfFirst(this) != -1)
    {
      wasAdded = true;
    }
    else
    {
      wasAdded = aSecond.addFirst(this);
      if (!wasAdded)
      {
        seconds.remove(aSecond);
      }
    }
    return wasAdded;
  }
  /* Code from template association_AddMNToMany */
  public boolean removeSecond(Second aSecond)
  {
    boolean wasRemoved = false;
    if (!seconds.contains(aSecond))
    {
      return wasRemoved;
    }

    if (numberOfSeconds() <= minimumNumberOfSeconds())
    {
      return wasRemoved;
    }

    int oldIndex = seconds.indexOf(aSecond);
    seconds.remove(oldIndex);
    if (aSecond.indexOfFirst(this) == -1)
    {
      wasRemoved = true;
    }
    else
    {
      wasRemoved = aSecond.removeFirst(this);
      if (!wasRemoved)
      {
        seconds.add(oldIndex,aSecond);
      }
    }
    return wasRemoved;
  }
  /* Code from template association_SetMNToMany */
  public boolean setSeconds(Second... newSeconds)
  {
    boolean wasSet = false;
    ArrayList<Second> verifiedSeconds = new ArrayList<Second>();
    for (Second aSecond : newSeconds)
    {
      if (verifiedSeconds.contains(aSecond))
      {
        continue;
      }
      verifiedSeconds.add(aSecond);
    }

    if (verifiedSeconds.size() != newSeconds.length || verifiedSeconds.size() < minimumNumberOfSeconds() || verifiedSeconds.size() > maximumNumberOfSeconds())
    {
      return wasSet;
    }

    ArrayList<Second> oldSeconds = new ArrayList<Second>(seconds);
    seconds.clear();
    for (Second aNewSecond : verifiedSeconds)
    {
      seconds.add(aNewSecond);
      if (oldSeconds.contains(aNewSecond))
      {
        oldSeconds.remove(aNewSecond);
      }
      else
      {
        aNewSecond.addFirst(this);
      }
    }

    for (Second anOldSecond : oldSeconds)
    {
      anOldSecond.removeFirst(this);
    }
    wasSet = true;
    return wasSet;
  }
  /* Code from template association_AddIndexControlFunctions */
  public boolean addSecondAt(Second aSecond, int index)
  {  
    boolean wasAdded = false;
    if(addSecond(aSecond))
    {
      if(index < 0 ) { index = 0; }
      if(index > numberOfSeconds()) { index = numberOfSeconds() - 1; }
      seconds.remove(aSecond);
      seconds.add(index, aSecond);
      wasAdded = true;
    }
    return wasAdded;
  }

  public boolean addOrMoveSecondAt(Second aSecond, int index)
  {
    boolean wasAdded = false;
    if(seconds.contains(aSecond))
    {
      if(index < 0 ) { index = 0; }
      if(index > numberOfSeconds()) { index = numberOfSeconds() - 1; }
      seconds.remove(aSecond);
      seconds.add(index, aSecond);
      wasAdded = true;
    } 
    else 
    {
      wasAdded = addSecondAt(aSecond, index);
    }
    return wasAdded;
  }

  public void delete()
  {
    ArrayList<Second> copyOfSeconds = new ArrayList<Second>(seconds);
    seconds.clear();
    for(Second aSecond : copyOfSeconds)
    {
      if (aSecond.numberOfFirsts() <= Second.minimumNumberOfFirsts())
      {
        aSecond.delete();
      }
      else
      {
        aSecond.removeFirst(this);
      }
    }
  }

  @Override
  public boolean setSecond(Second aSecond){
          return false;
  }

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


import java.util.*;

// line 1 "DuplicateInterfaceAssociationMethodsTest11.ump"
public class First implements I
{

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

  //First Associations
  private List<Second> seconds;

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

  public First()
  {
    seconds = new ArrayList<Second>();
  }

  //------------------------
  // INTERFACE
  //------------------------
  /* Code from template association_GetMany */
  public Second getSecond(int index)
  {
    Second aSecond = seconds.get(index);
    return aSecond;
  }

  public List<Second> getSeconds()
  {
    List<Second> newSeconds = Collections.unmodifiableList(seconds);
    return newSeconds;
  }

  public int numberOfSeconds()
  {
    int number = seconds.size();
    return number;
  }

  public boolean hasSeconds()
  {
    boolean has = seconds.size() > 0;
    return has;
  }

  public int indexOfSecond(Second aSecond)
  {
    int index = seconds.indexOf(aSecond);
    return index;
  }
  /* Code from template association_IsNumberOfValidMethod */
  public boolean isNumberOfSecondsValid()
  {
    boolean isValid = numberOfSeconds() >= minimumNumberOfSeconds() && numberOfSeconds() <= maximumNumberOfSeconds();
    return isValid;
  }
  /* Code from template association_MinimumNumberOfMethod */
  public static int minimumNumberOfSeconds()
  {
    return 1;
  }
  /* Code from template association_MaximumNumberOfMethod */
  public static int maximumNumberOfSeconds()
  {
    return 4;
  }
  /* Code from template association_AddMNToOnlyOne */
  public Second addSecond()
  {
    if (numberOfSeconds() >= maximumNumberOfSeconds())
    {
      return null;
    }
    else
    {
      return new Second(this);
    }
  }

  public boolean addSecond(Second aSecond)
  {
    boolean wasAdded = false;
    if (seconds.contains(aSecond)) { return false; }
    if (numberOfSeconds() >= maximumNumberOfSeconds())
    {
      return wasAdded;
    }

    First existingFirst = aSecond.getFirst();
    boolean isNewFirst = existingFirst != null && !this.equals(existingFirst);

    if (isNewFirst && existingFirst.numberOfSeconds() <= minimumNumberOfSeconds())
    {
      return wasAdded;
    }

    if (isNewFirst)
    {
      aSecond.setFirst(this);
    }
    else
    {
      seconds.add(aSecond);
    }
    wasAdded = true;
    return wasAdded;
  }

  public boolean removeSecond(Second aSecond)
  {
    boolean wasRemoved = false;
    //Unable to remove aSecond, as it must always have a first
    if (this.equals(aSecond.getFirst()))
    {
      return wasRemoved;
    }

    //first already at minimum (1)
    if (numberOfSeconds() <= minimumNumberOfSeconds())
    {
      return wasRemoved;
    }
    seconds.remove(aSecond);
    wasRemoved = true;
    return wasRemoved;
  }
  /* Code from template association_AddIndexControlFunctions */
  public boolean addSecondAt(Second aSecond, int index)
  {  
    boolean wasAdded = false;
    if(addSecond(aSecond))
    {
      if(index < 0 ) { index = 0; }
      if(index > numberOfSeconds()) { index = numberOfSeconds() - 1; }
      seconds.remove(aSecond);
      seconds.add(index, aSecond);
      wasAdded = true;
    }
    return wasAdded;
  }

  public boolean addOrMoveSecondAt(Second aSecond, int index)
  {
    boolean wasAdded = false;
    if(seconds.contains(aSecond))
    {
      if(index < 0 ) { index = 0; }
      if(index > numberOfSeconds()) { index = numberOfSeconds() - 1; }
      seconds.remove(aSecond);
      seconds.add(index, aSecond);
      wasAdded = true;
    } 
    else 
    {
      wasAdded = addSecondAt(aSecond, index);
    }
    return wasAdded;
  }

  public void delete()
  {
    for(int i=seconds.size(); i > 0; i--)
    {
      Second aSecond = seconds.get(i - 1);
      aSecond.delete();
    }
  }

  @Override
  public boolean setSecond(Second aSecond){
          return false;
  }

  @Override
  public boolean setSeconds(Second... newSeconds){
          return false;
  }

}