Example #1
0
        public string Execute()
        {
            Factory factory = Factory.GetFactory <ListFactory>();

            Link qiita = factory.CreateLink("Qiita", "https://qiita.com//");
            Link dot   = factory.CreateLink("ドットインストール", "https://dotinstall.com/");

            Link yahoo  = factory.CreateLink("Yahoo!Japan", "http://www.yahoo.co.jp/");
            Link excite = factory.CreateLink("Excite", "http://www.excite.com/");
            Link google = factory.CreateLink("Google", "http://www.google.com/");

            Tray pgTray = factory.CreateTray("プログラミング");

            pgTray.Add(qiita);
            pgTray.Add(dot);

            Tray searchTray = factory.CreateTray("検索サイト");

            searchTray.Add(yahoo);
            searchTray.Add(excite);
            searchTray.Add(google);

            Page page = factory.CreatePage("お気に入り");

            page.Add(pgTray);
            page.Add(searchTray);
            page.Output();

            return(page.path + "を作成しました。");
        }
    // Start is called before the first frame update
    void Start()
    {
        FactoryAF factory = FactoryAF.GetFactory(nameAF);
        //Debug.Log(factory.GetType().Name);
        Link asahi   = factory.CreateLink("朝日新聞", "http://www.asashi.com/");
        Link yomiuri = factory.CreateLink("読売新聞", "http://www.yomiuri.co.jp/");

        Link usYahoo = factory.CreateLink("Yahoo!", "http://www.yahoo.com/");
        Link jpYahoo = factory.CreateLink("Yahoo!Japan", "http://www.yahoo.co.jp/");
        Link excite  = factory.CreateLink("Excite", "http://www.excite.co.jp/");
        Link google  = factory.CreateLink("Google", "http://www.google.com/");

        Tray traynews = factory.CreateTray("新聞");

        traynews.Add(asahi);
        traynews.Add(yomiuri);

        Tray trayyahoo = factory.CreateTray("Yahoo!");

        trayyahoo.Add(usYahoo);
        trayyahoo.Add(jpYahoo);

        Tray traysearch = factory.CreateTray("サーチエンジン");

        traysearch.Add(trayyahoo);
        traysearch.Add(excite);
        traysearch.Add(google);

        Page page = factory.CreatePage("LinkPage", "Yamada");

        page.Add(traynews);
        page.Add(traysearch);
        page.Output();
    }
Example #3
0
    public static void Main(string[] args)
    {
        Factory factory = Factory.GetFactory(args[0]);

        Link jpGoogle = factory.CreateLink("google-jp", "https://www.google.co.jp");
        Link jpYahoo  = factory.CreateLink("yahoo-jp", "http://www.yahoo.co.jp");

        Link usGoogle = factory.CreateLink("google-us", "https://www.google.com");
        Link usYahoo  = factory.CreateLink("yahoo-us", "http://www.yahoo.com");

        Tray trayGoogle = factory.CreateTray("Google");

        trayGoogle.Add(jpGoogle);
        trayGoogle.Add(usGoogle);

        Tray trayYahoo = factory.CreateTray("Yahoo");

        trayYahoo.Add(jpYahoo);
        trayYahoo.Add(usYahoo);

        Tray traySearch = factory.CreateTray("Search Engine");

        traySearch.Add(trayGoogle);
        traySearch.Add(trayYahoo);

        Page page = factory.CreatePage("LinkPage", "John Smith");

        page.Add(traySearch);
        page.OutPut();
    }
