コード例 #1
0
        public static Soup MakeSoupOfTheDay(AbstractSoupFactory
                                            concreteSoupFactory)
        {
            Soup s;

/*
 *     Calendar todayCalendar = Calendar.getInstance();
 *     //int dayOfWeek = todayCalendar.get(Calendar.DAY_OF_WEEK);
 *
 *              int dayOfWeek = Calendar.TUESDAY;
 *
 *              switch( dayOfWeek )
 *              {
 *                      case  Calendar.MONDAY:
 *                              s = concreteSoupFactory.makeChickenSoup();
 *                              break;
 *                      case Calendar.TUESDAY:
 *                              s = concreteSoupFactory.makeClamChowder();
 *                              break;
 *                      case Calendar.WEDNESDAY :
 *                              s = concreteSoupFactory.makeFishChowder();
 *                              break;
 *                      case Calendar.THURSDAY :
 *                              s = concreteSoupFactory.makeMinnestrone();
 *                              break;
 *                      case Calendar.FRIDAY :
 *                              s = concreteSoupFactory.makePastaFazul();
 *                              break;
 *                      case Calendar.SATURDAY :
 */
            s = concreteSoupFactory.makeTofuSoup();

/*
 *                              break;
 *                      case Calendar.SUNDAY :
 *                              s = concreteSoupFactory.makeVegetableSoup();
 *                              break;
 *     }
 */
            return(s);
        }
コード例 #2
0
ファイル: TestAbstractFactory.cs プロジェクト: KoyoA/patterns
        public static Soup MakeSoupOfTheDay(AbstractSoupFactory 
                                       concreteSoupFactory)
        {
            Soup s ;
            /*
               Calendar todayCalendar = Calendar.getInstance();
               //int dayOfWeek = todayCalendar.get(Calendar.DAY_OF_WEEK);

            int dayOfWeek = Calendar.TUESDAY;

            switch( dayOfWeek )
            {
            case  Calendar.MONDAY:
                s = concreteSoupFactory.makeChickenSoup();
                break;
            case Calendar.TUESDAY:
                s = concreteSoupFactory.makeClamChowder();
                break;
            case Calendar.WEDNESDAY :
                s = concreteSoupFactory.makeFishChowder();
                break;
            case Calendar.THURSDAY :
                s = concreteSoupFactory.makeMinnestrone();
                break;
            case Calendar.FRIDAY :
                s = concreteSoupFactory.makePastaFazul();
                break;
            case Calendar.SATURDAY :
            */
                s = concreteSoupFactory.makeTofuSoup();
            /*
                break;
            case Calendar.SUNDAY :
                s = concreteSoupFactory.makeVegetableSoup();
                break;
               }
            */
            return s;
        }