| java.lang.Object U2.T2.examples.ClubMember
ClubMember | public class ClubMember (Code) | | A simple class representing clubmembers. A clubmember may have a
sponsor, which is another clubmember. So, this class is
recursive. We impose as a class invariant that the sponsor relation
should not be circular.
|
Constructor Summary | |
public | ClubMember(String n) Make a new ClubMember with the specified name. |
ClubMember | public ClubMember(String n)(Code) | | Make a new ClubMember with the specified name. The sponsor is
set to null.
|
classinv | public boolean classinv()(Code) | | The class invariant, saying the sponsor chain is not circular.
|
getSponsor | public String getSponsor()(Code) | | Contains an error. Should impose a pre-cond that the sponsor
field is not null.
|
sponsoredBy | public void sponsoredBy(ClubMember s)(Code) | | Set s as the sponsor of this ClubMember. The method contains
error, e.g. it allows the clubmember itself to be the sponsor
(violating the class invariant).
|
|
|