...
The student
field in DoCommandVisitor
will give you access to the various clothes piles, what the student is currently wearing and the laundry room. You do NOT have to code up the instantiation of the DoCommandVisitor
! The supplied simulation infrastructure already does that for you.
A word of explanation: A big deal was made in class and lab about how one should never have public
fields because they allow uncontrolled mutations to occur. You've problaby noticed the public garment
field in some of the Command
subclasses here. For convenience's sake, we're exploiting the fact that Commands
never need to be mutated (so far as we know). The garment
field in the Receive
, Lose
and Change
commands is marked final
, which makes it immutable. So, we can get away with a public
field because the field is immutable. That said, in general, using an accessor method is still the preferred technique.
The Graphical User Interface (GUI)
...