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

class A
{

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

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

  public function __construct()
  {}

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

  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.35.0.7523.c616a4dce modeling language!*/

class B
{

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

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

  public function __construct()
  {}

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

  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.35.0.7523.c616a4dce modeling language!*/

class C
{

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

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

  public function __construct()
  {}

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

  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.35.0.7523.c616a4dce modeling language!*/

interface I
{
  
}
?>
<?php
/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!*/

class X implements J
{

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

  //X Associations
  private $ies;

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

  public function __construct()
  {
    $this->ies = array();
  }

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

  public function getY_index($index)
  {
    $aY = $this->ies[$index];
    return $aY;
  }

  public function getIes()
  {
    $newIes = $this->ies;
    return $newIes;
  }

  public function numberOfIes()
  {
    $number = count($this->ies);
    return $number;
  }

  public function hasIes()
  {
    $has = $this->numberOfIes() > 0;
    return $has;
  }

  public function indexOfY($aY)
  {
    $wasFound = false;
    $index = 0;
    foreach($this->ies as $y)
    {
      if ($y->equals($aY))
      {
        $wasFound = true;
        break;
      }
      $index += 1;
    }
    $index = $wasFound ? $index : -1;
    return $index;
  }

  public static function minimumNumberOfIes()
  {
    return 0;
  }

  public function addY($aY)
  {
    $wasAdded = false;
    if ($this->indexOfY($aY) !== -1) { return false; }
    $this->ies[] = $aY;
    if ($aY->indexOfX($this) != -1)
    {
      $wasAdded = true;
    }
    else
    {
      $wasAdded = $aY->addX($this);
      if (!$wasAdded)
      {
        array_pop($this->ies);
      }
    }
    return $wasAdded;
  }

  public function removeY($aY)
  {
    $wasRemoved = false;
    if ($this->indexOfY($aY) == -1)
    {
      return $wasRemoved;
    }

    $oldIndex = $this->indexOfY($aY);
    unset($this->ies[$oldIndex]);
    if ($aY->indexOfX($this) == -1)
    {
      $wasRemoved = true;
    }
    else
    {
      $wasRemoved = $aY->removeX($this);
      if (!$wasRemoved)
      {
        $this->ies[$oldIndex] = $aY;
        ksort($this->ies);
      }
    }
    $this->ies = array_values($this->ies);
    return $wasRemoved;
  }

  public function addYAt($aY, $index)
  {  
    $wasAdded = false;
    if($this->addY($aY))
    {
      if($index < 0 ) { $index = 0; }
      if($index > $this->numberOfIes()) { $index = $this->numberOfIes() - 1; }
      array_splice($this->ies, $this->indexOfY($aY), 1);
      array_splice($this->ies, $index, 0, array($aY));
      $wasAdded = true;
    }
    return $wasAdded;
  }

  public function addOrMoveYAt($aY, $index)
  {
    $wasAdded = false;
    if($this->indexOfY($aY) !== -1)
    {
      if($index < 0 ) { $index = 0; }
      if($index > $this->numberOfIes()) { $index = $this->numberOfIes() - 1; }
      array_splice($this->ies, $this->indexOfY($aY), 1);
      array_splice($this->ies, $index, 0, array($aY));
      $wasAdded = true;
    } 
    else 
    {
      $wasAdded = $this->addYAt($aY, $index);
    }
    return $wasAdded;
  }

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

  public function delete()
  {
    $copyOfIes = $this->ies;
    $this->ies = array();
    foreach ($copyOfIes as $aY)
    {
      $aY->removeX($this);
    }
  }

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

class Y
{

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

  //Y Associations
  private $xs;

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

  public function __construct()
  {
    $this->xs = array();
  }

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

  public function getX_index($index)
  {
    $aX = $this->xs[$index];
    return $aX;
  }

  public function getXs()
  {
    $newXs = $this->xs;
    return $newXs;
  }

  public function numberOfXs()
  {
    $number = count($this->xs);
    return $number;
  }

  public function hasXs()
  {
    $has = $this->numberOfXs() > 0;
    return $has;
  }

  public function indexOfX($aX)
  {
    $wasFound = false;
    $index = 0;
    foreach($this->xs as $x)
    {
      if ($x->equals($aX))
      {
        $wasFound = true;
        break;
      }
      $index += 1;
    }
    $index = $wasFound ? $index : -1;
    return $index;
  }

  public static function minimumNumberOfXs()
  {
    return 0;
  }

  public function addX($aX)
  {
    $wasAdded = false;
    if ($this->indexOfX($aX) !== -1) { return false; }
    $this->xs[] = $aX;
    if ($aX->indexOfY($this) != -1)
    {
      $wasAdded = true;
    }
    else
    {
      $wasAdded = $aX->addY($this);
      if (!$wasAdded)
      {
        array_pop($this->xs);
      }
    }
    return $wasAdded;
  }

  public function removeX($aX)
  {
    $wasRemoved = false;
    if ($this->indexOfX($aX) == -1)
    {
      return $wasRemoved;
    }

    $oldIndex = $this->indexOfX($aX);
    unset($this->xs[$oldIndex]);
    if ($aX->indexOfY($this) == -1)
    {
      $wasRemoved = true;
    }
    else
    {
      $wasRemoved = $aX->removeY($this);
      if (!$wasRemoved)
      {
        $this->xs[$oldIndex] = $aX;
        ksort($this->xs);
      }
    }
    $this->xs = array_values($this->xs);
    return $wasRemoved;
  }

  public function addXAt($aX, $index)
  {  
    $wasAdded = false;
    if($this->addX($aX))
    {
      if($index < 0 ) { $index = 0; }
      if($index > $this->numberOfXs()) { $index = $this->numberOfXs() - 1; }
      array_splice($this->xs, $this->indexOfX($aX), 1);
      array_splice($this->xs, $index, 0, array($aX));
      $wasAdded = true;
    }
    return $wasAdded;
  }

  public function addOrMoveXAt($aX, $index)
  {
    $wasAdded = false;
    if($this->indexOfX($aX) !== -1)
    {
      if($index < 0 ) { $index = 0; }
      if($index > $this->numberOfXs()) { $index = $this->numberOfXs() - 1; }
      array_splice($this->xs, $this->indexOfX($aX), 1);
      array_splice($this->xs, $index, 0, array($aX));
      $wasAdded = true;
    } 
    else 
    {
      $wasAdded = $this->addXAt($aX, $index);
    }
    return $wasAdded;
  }

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

  public function delete()
  {
    $copyOfXs = $this->xs;
    $this->xs = array();
    foreach ($copyOfXs as $aX)
    {
      $aX->removeY($this);
    }
  }

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

interface I
{
  
}
?>
<?php
/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!*/

interface J
{
  
}
?>
<?php
/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!*/

class A
{

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

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

  public function __construct()
  {}

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

  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.35.0.7523.c616a4dce modeling language!*/

class B
{

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

  //B Attributes
  private $x;

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

  public function __construct($aX)
  {
    $this->x = $aX;
  }

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

  public function setX($aX)
  {
    $wasSet = false;
    $this->x = $aX;
    $wasSet = true;
    return $wasSet;
  }

  public function getX()
  {
    return $this->x;
  }

  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.35.0.7523.c616a4dce modeling language!*/

interface I
{
  
}
?>
<?php
/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!*/

class X implements J
{

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

  //X Associations
  private $ies;

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

  public function __construct()
  {
    $this->ies = array();
  }

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

  public function getY_index($index)
  {
    $aY = $this->ies[$index];
    return $aY;
  }

  public function getIes()
  {
    $newIes = $this->ies;
    return $newIes;
  }

  public function numberOfIes()
  {
    $number = count($this->ies);
    return $number;
  }

  public function hasIes()
  {
    $has = $this->numberOfIes() > 0;
    return $has;
  }

  public function indexOfY($aY)
  {
    $wasFound = false;
    $index = 0;
    foreach($this->ies as $y)
    {
      if ($y->equals($aY))
      {
        $wasFound = true;
        break;
      }
      $index += 1;
    }
    $index = $wasFound ? $index : -1;
    return $index;
  }

  public static function minimumNumberOfIes()
  {
    return 0;
  }

  public function addY($aY)
  {
    $wasAdded = false;
    if ($this->indexOfY($aY) !== -1) { return false; }
    $this->ies[] = $aY;
    if ($aY->indexOfX($this) != -1)
    {
      $wasAdded = true;
    }
    else
    {
      $wasAdded = $aY->addX($this);
      if (!$wasAdded)
      {
        array_pop($this->ies);
      }
    }
    return $wasAdded;
  }

  public function removeY($aY)
  {
    $wasRemoved = false;
    if ($this->indexOfY($aY) == -1)
    {
      return $wasRemoved;
    }

    $oldIndex = $this->indexOfY($aY);
    unset($this->ies[$oldIndex]);
    if ($aY->indexOfX($this) == -1)
    {
      $wasRemoved = true;
    }
    else
    {
      $wasRemoved = $aY->removeX($this);
      if (!$wasRemoved)
      {
        $this->ies[$oldIndex] = $aY;
        ksort($this->ies);
      }
    }
    $this->ies = array_values($this->ies);
    return $wasRemoved;
  }