Example #4
0
        // Main処理
        static void Main(string[] args)
        {
            if (args.Length != 2)
            {
                //第1引数:アセンブリ名 第2引数:名前空間.クラス名
                Console.WriteLine("Example 1: C# AbstractFactory ListFactory ListFactory.ListFactory");
                Console.WriteLine("Example 2: C# AbstractFactory ListFactory.TableFactory");
                Environment.Exit(0);
            }



            Factory AbstractFactory = Factory.GetFactory(args[0], args[1]);
            Link    asahi           = AbstractFactory.CreateLink("朝日新聞", "http://www.asashi.com/");
            Link    yomiuri         = AbstractFactory.CreateLink("読売新聞", "http://www.yomiuri.co.jp/");

            Link usYahoo = AbstractFactory.CreateLink("Yahoo!", "http://www.yahoo.com/");
            Link jpYahoo = AbstractFactory.CreateLink("Yahoo!Japan", "http://www.yahoo.co.jp/");
            Link excite  = AbstractFactory.CreateLink("Excite", "http://www.excite.co.jp/");
            Link google  = AbstractFactory.CreateLink("Google", "http://www.google.com/");

            Tray traynews = AbstractFactory.CreateTray("新聞");

            traynews.Add(asahi);
            traynews.Add(yomiuri);

            Tray trayyahoo = AbstractFactory.CreateTray("Yahoo!");

            trayyahoo.Add(usYahoo);
            trayyahoo.Add(jpYahoo);

            Tray traysearch = AbstractFactory.CreateTray("サーチエンジン");

            traysearch.Add(trayyahoo);
            traysearch.Add(excite);
            traysearch.Add(google);

            Page page = AbstractFactory.CreatePage("LinkPage", "AbstractFactory Sample");

            page.Add(traynews);
            page.Add(traysearch);
            page.Output(args[1]);

            // 実行が一瞬で終わって確認ため、キーの入力を待ちます
            Console.ReadLine();
        }
Example #5
0
        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.WriteLine("Usage: Main class.name.of.ConcreateFactory");
                Console.WriteLine("Example1: Main listFactory.ListFactory");
                Console.WriteLine("Example2: Main tableFactory.TableFactory");
                return;
            }

            Factory.Factory factory = Factory.Factory.GetFactory(args[0]);

            Link asahi   = factory.CreateLink("朝日新聞", "http://www.asahi.com/");
            Link yomiuri = factory.CreateLink("読売新聞", "http://www.yomiuri.co.jp/");

            Link us_yahoo = factory.CreateLink("Yahoo!", "http://www.yahoo.com/");
            Link jp_yahoo = factory.CreateLink("Yahoo!Japan", "http://www.yahoo.co.jp/");
            Link excite   = factory.CreateLink("Excite", "http://www.excite.com/");
            Link google   = factory.CreateLink("Google", "http://www.google.com/");

            Tray trayNews = factory.CreateTray("新聞");

            trayNews.Add(asahi);
            trayNews.Add(yomiuri);

            Tray trayYahoo = factory.CreateTray("Yahoo!");

            trayYahoo.Add(us_yahoo);
            trayYahoo.Add(jp_yahoo);

            Tray traySearch = factory.CreateTray("サーチエンジン");

            traySearch.Add(trayYahoo);
            traySearch.Add(excite);
            traySearch.Add(google);

            Page page = factory.CreatePage(args[0].Split('.')[1], "結城 浩");

            page.Add(trayNews);
            page.Add(traySearch);
            page.Output();

            Console.ReadKey();
        }
Example #6
0
        static void Main(string[] args)
        {
            Console.Write("Factory name>");
            var name = Console.ReadLine();

            var factory = Factory.GetFactory(Type.GetType("LinkPageCreater." + name));

            Link asahi   = factory.CreateLink("朝日", "http://www.asahi.com/");
            Link yomiuri = factory.CreateLink("読売", "http://yomiuri.co.jp/");

            Link us_yahoo = factory.CreateLink("Yahoo!", "http://www.yahoo.com/");
            Link jp_yahoo = factory.CreateLink("Yahoo!Japan", "http://www.yahoo.co.jp");

            Link excite = factory.CreateLink("Excite", "http://www.excite.com/");
            Link google = factory.CreateLink("Google", "http://www.google.com/");

            Tray trayNews = factory.CreateTray("新聞");

            trayNews.Add(asahi);
            trayNews.Add(yomiuri);

            Tray trayYahoo = factory.CreateTray("Yahoo!");

            trayYahoo.Add(us_yahoo);
            trayYahoo.Add(jp_yahoo);

            Tray traySearch = factory.CreateTray("サーチエンジン");

            traySearch.Add(trayYahoo);
            traySearch.Add(excite);
            traySearch.Add(google);

            Page page = factory.CreatePage("LinkPage", "Dice");

            page.Add(trayNews);
            page.Add(traySearch);
            page.Output();
        }
Example #7
0
 public void TakeIngredient(Storage storage)
 {
     Tray.Add(storage.GetIngredient());
 }