/*PLEASE DO NOT EDIT THIS CODE*/ /*This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!*/ package example; // line 3 "../ImmutableUnidirectionalOptionalOneTest.ump" public class Student { //------------------------ // MEMBER VARIABLES //------------------------ //Student Attributes private String number; //Student Associations private Mentor mentor; //Helper Variables private boolean canSetMentor; //------------------------ // CONSTRUCTOR //------------------------ public Student(String aNumber, Mentor aMentor) { number = aNumber; canSetMentor = true; setMentor(aMentor); } //------------------------ // INTERFACE //------------------------ public String getNumber() { return number; } /* Code from template association_GetOne */ public Mentor getMentor() { return mentor; } public boolean hasMentor() { boolean has = mentor != null; return has; } /* Code from template association_SetUnidirectionalOptionalOne */ private boolean setMentor(Mentor aNewMentor) { boolean wasSet = false; if (!canSetMentor) { return false; } canSetMentor = false; mentor = aNewMentor; wasSet = true; return wasSet; } public void delete() {} public String toString() { return super.toString() + "["+ "number" + ":" + getNumber()+ "]" + System.getProperties().getProperty("line.separator") + " " + "mentor = "+(getMentor()!=null?Integer.toHexString(System.identityHashCode(getMentor())):"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 "../ImmutableUnidirectionalOptionalOneTest.ump" public class Mentor { //------------------------ // MEMBER VARIABLES //------------------------ //Mentor Attributes private String name; //------------------------ // CONSTRUCTOR //------------------------ public Mentor(String aName) { name = aName; } //------------------------ // INTERFACE //------------------------ public String getName() { return name; } public void delete() {} public String toString() { return super.toString() + "["+ "name" + ":" + getName()+ "]"; } }