@Test public void settingALinkTheTeacherIsSet() { Course math1 = new Course(100, "Math I"); Course math2 = new Course(101, "Math II"); Course eco1 = new Course(200, "Economics I"); Professor prof1 = new Professor("Abraham"); Professor prof2 = new Professor("James"); Teaching.RELATION.link(prof1, math1); Teaching.RELATION.link(prof1, math2); Relation.ReferenceSingleEndpoint<Professor,Course> teacherOfMath1 = Teaching.getTeacherOf(math1); Relation.ReferenceSingleEndpoint<Professor,Course> teacherOfMath2 = Teaching.getTeacherOf(math2); Relation.ReferenceSingleEndpoint<Professor,Course> teacherOfEco1 = Teaching.getTeacherOf(eco1); assertEquals(true, teacherOfMath1.isPresent()); assertEquals("Abraham", teacherOfMath1.get().getName()); assertEquals(true, teacherOfMath2.isPresent()); assertEquals("Abraham", teacherOfMath2.get().getName()); assertEquals(false, teacherOfEco1.isPresent()); }
public void link(A endpointA, B endpointB, Subset bSubset) { link(endpointA, endpointB); bSubsets.put(endpointB, bSubset); }
OneToManyRelation implements Relation<A,B> { public void link(A endpointA, B endpointB, Subset bSubset) { link(endpointA, endpointB); bSubsets.put(endpointB, bSubset); } }
OneToManyRelation implements Relation<A,B> { public void link(A endpointA, B endpointB, Subset bSubset) { link(endpointA, endpointB); bSubsets.put(endpointB, bSubset); }  }
OneToManyRelation implements Relation<A,B> { public void link(A endpointA, B endpointB, Subset bSubset) { link(endpointA, endpointB); bSubsets.put(endpointB, bSubset); }  Subset newBSubset(); void link(A endpointA, B endpointB, Subset bSubset); @Override void link(A endpointA, B endpointB); @Override void unlink(Object endpointA, Object endpointB); @Override boolean areLinked(Object a, Object b); ReferenceSingleEndpoint getReferenceForB(B b); ReferenceSingleEndpoint getReferenceForSubsetB(B b); ReferenceMultipleEndpoint getReferenceForA(A a); ReferenceMultipleEndpoint getReferenceForA(A a, Subset subset); }
OneToManyRelation implements Relation<A,B> { public void link(A endpointA, B endpointB, Subset bSubset) { link(endpointA, endpointB); bSubsets.put(endpointB, bSubset); }  Subset newBSubset(); void link(A endpointA, B endpointB, Subset bSubset); @Override void link(A endpointA, B endpointB); @Override void unlink(Object endpointA, Object endpointB); @Override boolean areLinked(Object a, Object b); ReferenceSingleEndpoint getReferenceForB(B b); ReferenceSingleEndpoint getReferenceForSubsetB(B b); ReferenceMultipleEndpoint getReferenceForA(A a); ReferenceMultipleEndpoint getReferenceForA(A a, Subset subset);  }