Exemplo n.º 1
0
        public void GenerateStudents()
        {
            Director.DirectorStdentBuilder director = new Director.DirectorStdentBuilder();
            IStudentBuilder studentBuilder;

            #region Sample Single Initialization

            studentBuilder = new BachelorStudentBuilder();
            Studentet.Add(director.Build(studentBuilder, 1));

            studentBuilder = new MasterStudentBuilder();
            Studentet.Add(director.Build(studentBuilder, 2));

            #endregion

            #region Sample Group Initialization

            for (int i = 3; i < 100; i++)
            {
                if (i % 2 == 0)
                {
                    studentBuilder = new BachelorStudentBuilder();
                }
                else
                {
                    studentBuilder = new MasterStudentBuilder();
                }
                Studentet.Add(director.Build(studentBuilder, i));
            }
            #endregion
        }
Exemplo n.º 2
0
        public static IStudent CreateStudent(StudentType _StudentType, int i)
        {
            Director.DirectorStdentBuilder director = new Director.DirectorStdentBuilder();
            IStudentBuilder studentBuilder;

            switch (_StudentType)
            {
            case StudentType.Bachelor:
            {
                studentBuilder = new BachelorStudentBuilder();
                return(director.Build(studentBuilder, i));
            }

            case StudentType.Master:
            default:
            {
                studentBuilder = new MasterStudentBuilder();
                return(director.Build(studentBuilder, i));
            }
            }
        }