GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — DesignPatterns/AbstractFactory/src/Main.java at master · feisuo/DesignPatterns

Expand file tree

/

Main.java

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
33 lines (30 loc) · 1.35 KB
/

Main.java

Copy path

File metadata and controls

33 lines (30 loc) · 1.35 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import factory.*;
public class Main {
public static void main(String[] args) {
if (args.length != 1) {
System.out.println("使うファクトリ指定してくれ〜");
System.exit(0);
}
Factory factory = Factory.getFactory(args[0]);
Page page = factory.createPage("アニメのキャラ", "otiai10");
Tray htt = factory.createTray("放課後ティータイム");
Link ritsu = factory.createLink("田井中律", "http://images.uncyc.org/ja/8/8c/Ritu.jpg");
Tray muse = factory.createTray("μ's");
Link nozomi = factory.createLink("のぞみ", "http://images.uncyc.org/ja/8/8c/Ritu.jpg");
htt.add(ritsu);
muse.add(nozomi);
page.add(htt);
page.add(muse);
page.output();
}
/**
* アプリケーションレイヤーでは、ページのコンテンツしか定義してない。
* ページの構造や、**つくりかた**についても、アプリケーションは感知してない。
* ページレイアウトの変更があった場合は、具体的なFactoryクラスを
* 新たに作って、指定すればいいだけ。
* ∵
* AbstractなFactoryというクラスを最初に定義して
* Mainはそれだけを参照することで
* 具体的なFactoryに依存しない
*/
}
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.