|
2 | 2 |
|
3 | 3 | /** |
4 | 4 | * |
5 | | - * The Bridge pattern can also be thought of as two layers of abstraction. With Bridge, |
6 | | - * you can decouple an abstraction from its implementation so that the two can vary independently. |
| 5 | + * The Bridge pattern can also be thought of as two layers of abstraction. With Bridge, you can |
| 6 | + * decouple an abstraction from its implementation so that the two can vary independently. |
7 | 7 | * <p> |
8 | | - * In Bridge pattern both abstraction ({@link MagicWeapon}) and implementation |
9 | | - * ({@link MagicWeaponImpl}) have their own class hierarchies. The interface of the |
10 | | - * implementations can be changed without affecting the clients. |
| 8 | + * In Bridge pattern both abstraction ({@link MagicWeapon}) and implementation ( |
| 9 | + * {@link MagicWeaponImpl}) have their own class hierarchies. The interface of the implementations |
| 10 | + * can be changed without affecting the clients. |
11 | 11 | * |
12 | 12 | */ |
13 | 13 | public class App { |
14 | 14 |
|
15 | | - /** |
16 | | - * Program entry point |
17 | | - * @param args command line args |
18 | | - */ |
19 | | - public static void main(String[] args) { |
20 | | - BlindingMagicWeapon blindingMagicWeapon = new BlindingMagicWeapon( |
21 | | - new Excalibur()); |
22 | | - blindingMagicWeapon.wield(); |
23 | | - blindingMagicWeapon.blind(); |
24 | | - blindingMagicWeapon.swing(); |
25 | | - blindingMagicWeapon.unwield(); |
| 15 | + /** |
| 16 | + * Program entry point |
| 17 | + * |
| 18 | + * @param args command line args |
| 19 | + */ |
| 20 | + public static void main(String[] args) { |
| 21 | + BlindingMagicWeapon blindingMagicWeapon = new BlindingMagicWeapon(new Excalibur()); |
| 22 | + blindingMagicWeapon.wield(); |
| 23 | + blindingMagicWeapon.blind(); |
| 24 | + blindingMagicWeapon.swing(); |
| 25 | + blindingMagicWeapon.unwield(); |
26 | 26 |
|
27 | | - FlyingMagicWeapon flyingMagicWeapon = new FlyingMagicWeapon( |
28 | | - new Mjollnir()); |
29 | | - flyingMagicWeapon.wield(); |
30 | | - flyingMagicWeapon.fly(); |
31 | | - flyingMagicWeapon.swing(); |
32 | | - flyingMagicWeapon.unwield(); |
| 27 | + FlyingMagicWeapon flyingMagicWeapon = new FlyingMagicWeapon(new Mjollnir()); |
| 28 | + flyingMagicWeapon.wield(); |
| 29 | + flyingMagicWeapon.fly(); |
| 30 | + flyingMagicWeapon.swing(); |
| 31 | + flyingMagicWeapon.unwield(); |
33 | 32 |
|
34 | | - SoulEatingMagicWeapon soulEatingMagicWeapon = new SoulEatingMagicWeapon( |
35 | | - new Stormbringer()); |
36 | | - soulEatingMagicWeapon.wield(); |
37 | | - soulEatingMagicWeapon.swing(); |
38 | | - soulEatingMagicWeapon.eatSoul(); |
39 | | - soulEatingMagicWeapon.unwield(); |
40 | | - |
41 | | - } |
| 33 | + SoulEatingMagicWeapon soulEatingMagicWeapon = new SoulEatingMagicWeapon(new Stormbringer()); |
| 34 | + soulEatingMagicWeapon.wield(); |
| 35 | + soulEatingMagicWeapon.swing(); |
| 36 | + soulEatingMagicWeapon.eatSoul(); |
| 37 | + soulEatingMagicWeapon.unwield(); |
| 38 | + } |
42 | 39 | } |
0 commit comments