  public function addYAt($aY, $index)
  {  
    $wasAdded = false;
    if($this->addY($aY))
    {
      if($index < 0 ) { $index = 0; }
      if($index > $this->numberOfIes()) { $index = $this->numberOfIes() - 1; }
      array_splice($this->ies, $this->indexOfY($aY), 1);
      array_splice($this->ies, $index, 0, array($aY));
      $wasAdded = true;
    }
    return $wasAdded;
  }

  public function addOrMoveYAt($aY, $index)
  {
    $wasAdded = false;
    if($this->indexOfY($aY) !== -1)
    {
      if($index < 0 ) { $index = 0; }
      if($index > $this->numberOfIes()) { $index = $this->numberOfIes() - 1; }
      array_splice($this->ies, $this->indexOfY($aY), 1);
      array_splice($this->ies, $index, 0, array($aY));
      $wasAdded = true;
    } 
    else 
    {
      $wasAdded = $this->addYAt($aY, $index);
    }
    return $wasAdded;
  }

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

  public function delete()
  {
    $copyOfIes = $this->ies;
    $this->ies = array();
    foreach ($copyOfIes as $aY)
    {
      $aY->removeX($this);
    }
  }

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

class Y
{

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

  //Y Associations
  private $xs;

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

  public function __construct()
  {
    $this->xs = array();
  }

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

  public function getX_index($index)
  {
    $aX = $this->xs[$index];
    return $aX;
  }

  public function getXs()
  {
    $newXs = $this->xs;
    return $newXs;
  }

  public function numberOfXs()
  {
    $number = count($this->xs);
    return $number;
  }

  public function hasXs()
  {
    $has = $this->numberOfXs() > 0;
    return $has;
  }

  public function indexOfX($aX)
  {
    $wasFound = false;
    $index = 0;
    foreach($this->xs as $x)
    {
      if ($x->equals($aX))
      {
        $wasFound = true;
        break;
      }
      $index += 1;
    }
    $index = $wasFound ? $index : -1;
    return $index;
  }

  public static function minimumNumberOfXs()
  {
    return 0;
  }

  public function addX($aX)
  {
    $wasAdded = false;
    if ($this->indexOfX($aX) !== -1) { return false; }
    $this->xs[] = $aX;
    if ($aX->indexOfY($this) != -1)
    {
      $wasAdded = true;
    }
    else
    {
      $wasAdded = $aX->addY($this);
      if (!$wasAdded)
      {
        array_pop($this->xs);
      }
    }
    return $wasAdded;
  }

  public function removeX($aX)
  {
    $wasRemoved = false;
    if ($this->indexOfX($aX) == -1)
    {
      return $wasRemoved;
    }

    $oldIndex = $this->indexOfX($aX);
    unset($this->xs[$oldIndex]);
    if ($aX->indexOfY($this) == -1)
    {
      $wasRemoved = true;
    }
    else
    {
      $wasRemoved = $aX->removeY($this);
      if (!$wasRemoved)
      {
        $this->xs[$oldIndex] = $aX;
        ksort($this->xs);
      }
    }
    $this->xs = array_values($this->xs);
    return $wasRemoved;
  }

  public function addXAt($aX, $index)
  {  
    $wasAdded = false;
    if($this->addX($aX))
    {
      if($index < 0 ) { $index = 0; }
      if($index > $this->numberOfXs()) { $index = $this->numberOfXs() - 1; }
      array_splice($this->xs, $this->indexOfX($aX), 1);
      array_splice($this->xs, $index, 0, array($aX));
      $wasAdded = true;
    }
    return $wasAdded;
  }

  public function addOrMoveXAt($aX, $index)
  {
    $wasAdded = false;
    if($this->indexOfX($aX) !== -1)
    {
      if($index < 0 ) { $index = 0; }
      if($index > $this->numberOfXs()) { $index = $this->numberOfXs() - 1; }
      array_splice($this->xs, $this->indexOfX($aX), 1);
      array_splice($this->xs, $index, 0, array($aX));
      $wasAdded = true;
    } 
    else 
    {
      $wasAdded = $this->addXAt($aX, $index);
    }
    return $wasAdded;
  }

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

  public function delete()
  {
    $copyOfXs = $this->xs;
    $this->xs = array();
    foreach ($copyOfXs as $aX)
    {
      $aX->removeY($this);
    }
  }

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

interface I
{
  
}
?>
<?php
/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!*/

interface J
{
  
}
?>