// @topic T11750 2D Graphics demo 04 -- controller and subject added // @brief class <tt>ControllerDesign</tt> controls all data manipulation within the use case package shopsimulation; import java.awt.Graphics2D; import java.util.ArrayList; public class ControllerDesign { // data ArrayList< ISubject > subjectList = new ArrayList< ISubject >(); // constructors public ControllerDesign() { subjectList.add( new SubjectShopper( 0, 0, true ) ); subjectList.add( new SubjectShopper( 55, 0, true ) ); subjectList.add( new SubjectShopper( 110, 0, true ) ); subjectList.add( new SubjectShopper( 165, 0, true ) ); } public void draw( Graphics2D gr2d ) { for ( ISubject subject : subjectList ) { subject.move( 1, 0 ); subject.draw( gr2d ); } } }