Skip to content

Commit 846da07

Browse files
committed
1
1 parent a2402ec commit 846da07

File tree

132 files changed

+2462
-2176
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+2462
-2176
lines changed

.idea/DesignPatterns-Java.iml

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/compiler.xml

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/encodings.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/workspace.xml

Lines changed: 243 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

java-des/src/com/java/design/singleton/EnumSingleton.java

Lines changed: 0 additions & 17 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
1-
package com.java.design.abstractfactory;
2-
3-
4-
/**
5-
* 抽象工厂模式 ----- > 就是对一组具有相同主题的工厂进行封装(维基百科解释的很到位);
6-
*
7-
* 例如:生产一台PC机,使用工厂方法模式的话,一般会有cpu工厂,内存工厂,显卡工厂...但是使用抽象工厂模式的话,只有一个工厂就是PC工厂,
8-
* 但是一个PC工厂涵盖了cpu工厂,内存工厂,显卡工厂等要做的所有事;
9-
*
10-
* @author Administrator
11-
*
12-
*/
13-
public class AbstractFactoryPattern {
14-
15-
public static void main(String[] args) {
16-
17-
IAnimalFactory blackAnimalFactory = new BlackAnimalFactory();
18-
ICat blackCat = blackAnimalFactory.createCat();
19-
IDog blackDog = blackAnimalFactory.createDog();
20-
blackCat.eat();
21-
blackDog.eat();
22-
23-
IAnimalFactory whiteAnimalFactory = new WhiteAnimalFactory();
24-
ICat whiteCat = whiteAnimalFactory.createCat();
25-
IDog whiteDog = whiteAnimalFactory.createDog();
26-
whiteCat.eat();
27-
whiteDog.eat();
28-
29-
}
30-
31-
}
1+
package com.java.design.abstractfactory;
2+
3+
4+
/**
5+
* 抽象工厂模式 ----- > 就是对一组具有相同主题的工厂进行封装(维基百科解释的很到位);
6+
*
7+
* 例如:生产一台PC机,使用工厂方法模式的话,一般会有cpu工厂,内存工厂,显卡工厂...但是使用抽象工厂模式的话,只有一个工厂就是PC工厂,
8+
* 但是一个PC工厂涵盖了cpu工厂,内存工厂,显卡工厂等要做的所有事;
9+
*
10+
* @author Administrator
11+
*
12+
*/
13+
public class AbstractFactoryPattern {
14+
15+
public static void main(String[] args) {
16+
17+
IAnimalFactory blackAnimalFactory = new BlackAnimalFactory();
18+
ICat blackCat = blackAnimalFactory.createCat();
19+
IDog blackDog = blackAnimalFactory.createDog();
20+
blackCat.eat();
21+
blackDog.eat();
22+
23+
IAnimalFactory whiteAnimalFactory = new WhiteAnimalFactory();
24+
ICat whiteCat = whiteAnimalFactory.createCat();
25+
IDog whiteDog = whiteAnimalFactory.createDog();
26+
whiteCat.eat();
27+
whiteDog.eat();
28+
29+
}
30+
31+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy