Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
QZero_0
java-design-patterns
提交
7d2e9fa1
J
java-design-patterns
项目概览
QZero_0
/
java-design-patterns
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
java-design-patterns
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7d2e9fa1
编写于
8月 18, 2015
作者:
I
Ilkka Seppala
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#107 JavaDoc improvements and minor fixes to Bridge example
上级
8d621566
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
369 addition
and
295 deletion
+369
-295
bridge/etc/bridge.png
bridge/etc/bridge.png
+0
-0
bridge/etc/bridge.ucls
bridge/etc/bridge.ucls
+46
-42
bridge/etc/bridge_1.png
bridge/etc/bridge_1.png
+0
-0
bridge/index.md
bridge/index.md
+1
-1
bridge/src/main/java/com/iluwatar/bridge/App.java
bridge/src/main/java/com/iluwatar/bridge/App.java
+39
-35
bridge/src/main/java/com/iluwatar/bridge/BlindingMagicWeapon.java
...rc/main/java/com/iluwatar/bridge/BlindingMagicWeapon.java
+38
-33
bridge/src/main/java/com/iluwatar/bridge/BlindingMagicWeaponImpl.java
...ain/java/com/iluwatar/bridge/BlindingMagicWeaponImpl.java
+12
-0
bridge/src/main/java/com/iluwatar/bridge/Excalibur.java
bridge/src/main/java/com/iluwatar/bridge/Excalibur.java
+31
-26
bridge/src/main/java/com/iluwatar/bridge/FlyingMagicWeapon.java
.../src/main/java/com/iluwatar/bridge/FlyingMagicWeapon.java
+37
-32
bridge/src/main/java/com/iluwatar/bridge/FlyingMagicWeaponImpl.java
.../main/java/com/iluwatar/bridge/FlyingMagicWeaponImpl.java
+12
-0
bridge/src/main/java/com/iluwatar/bridge/MagicWeapon.java
bridge/src/main/java/com/iluwatar/bridge/MagicWeapon.java
+26
-26
bridge/src/main/java/com/iluwatar/bridge/MagicWeaponImpl.java
...ge/src/main/java/com/iluwatar/bridge/MagicWeaponImpl.java
+16
-16
bridge/src/main/java/com/iluwatar/bridge/Mjollnir.java
bridge/src/main/java/com/iluwatar/bridge/Mjollnir.java
+31
-26
bridge/src/main/java/com/iluwatar/bridge/SoulEatingMagicWeapon.java
.../main/java/com/iluwatar/bridge/SoulEatingMagicWeapon.java
+38
-33
bridge/src/main/java/com/iluwatar/bridge/SoulEatingMagicWeaponImpl.java
...n/java/com/iluwatar/bridge/SoulEatingMagicWeaponImpl.java
+12
-0
bridge/src/main/java/com/iluwatar/bridge/Stormbringer.java
bridge/src/main/java/com/iluwatar/bridge/Stormbringer.java
+30
-25
未找到文件。
bridge/etc/bridge.png
查看替换文件 @
8d621566
浏览文件 @
7d2e9fa1
47.6 KB
|
W:
|
H:
52.2 KB
|
W:
|
H:
2-up
Swipe
Onion skin
bridge/etc/bridge.ucls
浏览文件 @
7d2e9fa1
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<class-diagram
version=
"1.1.8"
icons=
"true"
automaticImage=
"PNG"
always-add-relationships=
"false"
generalizations=
"true"
<class-diagram
version=
"1.1.8"
icons=
"true"
automaticImage=
"PNG"
always-add-relationships=
"false"
generalizations=
"true"
realizations=
"true"
associations=
"true"
dependencies=
"false"
nesting-relationships=
"true"
>
realizations=
"true"
associations=
"true"
dependencies=
"false"
nesting-relationships=
"true"
>
<class
id=
"1"
language=
"java"
name=
"com.iluwatar.bridge.FlyingMagicWeaponImp"
project=
"bridge"
<class
id=
"1"
language=
"java"
name=
"com.iluwatar.bridge.FlyingMagicWeaponImp
l
"
project=
"bridge"
file=
"/bridge/src/main/java/com/iluwatar/bridge/FlyingMagicWeaponImp.java"
binary=
"false"
corner=
"BOTTOM_RIGHT"
>
file=
"/bridge/src/main/java/com/iluwatar/bridge/FlyingMagicWeaponImp
l
.java"
binary=
"false"
corner=
"BOTTOM_RIGHT"
>
<position
height=
"
105"
width=
"192"
x=
"193"
y=
"297
"
/>
<position
height=
"
-1"
width=
"-1"
x=
"515"
y=
"591
"
/>
<display
autosize=
"true"
stereotype=
"true"
package=
"true"
initial-value=
"false"
signature=
"true"
<display
autosize=
"true"
stereotype=
"true"
package=
"true"
initial-value=
"false"
signature=
"true"
sort-features=
"false"
accessors=
"true"
visibility=
"true"
>
sort-features=
"false"
accessors=
"true"
visibility=
"true"
>
<attributes
public=
"true"
package=
"true"
protected=
"true"
private=
"true"
static=
"true"
/>
<attributes
public=
"true"
package=
"true"
protected=
"true"
private=
"true"
static=
"true"
/>
<operations
public=
"true"
package=
"true"
protected=
"true"
private=
"true"
static=
"true"
/>
<operations
public=
"true"
package=
"true"
protected=
"true"
private=
"true"
static=
"true"
/>
</display>
</display>
</class>
</class>
<class
id=
"2"
language=
"java"
name=
"com.iluwatar.bridge.SoulEatingMagicWeaponImp"
project=
"bridge"
<class
id=
"2"
language=
"java"
name=
"com.iluwatar.bridge.SoulEatingMagicWeaponImp
l
"
project=
"bridge"
file=
"/bridge/src/main/java/com/iluwatar/bridge/SoulEatingMagicWeaponImp.java"
binary=
"false"
corner=
"BOTTOM_RIGHT"
>
file=
"/bridge/src/main/java/com/iluwatar/bridge/SoulEatingMagicWeaponImp
l
.java"
binary=
"false"
corner=
"BOTTOM_RIGHT"
>
<position
height=
"
105"
width=
"226"
x=
"425"
y=
"297
"
/>
<position
height=
"
-1"
width=
"-1"
x=
"791"
y=
"605
"
/>
<display
autosize=
"true"
stereotype=
"true"
package=
"true"
initial-value=
"false"
signature=
"true"
<display
autosize=
"true"
stereotype=
"true"
package=
"true"
initial-value=
"false"
signature=
"true"
sort-features=
"false"
accessors=
"true"
visibility=
"true"
>
sort-features=
"false"
accessors=
"true"
visibility=
"true"
>
<attributes
public=
"true"
package=
"true"
protected=
"true"
private=
"true"
static=
"true"
/>
<attributes
public=
"true"
package=
"true"
protected=
"true"
private=
"true"
static=
"true"
/>
...
@@ -21,25 +21,25 @@
...
@@ -21,25 +21,25 @@
</class>
</class>
<class
id=
"3"
language=
"java"
name=
"com.iluwatar.bridge.Stormbringer"
project=
"bridge"
<class
id=
"3"
language=
"java"
name=
"com.iluwatar.bridge.Stormbringer"
project=
"bridge"
file=
"/bridge/src/main/java/com/iluwatar/bridge/Stormbringer.java"
binary=
"false"
corner=
"BOTTOM_RIGHT"
>
file=
"/bridge/src/main/java/com/iluwatar/bridge/Stormbringer.java"
binary=
"false"
corner=
"BOTTOM_RIGHT"
>
<position
height=
"
160"
width=
"125"
x=
"425"
y=
"442
"
/>
<position
height=
"
-1"
width=
"-1"
x=
"791"
y=
"788
"
/>
<display
autosize=
"true"
stereotype=
"true"
package=
"true"
initial-value=
"false"
signature=
"true"
<display
autosize=
"true"
stereotype=
"true"
package=
"true"
initial-value=
"false"
signature=
"true"
sort-features=
"false"
accessors=
"true"
visibility=
"true"
>
sort-features=
"false"
accessors=
"true"
visibility=
"true"
>
<attributes
public=
"true"
package=
"true"
protected=
"true"
private=
"true"
static=
"true"
/>
<attributes
public=
"true"
package=
"true"
protected=
"true"
private=
"true"
static=
"true"
/>
<operations
public=
"true"
package=
"true"
protected=
"true"
private=
"true"
static=
"true"
/>
<operations
public=
"true"
package=
"true"
protected=
"true"
private=
"true"
static=
"true"
/>
</display>
</display>
</class>
</class>
<class
id=
"4"
language=
"java"
name=
"com.iluwatar.bridge.MagicWeaponImp"
project=
"bridge"
<class
id=
"4"
language=
"java"
name=
"com.iluwatar.bridge.MagicWeaponImp
l
"
project=
"bridge"
file=
"/bridge/src/main/java/com/iluwatar/bridge/MagicWeaponImp.java"
binary=
"false"
corner=
"BOTTOM_RIGHT"
>
file=
"/bridge/src/main/java/com/iluwatar/bridge/MagicWeaponImp
l
.java"
binary=
"false"
corner=
"BOTTOM_RIGHT"
>
<position
height=
"
141"
width=
"149"
x=
"221"
y=
"79
"
/>
<position
height=
"
-1"
width=
"-1"
x=
"791"
y=
"433
"
/>
<display
autosize=
"true"
stereotype=
"true"
package=
"true"
initial-value=
"false"
signature=
"true"
<display
autosize=
"true"
stereotype=
"true"
package=
"true"
initial-value=
"false"
signature=
"true"
sort-features=
"false"
accessors=
"true"
visibility=
"true"
>
sort-features=
"false"
accessors=
"true"
visibility=
"true"
>
<attributes
public=
"true"
package=
"true"
protected=
"true"
private=
"true"
static=
"true"
/>
<attributes
public=
"true"
package=
"true"
protected=
"true"
private=
"true"
static=
"true"
/>
<operations
public=
"true"
package=
"true"
protected=
"true"
private=
"true"
static=
"true"
/>
<operations
public=
"true"
package=
"true"
protected=
"true"
private=
"true"
static=
"true"
/>
</display>
</display>
</class>
</class>
<class
id=
"5"
language=
"java"
name=
"com.iluwatar.bridge.BlindingMagicWeaponImp"
project=
"bridge"
<class
id=
"5"
language=
"java"
name=
"com.iluwatar.bridge.BlindingMagicWeaponImp
l
"
project=
"bridge"
file=
"/bridge/src/main/java/com/iluwatar/bridge/BlindingMagicWeaponImp.java"
binary=
"false"
corner=
"BOTTOM_RIGHT"
>
file=
"/bridge/src/main/java/com/iluwatar/bridge/BlindingMagicWeaponImp
l
.java"
binary=
"false"
corner=
"BOTTOM_RIGHT"
>
<position
height=
"
105"
width=
"208"
x=
"691"
y=
"297
"
/>
<position
height=
"
-1"
width=
"-1"
x=
"1105"
y=
"593
"
/>
<display
autosize=
"true"
stereotype=
"true"
package=
"true"
initial-value=
"false"
signature=
"true"
<display
autosize=
"true"
stereotype=
"true"
package=
"true"
initial-value=
"false"
signature=
"true"
sort-features=
"false"
accessors=
"true"
visibility=
"true"
>
sort-features=
"false"
accessors=
"true"
visibility=
"true"
>
<attributes
public=
"true"
package=
"true"
protected=
"true"
private=
"true"
static=
"true"
/>
<attributes
public=
"true"
package=
"true"
protected=
"true"
private=
"true"
static=
"true"
/>
...
@@ -48,7 +48,7 @@
...
@@ -48,7 +48,7 @@
</class>
</class>
<class
id=
"6"
language=
"java"
name=
"com.iluwatar.bridge.SoulEatingMagicWeapon"
project=
"bridge"
<class
id=
"6"
language=
"java"
name=
"com.iluwatar.bridge.SoulEatingMagicWeapon"
project=
"bridge"
file=
"/bridge/src/main/java/com/iluwatar/bridge/SoulEatingMagicWeapon.java"
binary=
"false"
corner=
"BOTTOM_RIGHT"
>
file=
"/bridge/src/main/java/com/iluwatar/bridge/SoulEatingMagicWeapon.java"
binary=
"false"
corner=
"BOTTOM_RIGHT"
>
<position
height=
"
178"
width=
"347"
x=
"410"
y=
"79
"
/>
<position
height=
"
-1"
width=
"-1"
x=
"380"
y=
"21
"
/>
<display
autosize=
"true"
stereotype=
"true"
package=
"true"
initial-value=
"false"
signature=
"true"
<display
autosize=
"true"
stereotype=
"true"
package=
"true"
initial-value=
"false"
signature=
"true"
sort-features=
"false"
accessors=
"true"
visibility=
"true"
>
sort-features=
"false"
accessors=
"true"
visibility=
"true"
>
<attributes
public=
"true"
package=
"true"
protected=
"true"
private=
"true"
static=
"true"
/>
<attributes
public=
"true"
package=
"true"
protected=
"true"
private=
"true"
static=
"true"
/>
...
@@ -57,7 +57,7 @@
...
@@ -57,7 +57,7 @@
</class>
</class>
<class
id=
"7"
language=
"java"
name=
"com.iluwatar.bridge.Excalibur"
project=
"bridge"
<class
id=
"7"
language=
"java"
name=
"com.iluwatar.bridge.Excalibur"
project=
"bridge"
file=
"/bridge/src/main/java/com/iluwatar/bridge/Excalibur.java"
binary=
"false"
corner=
"BOTTOM_RIGHT"
>
file=
"/bridge/src/main/java/com/iluwatar/bridge/Excalibur.java"
binary=
"false"
corner=
"BOTTOM_RIGHT"
>
<position
height=
"
160"
width=
"124"
x=
"691"
y=
"44
2"
/>
<position
height=
"
-1"
width=
"-1"
x=
"1105"
y=
"78
2"
/>
<display
autosize=
"true"
stereotype=
"true"
package=
"true"
initial-value=
"false"
signature=
"true"
<display
autosize=
"true"
stereotype=
"true"
package=
"true"
initial-value=
"false"
signature=
"true"
sort-features=
"false"
accessors=
"true"
visibility=
"true"
>
sort-features=
"false"
accessors=
"true"
visibility=
"true"
>
<attributes
public=
"true"
package=
"true"
protected=
"true"
private=
"true"
static=
"true"
/>
<attributes
public=
"true"
package=
"true"
protected=
"true"
private=
"true"
static=
"true"
/>
...
@@ -66,7 +66,7 @@
...
@@ -66,7 +66,7 @@
</class>
</class>
<class
id=
"8"
language=
"java"
name=
"com.iluwatar.bridge.Mjollnir"
project=
"bridge"
<class
id=
"8"
language=
"java"
name=
"com.iluwatar.bridge.Mjollnir"
project=
"bridge"
file=
"/bridge/src/main/java/com/iluwatar/bridge/Mjollnir.java"
binary=
"false"
corner=
"BOTTOM_RIGHT"
>
file=
"/bridge/src/main/java/com/iluwatar/bridge/Mjollnir.java"
binary=
"false"
corner=
"BOTTOM_RIGHT"
>
<position
height=
"
160"
width=
"124"
x=
"193"
y=
"442
"
/>
<position
height=
"
-1"
width=
"-1"
x=
"515"
y=
"788
"
/>
<display
autosize=
"true"
stereotype=
"true"
package=
"true"
initial-value=
"false"
signature=
"true"
<display
autosize=
"true"
stereotype=
"true"
package=
"true"
initial-value=
"false"
signature=
"true"
sort-features=
"false"
accessors=
"true"
visibility=
"true"
>
sort-features=
"false"
accessors=
"true"
visibility=
"true"
>
<attributes
public=
"true"
package=
"true"
protected=
"true"
private=
"true"
static=
"true"
/>
<attributes
public=
"true"
package=
"true"
protected=
"true"
private=
"true"
static=
"true"
/>
...
@@ -75,7 +75,7 @@
...
@@ -75,7 +75,7 @@
</class>
</class>
<class
id=
"9"
language=
"java"
name=
"com.iluwatar.bridge.BlindingMagicWeapon"
project=
"bridge"
<class
id=
"9"
language=
"java"
name=
"com.iluwatar.bridge.BlindingMagicWeapon"
project=
"bridge"
file=
"/bridge/src/main/java/com/iluwatar/bridge/BlindingMagicWeapon.java"
binary=
"false"
corner=
"BOTTOM_RIGHT"
>
file=
"/bridge/src/main/java/com/iluwatar/bridge/BlindingMagicWeapon.java"
binary=
"false"
corner=
"BOTTOM_RIGHT"
>
<position
height=
"
178"
width=
"313"
x=
"797"
y=
"79
"
/>
<position
height=
"
-1"
width=
"-1"
x=
"791"
y=
"14
"
/>
<display
autosize=
"true"
stereotype=
"true"
package=
"true"
initial-value=
"false"
signature=
"true"
<display
autosize=
"true"
stereotype=
"true"
package=
"true"
initial-value=
"false"
signature=
"true"
sort-features=
"false"
accessors=
"true"
visibility=
"true"
>
sort-features=
"false"
accessors=
"true"
visibility=
"true"
>
<attributes
public=
"true"
package=
"true"
protected=
"true"
private=
"true"
static=
"true"
/>
<attributes
public=
"true"
package=
"true"
protected=
"true"
private=
"true"
static=
"true"
/>
...
@@ -84,7 +84,7 @@
...
@@ -84,7 +84,7 @@
</class>
</class>
<class
id=
"10"
language=
"java"
name=
"com.iluwatar.bridge.MagicWeapon"
project=
"bridge"
<class
id=
"10"
language=
"java"
name=
"com.iluwatar.bridge.MagicWeapon"
project=
"bridge"
file=
"/bridge/src/main/java/com/iluwatar/bridge/MagicWeapon.java"
binary=
"false"
corner=
"BOTTOM_RIGHT"
>
file=
"/bridge/src/main/java/com/iluwatar/bridge/MagicWeapon.java"
binary=
"false"
corner=
"BOTTOM_RIGHT"
>
<position
height=
"
159"
width=
"221"
x=
"644"
y=
"-120
"
/>
<position
height=
"
-1"
width=
"-1"
x=
"791"
y=
"237
"
/>
<display
autosize=
"true"
stereotype=
"true"
package=
"true"
initial-value=
"false"
signature=
"true"
<display
autosize=
"true"
stereotype=
"true"
package=
"true"
initial-value=
"false"
signature=
"true"
sort-features=
"false"
accessors=
"true"
visibility=
"true"
>
sort-features=
"false"
accessors=
"true"
visibility=
"true"
>
<attributes
public=
"true"
package=
"true"
protected=
"true"
private=
"true"
static=
"true"
/>
<attributes
public=
"true"
package=
"true"
protected=
"true"
private=
"true"
static=
"true"
/>
...
@@ -93,7 +93,7 @@
...
@@ -93,7 +93,7 @@
</class>
</class>
<class
id=
"11"
language=
"java"
name=
"com.iluwatar.bridge.FlyingMagicWeapon"
project=
"bridge"
<class
id=
"11"
language=
"java"
name=
"com.iluwatar.bridge.FlyingMagicWeapon"
project=
"bridge"
file=
"/bridge/src/main/java/com/iluwatar/bridge/FlyingMagicWeapon.java"
binary=
"false"
corner=
"BOTTOM_RIGHT"
>
file=
"/bridge/src/main/java/com/iluwatar/bridge/FlyingMagicWeapon.java"
binary=
"false"
corner=
"BOTTOM_RIGHT"
>
<position
height=
"
178"
width=
"291"
x=
"1150"
y=
"79
"
/>
<position
height=
"
-1"
width=
"-1"
x=
"1144"
y=
"12
"
/>
<display
autosize=
"true"
stereotype=
"true"
package=
"true"
initial-value=
"false"
signature=
"true"
<display
autosize=
"true"
stereotype=
"true"
package=
"true"
initial-value=
"false"
signature=
"true"
sort-features=
"false"
accessors=
"true"
visibility=
"true"
>
sort-features=
"false"
accessors=
"true"
visibility=
"true"
>
<attributes
public=
"true"
package=
"true"
protected=
"true"
private=
"true"
static=
"true"
/>
<attributes
public=
"true"
package=
"true"
protected=
"true"
private=
"true"
static=
"true"
/>
...
@@ -101,48 +101,52 @@
...
@@ -101,48 +101,52 @@
</display>
</display>
</class>
</class>
<generalization
id=
"12"
>
<generalization
id=
"12"
>
<end
type=
"SOURCE"
refId=
"
11
"
/>
<end
type=
"SOURCE"
refId=
"
8
"
/>
<end
type=
"TARGET"
refId=
"1
0
"
/>
<end
type=
"TARGET"
refId=
"1"
/>
</generalization>
</generalization>
<generalization
id=
"13"
>
<generalization
id=
"13"
>
<end
type=
"SOURCE"
refId=
"1"
/>
<end
type=
"SOURCE"
refId=
"1"
/>
<end
type=
"TARGET"
refId=
"4"
/>
<end
type=
"TARGET"
refId=
"4"
/>
</generalization>
</generalization>
<generalization
id=
"14"
>
<generalization
id=
"14"
>
<end
type=
"SOURCE"
refId=
"2"
/>
<end
type=
"TARGET"
refId=
"4"
/>
</generalization>
<generalization
id=
"15"
>
<end
type=
"SOURCE"
refId=
"7"
/>
<end
type=
"TARGET"
refId=
"5"
/>
</generalization>
<generalization
id=
"16"
>
<end
type=
"SOURCE"
refId=
"6"
/>
<end
type=
"TARGET"
refId=
"10"
/>
</generalization>
<generalization
id=
"17"
>
<end
type=
"SOURCE"
refId=
"9"
/>
<end
type=
"SOURCE"
refId=
"9"
/>
<end
type=
"TARGET"
refId=
"10"
/>
<end
type=
"TARGET"
refId=
"10"
/>
</generalization>
</generalization>
<generalization
id=
"1
8
"
>
<generalization
id=
"1
5
"
>
<end
type=
"SOURCE"
refId=
"
3
"
/>
<end
type=
"SOURCE"
refId=
"
2
"
/>
<end
type=
"TARGET"
refId=
"
2
"
/>
<end
type=
"TARGET"
refId=
"
4
"
/>
</generalization>
</generalization>
<association
id=
"1
9
"
>
<association
id=
"1
6
"
>
<end
type=
"SOURCE"
refId=
"10"
navigable=
"false"
>
<end
type=
"SOURCE"
refId=
"10"
navigable=
"false"
>
<attribute
id=
"20"
name=
"imp"
/>
<attribute
id=
"17"
name=
"imp"
>
<multiplicity
id=
"21"
minimum=
"0"
maximum=
"1"
/>
<position
height=
"0"
width=
"0"
x=
"478"
y=
"284"
/>
</attribute>
<multiplicity
id=
"18"
minimum=
"0"
maximum=
"1"
>
<position
height=
"0"
width=
"0"
x=
"478"
y=
"284"
/>
</multiplicity>
</end>
</end>
<end
type=
"TARGET"
refId=
"4"
navigable=
"true"
/>
<end
type=
"TARGET"
refId=
"4"
navigable=
"true"
/>
<display
labels=
"true"
multiplicity=
"true"
/>
<display
labels=
"true"
multiplicity=
"true"
/>
</association>
</association>
<generalization
id=
"
22
"
>
<generalization
id=
"
19
"
>
<end
type=
"SOURCE"
refId=
"5"
/>
<end
type=
"SOURCE"
refId=
"5"
/>
<end
type=
"TARGET"
refId=
"4"
/>
<end
type=
"TARGET"
refId=
"4"
/>
</generalization>
</generalization>
<generalization
id=
"20"
>
<end
type=
"SOURCE"
refId=
"6"
/>
<end
type=
"TARGET"
refId=
"10"
/>
</generalization>
<generalization
id=
"21"
>
<end
type=
"SOURCE"
refId=
"7"
/>
<end
type=
"TARGET"
refId=
"5"
/>
</generalization>
<generalization
id=
"22"
>
<end
type=
"SOURCE"
refId=
"3"
/>
<end
type=
"TARGET"
refId=
"2"
/>
</generalization>
<generalization
id=
"23"
>
<generalization
id=
"23"
>
<end
type=
"SOURCE"
refId=
"
8
"
/>
<end
type=
"SOURCE"
refId=
"
11
"
/>
<end
type=
"TARGET"
refId=
"1"
/>
<end
type=
"TARGET"
refId=
"1
0
"
/>
</generalization>
</generalization>
<classifier-display
autosize=
"true"
stereotype=
"true"
package=
"true"
initial-value=
"false"
signature=
"true"
<classifier-display
autosize=
"true"
stereotype=
"true"
package=
"true"
initial-value=
"false"
signature=
"true"
sort-features=
"false"
accessors=
"true"
visibility=
"true"
>
sort-features=
"false"
accessors=
"true"
visibility=
"true"
>
...
...
bridge/etc/bridge_1.png
已删除
100644 → 0
浏览文件 @
8d621566
84.6 KB
bridge/index.md
浏览文件 @
7d2e9fa1
...
@@ -11,7 +11,7 @@ tags: pattern_tag
...
@@ -11,7 +11,7 @@ tags: pattern_tag
vary independently.
vary independently.
![
alt text
](
./etc/bridge
_1
.png
"Bridge"
)
![
alt text
](
./etc/bridge.png
"Bridge"
)
**Applicability:**
Use the Bridge pattern when
**Applicability:**
Use the Bridge pattern when
...
...
bridge/src/main/java/com/iluwatar/bridge/App.java
浏览文件 @
7d2e9fa1
package
com.iluwatar.bridge
;
package
com.iluwatar.bridge
;
/**
/**
*
*
* In Bridge pattern both abstraction (MagicWeapon) and implementation
* In Bridge pattern both abstraction ({@link MagicWeapon}) and implementation
* (MagicWeaponImp) have their own class hierarchies. The interface of the
* ({@link MagicWeaponImpl}) have their own class hierarchies. The interface of the
* implementations can be changed without affecting the clients.
* implementations can be changed without affecting the clients.
*
*
*/
*/
public
class
App
{
public
class
App
{
public
static
void
main
(
String
[]
args
)
{
/**
BlindingMagicWeapon
blindingMagicWeapon
=
new
BlindingMagicWeapon
(
* Program entry point
new
Excalibur
());
* @param args command line args
blindingMagicWeapon
.
wield
();
*/
blindingMagicWeapon
.
blind
();
public
static
void
main
(
String
[]
args
)
{
blindingMagicWeapon
.
swing
();
BlindingMagicWeapon
blindingMagicWeapon
=
new
BlindingMagicWeapon
(
blindingMagicWeapon
.
unwield
();
new
Excalibur
());
blindingMagicWeapon
.
wield
();
FlyingMagicWeapon
flyingMagicWeapon
=
new
FlyingMagicWeapon
(
blindingMagicWeapon
.
blind
();
new
Mjollnir
());
blindingMagicWeapon
.
swing
();
flyingMagicWeapon
.
wield
();
blindingMagicWeapon
.
unwield
();
flyingMagicWeapon
.
fly
();
flyingMagicWeapon
.
swing
();
FlyingMagicWeapon
flyingMagicWeapon
=
new
FlyingMagicWeapon
(
flyingMagicWeapon
.
unwield
();
new
Mjollnir
());
flyingMagicWeapon
.
wield
();
SoulEatingMagicWeapon
soulEatingMagicWeapon
=
new
SoulEatingMagicWeapon
(
flyingMagicWeapon
.
fly
();
new
Stormbringer
());
flyingMagicWeapon
.
swing
();
soulEatingMagicWeapon
.
wield
();
flyingMagicWeapon
.
unwield
();
soulEatingMagicWeapon
.
swing
();
soulEatingMagicWeapon
.
eatSoul
();
SoulEatingMagicWeapon
soulEatingMagicWeapon
=
new
SoulEatingMagicWeapon
(
soulEatingMagicWeapon
.
unwield
();
new
Stormbringer
());
soulEatingMagicWeapon
.
wield
();
}
soulEatingMagicWeapon
.
swing
();
}
soulEatingMagicWeapon
.
eatSoul
();
soulEatingMagicWeapon
.
unwield
();
}
}
bridge/src/main/java/com/iluwatar/bridge/BlindingMagicWeapon.java
浏览文件 @
7d2e9fa1
package
com.iluwatar.bridge
;
package
com.iluwatar.bridge
;
public
class
BlindingMagicWeapon
extends
MagicWeapon
{
/**
*
public
BlindingMagicWeapon
(
BlindingMagicWeaponImp
imp
)
{
* BlindingMagicWeapon
super
(
imp
);
*
}
*/
public
class
BlindingMagicWeapon
extends
MagicWeapon
{
@Override
public
BlindingMagicWeaponImp
getImp
()
{
public
BlindingMagicWeapon
(
BlindingMagicWeaponImpl
imp
)
{
return
(
BlindingMagicWeaponImp
)
imp
;
super
(
imp
);
}
}
@Override
@Override
public
void
wield
()
{
public
BlindingMagicWeaponImpl
getImp
()
{
getImp
().
wieldImp
();
return
(
BlindingMagicWeaponImpl
)
imp
;
}
}
@Override
@Override
public
void
swing
()
{
public
void
wield
()
{
getImp
().
swingImp
();
getImp
().
wieldImp
();
}
}
@Override
@Override
public
void
unwield
()
{
public
void
swing
()
{
getImp
().
unwieldImp
();
getImp
().
swingImp
();
}
}
public
void
blind
()
{
@Override
getImp
().
blindImp
();
public
void
unwield
()
{
}
getImp
().
unwieldImp
();
}
}
public
void
blind
()
{
getImp
().
blindImp
();
}
}
bridge/src/main/java/com/iluwatar/bridge/BlindingMagicWeaponImp.java
→
bridge/src/main/java/com/iluwatar/bridge/BlindingMagicWeaponImp
l
.java
浏览文件 @
7d2e9fa1
package
com.iluwatar.bridge
;
package
com.iluwatar.bridge
;
public
abstract
class
BlindingMagicWeaponImp
extends
MagicWeaponImp
{
/**
*
public
abstract
void
blindImp
();
* BlindingMagicWeaponImpl
*
}
*/
public
abstract
class
BlindingMagicWeaponImpl
extends
MagicWeaponImpl
{
public
abstract
void
blindImp
();
}
bridge/src/main/java/com/iluwatar/bridge/Excalibur.java
浏览文件 @
7d2e9fa1
package
com.iluwatar.bridge
;
package
com.iluwatar.bridge
;
public
class
Excalibur
extends
BlindingMagicWeaponImp
{
/**
*
@Override
* Excalibur
public
void
wieldImp
()
{
*
System
.
out
.
println
(
"wielding Excalibur"
);
*/
}
public
class
Excalibur
extends
BlindingMagicWeaponImpl
{
@Override
@Override
public
void
swingImp
()
{
public
void
wieldImp
()
{
System
.
out
.
println
(
"swinging Excalibur"
);
System
.
out
.
println
(
"wielding Excalibur"
);
}
}
@Override
@Override
public
void
unwieldImp
()
{
public
void
swingImp
()
{
System
.
out
.
println
(
"unwielding Excalibur"
);
System
.
out
.
println
(
"swinging Excalibur"
);
}
}
@Override
@Override
public
void
blindImp
()
{
public
void
unwieldImp
()
{
System
.
out
System
.
out
.
println
(
"unwielding Excalibur"
);
.
println
(
"bright light streams from Excalibur blinding the enemy"
);
}
}
@Override
}
public
void
blindImp
()
{
System
.
out
.
println
(
"bright light streams from Excalibur blinding the enemy"
);
}
}
bridge/src/main/java/com/iluwatar/bridge/FlyingMagicWeapon.java
浏览文件 @
7d2e9fa1
package
com.iluwatar.bridge
;
package
com.iluwatar.bridge
;
public
class
FlyingMagicWeapon
extends
MagicWeapon
{
/**
*
public
FlyingMagicWeapon
(
FlyingMagicWeaponImp
imp
)
{
* FlyingMagicWeapon
super
(
imp
);
*
}
*/
public
class
FlyingMagicWeapon
extends
MagicWeapon
{
public
FlyingMagicWeaponImp
getImp
()
{
return
(
FlyingMagicWeaponImp
)
imp
;
public
FlyingMagicWeapon
(
FlyingMagicWeaponImpl
imp
)
{
}
super
(
imp
);
}
@Override
public
void
wield
()
{
public
FlyingMagicWeaponImpl
getImp
()
{
getImp
().
wieldImp
();
return
(
FlyingMagicWeaponImpl
)
imp
;
}
}
@Override
@Override
public
void
swing
()
{
public
void
wield
()
{
getImp
().
swingImp
();
getImp
().
wieldImp
();
}
}
@Override
@Override
public
void
unwield
()
{
public
void
swing
()
{
getImp
().
unwieldImp
();
getImp
().
swingImp
();
}
}
public
void
fly
()
{
@Override
getImp
().
flyImp
();
public
void
unwield
()
{
}
getImp
().
unwieldImp
();
}
}
public
void
fly
()
{
getImp
().
flyImp
();
}
}
bridge/src/main/java/com/iluwatar/bridge/FlyingMagicWeaponImp.java
→
bridge/src/main/java/com/iluwatar/bridge/FlyingMagicWeaponImp
l
.java
浏览文件 @
7d2e9fa1
package
com.iluwatar.bridge
;
package
com.iluwatar.bridge
;
public
abstract
class
FlyingMagicWeaponImp
extends
MagicWeaponImp
{
/**
*
public
abstract
void
flyImp
();
* FlyingMagicWeaponImpl
*
}
*/
public
abstract
class
FlyingMagicWeaponImpl
extends
MagicWeaponImpl
{
public
abstract
void
flyImp
();
}
bridge/src/main/java/com/iluwatar/bridge/MagicWeapon.java
浏览文件 @
7d2e9fa1
package
com.iluwatar.bridge
;
package
com.iluwatar.bridge
;
/**
/**
*
*
*
Abstraction interface.
*
MagicWeapon
*
*
*/
*/
public
abstract
class
MagicWeapon
{
public
abstract
class
MagicWeapon
{
protected
MagicWeaponImp
imp
;
protected
MagicWeaponImp
l
imp
;
public
MagicWeapon
(
MagicWeaponImp
imp
)
{
public
MagicWeapon
(
MagicWeaponImp
l
imp
)
{
this
.
imp
=
imp
;
this
.
imp
=
imp
;
}
}
public
abstract
void
wield
();
public
abstract
void
wield
();
public
abstract
void
swing
();
public
abstract
void
swing
();
public
abstract
void
unwield
();
public
abstract
void
unwield
();
public
MagicWeaponImp
getImp
()
{
public
MagicWeaponImp
l
getImp
()
{
return
imp
;
return
imp
;
}
}
}
}
bridge/src/main/java/com/iluwatar/bridge/MagicWeaponImp.java
→
bridge/src/main/java/com/iluwatar/bridge/MagicWeaponImp
l
.java
浏览文件 @
7d2e9fa1
package
com.iluwatar.bridge
;
package
com.iluwatar.bridge
;
/**
/**
*
*
*
Implementation interface.
*
MagicWeaponImpl
*
*
*/
*/
public
abstract
class
MagicWeaponImp
{
public
abstract
class
MagicWeaponImp
l
{
public
abstract
void
wieldImp
();
public
abstract
void
wieldImp
();
public
abstract
void
swingImp
();
public
abstract
void
swingImp
();
public
abstract
void
unwieldImp
();
public
abstract
void
unwieldImp
();
}
}
bridge/src/main/java/com/iluwatar/bridge/Mjollnir.java
浏览文件 @
7d2e9fa1
package
com.iluwatar.bridge
;
package
com.iluwatar.bridge
;
public
class
Mjollnir
extends
FlyingMagicWeaponImp
{
/**
*
@Override
* Mjollnir
public
void
wieldImp
()
{
*
System
.
out
.
println
(
"wielding Mjollnir"
);
*/
}
public
class
Mjollnir
extends
FlyingMagicWeaponImpl
{
@Override
@Override
public
void
swingImp
()
{
public
void
wieldImp
()
{
System
.
out
.
println
(
"swinging Mjollnir"
);
System
.
out
.
println
(
"wielding Mjollnir"
);
}
}
@Override
@Override
public
void
unwieldImp
()
{
public
void
swingImp
()
{
System
.
out
.
println
(
"unwielding Mjollnir"
);
System
.
out
.
println
(
"swinging Mjollnir"
);
}
}
@Override
@Override
public
void
flyImp
()
{
public
void
unwieldImp
()
{
System
.
out
System
.
out
.
println
(
"unwielding Mjollnir"
);
.
println
(
"Mjollnir hits the enemy in the air and returns back to the owner's hand"
);
}
}
@Override
}
public
void
flyImp
()
{
System
.
out
.
println
(
"Mjollnir hits the enemy in the air and returns back to the owner's hand"
);
}
}
bridge/src/main/java/com/iluwatar/bridge/SoulEatingMagicWeapon.java
浏览文件 @
7d2e9fa1
package
com.iluwatar.bridge
;
package
com.iluwatar.bridge
;
public
class
SoulEatingMagicWeapon
extends
MagicWeapon
{
/**
*
public
SoulEatingMagicWeapon
(
SoulEatingMagicWeaponImp
imp
)
{
* SoulEatingMagicWeapon
super
(
imp
);
*
}
*/
public
class
SoulEatingMagicWeapon
extends
MagicWeapon
{
@Override
public
SoulEatingMagicWeaponImp
getImp
()
{
public
SoulEatingMagicWeapon
(
SoulEatingMagicWeaponImpl
imp
)
{
return
(
SoulEatingMagicWeaponImp
)
imp
;
super
(
imp
);
}
}
@Override
@Override
public
void
wield
()
{
public
SoulEatingMagicWeaponImpl
getImp
()
{
getImp
().
wieldImp
();
return
(
SoulEatingMagicWeaponImpl
)
imp
;
}
}
@Override
@Override
public
void
swing
()
{
public
void
wield
()
{
getImp
().
swingImp
();
getImp
().
wieldImp
();
}
}
@Override
@Override
public
void
unwield
()
{
public
void
swing
()
{
getImp
().
unwieldImp
();
getImp
().
swingImp
();
}
}
public
void
eatSoul
()
{
@Override
getImp
().
eatSoulImp
();
public
void
unwield
()
{
}
getImp
().
unwieldImp
();
}
}
public
void
eatSoul
()
{
getImp
().
eatSoulImp
();
}
}
bridge/src/main/java/com/iluwatar/bridge/SoulEatingMagicWeaponImp.java
→
bridge/src/main/java/com/iluwatar/bridge/SoulEatingMagicWeaponImp
l
.java
浏览文件 @
7d2e9fa1
package
com.iluwatar.bridge
;
package
com.iluwatar.bridge
;
public
abstract
class
SoulEatingMagicWeaponImp
extends
MagicWeaponImp
{
/**
*
public
abstract
void
eatSoulImp
();
* SoulEatingMagicWeaponImpl
*
}
*/
public
abstract
class
SoulEatingMagicWeaponImpl
extends
MagicWeaponImpl
{
public
abstract
void
eatSoulImp
();
}
bridge/src/main/java/com/iluwatar/bridge/Stormbringer.java
浏览文件 @
7d2e9fa1
package
com.iluwatar.bridge
;
package
com.iluwatar.bridge
;
public
class
Stormbringer
extends
SoulEatingMagicWeaponImp
{
/**
*
@Override
* Stormbringer
public
void
wieldImp
()
{
*
System
.
out
.
println
(
"wielding Stormbringer"
);
*/
}
public
class
Stormbringer
extends
SoulEatingMagicWeaponImpl
{
@Override
@Override
public
void
swingImp
()
{
public
void
wieldImp
()
{
System
.
out
.
println
(
"swinging Stormbringer"
);
System
.
out
.
println
(
"wielding Stormbringer"
);
}
}
@Override
@Override
public
void
unwieldImp
()
{
public
void
swingImp
()
{
System
.
out
.
println
(
"unwielding Stormbringer"
);
System
.
out
.
println
(
"swinging Stormbringer"
);
}
}
@Override
@Override
public
void
eatSoulImp
()
{
public
void
unwieldImp
()
{
System
.
out
.
println
(
"Stormbringer devours the enemy's soul"
);
System
.
out
.
println
(
"unwielding Stormbringer"
);
}
}
}
@Override
public
void
eatSoulImp
()
{
System
.
out
.
println
(
"Stormbringer devours the enemy's soul"
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录