/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE @UMPLE_VERSION@ modeling language!*/

package example;

public class Mentor
{

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

  //Mentor Attributes
  private String name;

  //Mentor Associations
  private Mentor superMentor;

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

  public Mentor(String aName)
  {
    name = aName;
  }

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

  public boolean setName(String aName)
  {
    boolean wasSet = false;
    name = aName;
    wasSet = true;
    return wasSet;
  }

  public String getName()
  {
    return name;
  }

  public Mentor getSuperMentor()
  {
    return superMentor;
  }

  public boolean hasSuperMentor()
  {
    boolean has = superMentor != null;
    return has;
  }

  public boolean setSuperMentor(Mentor aNewSuperMentor)
  {
    boolean wasSet = false;
    if (aNewSuperMentor == null)
    {
      Mentor existingSuperMentor = superMentor;
      superMentor = null;
      
      if (existingSuperMentor != null && existingSuperMentor.getSuperMentor() != null)
      {
        existingSuperMentor.setSuperMentor(null);
      }
      wasSet = true;
      return wasSet;
    }

    Mentor currentSuperMentor = getSuperMentor();
    if (currentSuperMentor != null && !currentSuperMentor.equals(aNewSuperMentor))
    {
      currentSuperMentor.setSuperMentor(null);
    }

    superMentor = aNewSuperMentor;
    Mentor existingSuperMentor = aNewSuperMentor.getSuperMentor();

    if (!equals(existingSuperMentor))
    {
      aNewSuperMentor.setSuperMentor(this);
    }
    wasSet = true;
    return wasSet;
  }

  public void delete()
  {
    if (superMentor != null)
    {
      superMentor.setSuperMentor(null);
    }
  }


  public String toString()
  {
    return super.toString() + "["+
            "name" + ":" + getName()+ "]" + System.getProperties().getProperty("line.separator") +
            "  " + "superMentor = "+(getSuperMentor()!=null?Integer.toHexString(System.identityHashCode(getSuperMentor())):"null");
  }
}
