diff --git a/README.md b/README.md
deleted file mode 100644
index a49abcc..0000000
--- a/README.md
+++ /dev/null
@@ -1 +0,0 @@
-# JavaCode
\ No newline at end of file
diff --git a/desginPattern/.gitignore b/desginPattern/.gitignore
new file mode 100644
index 0000000..129084a
--- /dev/null
+++ b/desginPattern/.gitignore
@@ -0,0 +1,31 @@
+# Created by .ignore support plugin (hsz.mobi)
+### Java template
+# Compiled class file
+*.class
+
+# Log file
+*.log
+
+# BlueJ files
+*.ctxt
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+*.jar
+*.war
+*.nar
+*.ear
+*.zip
+*.tar.gz
+*.rar
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+
+/.idea/
+/.classpath
+/.project
+/DesignPattern.iml
+/.settings/
diff --git a/desginPattern/src/com/atguigu/adapter/classadapter/Client.java b/desginPattern/src/com/atguigu/adapter/classadapter/Client.java
new file mode 100644
index 0000000..04401f0
--- /dev/null
+++ b/desginPattern/src/com/atguigu/adapter/classadapter/Client.java
@@ -0,0 +1,12 @@
+package com.atguigu.adapter.classadapter;
+
+public class Client {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ System.out.println(" === 类适配器模式 ====");
+ Phone phone = new Phone();
+ phone.charging(new VoltageAdapter());
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/adapter/classadapter/IVoltage5V.java b/desginPattern/src/com/atguigu/adapter/classadapter/IVoltage5V.java
new file mode 100644
index 0000000..2b56380
--- /dev/null
+++ b/desginPattern/src/com/atguigu/adapter/classadapter/IVoltage5V.java
@@ -0,0 +1,7 @@
+package com.atguigu.adapter.classadapter;
+
+
+//适配接口
+public interface IVoltage5V {
+ public int output5V();
+}
diff --git a/desginPattern/src/com/atguigu/adapter/classadapter/Phone.java b/desginPattern/src/com/atguigu/adapter/classadapter/Phone.java
new file mode 100644
index 0000000..3f60b62
--- /dev/null
+++ b/desginPattern/src/com/atguigu/adapter/classadapter/Phone.java
@@ -0,0 +1,13 @@
+package com.atguigu.adapter.classadapter;
+
+public class Phone {
+
+ //充电
+ public void charging(IVoltage5V iVoltage5V) {
+ if(iVoltage5V.output5V() == 5) {
+ System.out.println("电压为5V, 可以充电~~");
+ } else if (iVoltage5V.output5V() > 5) {
+ System.out.println("电压大于5V, 不能充电~~");
+ }
+ }
+}
diff --git a/desginPattern/src/com/atguigu/adapter/classadapter/Voltage220V.java b/desginPattern/src/com/atguigu/adapter/classadapter/Voltage220V.java
new file mode 100644
index 0000000..29a1828
--- /dev/null
+++ b/desginPattern/src/com/atguigu/adapter/classadapter/Voltage220V.java
@@ -0,0 +1,11 @@
+package com.atguigu.adapter.classadapter;
+
+//被适配的类
+public class Voltage220V {
+ //输出220V的电压
+ public int output220V() {
+ int src = 220;
+ System.out.println("电压=" + src + "伏");
+ return src;
+ }
+}
diff --git a/desginPattern/src/com/atguigu/adapter/classadapter/VoltageAdapter.java b/desginPattern/src/com/atguigu/adapter/classadapter/VoltageAdapter.java
new file mode 100644
index 0000000..1104037
--- /dev/null
+++ b/desginPattern/src/com/atguigu/adapter/classadapter/VoltageAdapter.java
@@ -0,0 +1,15 @@
+package com.atguigu.adapter.classadapter;
+
+//适配器类
+public class VoltageAdapter extends Voltage220V implements IVoltage5V {
+
+ @Override
+ public int output5V() {
+ // TODO Auto-generated method stub
+ //获取到220V电压
+ int srcV = output220V();
+ int dstV = srcV / 44 ; //转成 5v
+ return dstV;
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/adapter/classadapter/newfile.cld b/desginPattern/src/com/atguigu/adapter/classadapter/newfile.cld
new file mode 100644
index 0000000..abc9c17
--- /dev/null
+++ b/desginPattern/src/com/atguigu/adapter/classadapter/newfile.cld
@@ -0,0 +1,503 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 557
+ 119
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 417
+ 266
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 350
+ 130
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 129
+ 130
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 132
+ 246
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Client
+ false
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ charging
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Phone
+ false
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ output5V
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+
+ Voltage5V
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ VoltageAdapter
+ false
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ output220V
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Voltage220V
+ false
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/adapter/interfaceadapter/AbsAdapter.java b/desginPattern/src/com/atguigu/adapter/interfaceadapter/AbsAdapter.java
new file mode 100644
index 0000000..f708b4b
--- /dev/null
+++ b/desginPattern/src/com/atguigu/adapter/interfaceadapter/AbsAdapter.java
@@ -0,0 +1,22 @@
+package com.atguigu.adapter.interfaceadapter;
+
+//在AbsAdapter 我们将 Interface4 的方法进行默认实现
+public abstract class AbsAdapter implements Interface4 {
+
+ //默认实现
+ public void m1() {
+
+ }
+
+ public void m2() {
+
+ }
+
+ public void m3() {
+
+ }
+
+ public void m4() {
+
+ }
+}
diff --git a/desginPattern/src/com/atguigu/adapter/interfaceadapter/Client.java b/desginPattern/src/com/atguigu/adapter/interfaceadapter/Client.java
new file mode 100644
index 0000000..279d560
--- /dev/null
+++ b/desginPattern/src/com/atguigu/adapter/interfaceadapter/Client.java
@@ -0,0 +1,17 @@
+package com.atguigu.adapter.interfaceadapter;
+
+public class Client {
+ public static void main(String[] args) {
+
+ AbsAdapter absAdapter = new AbsAdapter() {
+ //只需要去覆盖我们 需要使用 接口方法
+ @Override
+ public void m1() {
+ // TODO Auto-generated method stub
+ System.out.println("使用了m1的方法");
+ }
+ };
+
+ absAdapter.m1();
+ }
+}
diff --git a/desginPattern/src/com/atguigu/adapter/interfaceadapter/Interface4.java b/desginPattern/src/com/atguigu/adapter/interfaceadapter/Interface4.java
new file mode 100644
index 0000000..7db78b3
--- /dev/null
+++ b/desginPattern/src/com/atguigu/adapter/interfaceadapter/Interface4.java
@@ -0,0 +1,8 @@
+package com.atguigu.adapter.interfaceadapter;
+
+public interface Interface4 {
+ public void m1();
+ public void m2();
+ public void m3();
+ public void m4();
+}
diff --git a/desginPattern/src/com/atguigu/adapter/interfaceadapter/newfile.cld b/desginPattern/src/com/atguigu/adapter/interfaceadapter/newfile.cld
new file mode 100644
index 0000000..b98e721
--- /dev/null
+++ b/desginPattern/src/com/atguigu/adapter/interfaceadapter/newfile.cld
@@ -0,0 +1,384 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 423
+ 78
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 425
+ 265
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ 58
+ 124
+ 586
+ 238
+
+
+
+
+
+
+
+ AbsA 绫绘娊璞$被
+, 榛樿瀹炵幇 鎺ュ彛鐨勬墍鏈夋柟娉
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 86
+ 262
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ A
+ false
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ AbsAdapter
+ false
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation1
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation2
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation3
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation4
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+
+ Interface4
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/adapter/objectadapter/Client.java b/desginPattern/src/com/atguigu/adapter/objectadapter/Client.java
new file mode 100644
index 0000000..5622950
--- /dev/null
+++ b/desginPattern/src/com/atguigu/adapter/objectadapter/Client.java
@@ -0,0 +1,12 @@
+package com.atguigu.adapter.objectadapter;
+
+public class Client {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ System.out.println(" === 对象适配器模式 ====");
+ Phone phone = new Phone();
+ phone.charging(new VoltageAdapter(new Voltage220V()));
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/adapter/objectadapter/IVoltage5V.java b/desginPattern/src/com/atguigu/adapter/objectadapter/IVoltage5V.java
new file mode 100644
index 0000000..08ec1db
--- /dev/null
+++ b/desginPattern/src/com/atguigu/adapter/objectadapter/IVoltage5V.java
@@ -0,0 +1,7 @@
+package com.atguigu.adapter.objectadapter;
+
+
+//适配接口
+public interface IVoltage5V {
+ public int output5V();
+}
diff --git a/desginPattern/src/com/atguigu/adapter/objectadapter/Phone.java b/desginPattern/src/com/atguigu/adapter/objectadapter/Phone.java
new file mode 100644
index 0000000..32ba3fe
--- /dev/null
+++ b/desginPattern/src/com/atguigu/adapter/objectadapter/Phone.java
@@ -0,0 +1,13 @@
+package com.atguigu.adapter.objectadapter;
+
+public class Phone {
+
+ //充电
+ public void charging(IVoltage5V iVoltage5V) {
+ if(iVoltage5V.output5V() == 5) {
+ System.out.println("电压为5V, 可以充电~~");
+ } else if (iVoltage5V.output5V() > 5) {
+ System.out.println("电压大于5V, 不能充电~~");
+ }
+ }
+}
diff --git a/desginPattern/src/com/atguigu/adapter/objectadapter/Voltage220V.java b/desginPattern/src/com/atguigu/adapter/objectadapter/Voltage220V.java
new file mode 100644
index 0000000..3f23e5e
--- /dev/null
+++ b/desginPattern/src/com/atguigu/adapter/objectadapter/Voltage220V.java
@@ -0,0 +1,11 @@
+package com.atguigu.adapter.objectadapter;
+
+//被适配的类
+public class Voltage220V {
+ //输出220V的电压,不变
+ public int output220V() {
+ int src = 220;
+ System.out.println("电压=" + src + "伏");
+ return src;
+ }
+}
diff --git a/desginPattern/src/com/atguigu/adapter/objectadapter/VoltageAdapter.java b/desginPattern/src/com/atguigu/adapter/objectadapter/VoltageAdapter.java
new file mode 100644
index 0000000..c38ef49
--- /dev/null
+++ b/desginPattern/src/com/atguigu/adapter/objectadapter/VoltageAdapter.java
@@ -0,0 +1,32 @@
+package com.atguigu.adapter.objectadapter;
+
+//适配器类
+public class VoltageAdapter implements IVoltage5V {
+
+ private Voltage220V voltage220V; // 关联关系-聚合
+
+
+ //通过构造器,传入一个 Voltage220V 实例
+ public VoltageAdapter(Voltage220V voltage220v) {
+
+ this.voltage220V = voltage220v;
+ }
+
+
+
+ @Override
+ public int output5V() {
+
+ int dst = 0;
+ if(null != voltage220V) {
+ int src = voltage220V.output220V();//获取220V 电压
+ System.out.println("使用对象适配器,进行适配~~");
+ dst = src / 44;
+ System.out.println("适配完成,输出的电压为=" + dst);
+ }
+
+ return dst;
+
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/adapter/objectadapter/newfile.cld b/desginPattern/src/com/atguigu/adapter/objectadapter/newfile.cld
new file mode 100644
index 0000000..3ddf039
--- /dev/null
+++ b/desginPattern/src/com/atguigu/adapter/objectadapter/newfile.cld
@@ -0,0 +1,609 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 545
+ 97
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 383
+ 254
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 323
+ 88
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 7
+ 94
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 137
+ 251
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Client
+ false
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ charging
+ void
+
+
+ voltage5v
+ Voltage5v
+
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Phone
+ false
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ output5V
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+
+ Voltage5V
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ voltage220
+ Voltage220V
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ VoltageAdapter
+ void
+
+
+ voltage220v
+ Voltage220V
+
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ VoltageAdapter
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ output220V
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Voltage220V
+ false
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/bridge/Brand.java b/desginPattern/src/com/atguigu/bridge/Brand.java
new file mode 100644
index 0000000..81b3b89
--- /dev/null
+++ b/desginPattern/src/com/atguigu/bridge/Brand.java
@@ -0,0 +1,8 @@
+package com.atguigu.bridge;
+
+//接口
+public interface Brand {
+ void open();
+ void close();
+ void call();
+}
diff --git a/desginPattern/src/com/atguigu/bridge/Client.java b/desginPattern/src/com/atguigu/bridge/Client.java
new file mode 100644
index 0000000..887642f
--- /dev/null
+++ b/desginPattern/src/com/atguigu/bridge/Client.java
@@ -0,0 +1,40 @@
+package com.atguigu.bridge;
+
+public class Client {
+
+ public static void main(String[] args) {
+
+ //获取折叠式手机 (样式 + 品牌 )
+
+ Phone phone1 = new FoldedPhone(new XiaoMi());
+
+ phone1.open();
+ phone1.call();
+ phone1.close();
+
+ System.out.println("=======================");
+
+ Phone phone2 = new FoldedPhone(new Vivo());
+
+ phone2.open();
+ phone2.call();
+ phone2.close();
+
+ System.out.println("==============");
+
+ UpRightPhone phone3 = new UpRightPhone(new XiaoMi());
+
+ phone3.open();
+ phone3.call();
+ phone3.close();
+
+ System.out.println("==============");
+
+ UpRightPhone phone4 = new UpRightPhone(new Vivo());
+
+ phone4.open();
+ phone4.call();
+ phone4.close();
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/bridge/FoldedPhone.java b/desginPattern/src/com/atguigu/bridge/FoldedPhone.java
new file mode 100644
index 0000000..8a6bbd4
--- /dev/null
+++ b/desginPattern/src/com/atguigu/bridge/FoldedPhone.java
@@ -0,0 +1,26 @@
+package com.atguigu.bridge;
+
+
+//折叠式手机类,继承 抽象类 Phone
+public class FoldedPhone extends Phone {
+
+ //构造器
+ public FoldedPhone(Brand brand) {
+ super(brand);
+ }
+
+ public void open() {
+ super.open();
+ System.out.println(" 折叠样式手机 ");
+ }
+
+ public void close() {
+ super.close();
+ System.out.println(" 折叠样式手机 ");
+ }
+
+ public void call() {
+ super.call();
+ System.out.println(" 折叠样式手机 ");
+ }
+}
diff --git a/desginPattern/src/com/atguigu/bridge/Phone.java b/desginPattern/src/com/atguigu/bridge/Phone.java
new file mode 100644
index 0000000..5ebfc96
--- /dev/null
+++ b/desginPattern/src/com/atguigu/bridge/Phone.java
@@ -0,0 +1,24 @@
+package com.atguigu.bridge;
+
+public abstract class Phone {
+
+ //组合品牌
+ private Brand brand;
+
+ //构造器
+ public Phone(Brand brand) {
+ super();
+ this.brand = brand;
+ }
+
+ protected void open() {
+ this.brand.open();
+ }
+ protected void close() {
+ brand.close();
+ }
+ protected void call() {
+ brand.call();
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/bridge/UpRightPhone.java b/desginPattern/src/com/atguigu/bridge/UpRightPhone.java
new file mode 100644
index 0000000..069585e
--- /dev/null
+++ b/desginPattern/src/com/atguigu/bridge/UpRightPhone.java
@@ -0,0 +1,24 @@
+package com.atguigu.bridge;
+
+public class UpRightPhone extends Phone {
+
+ //构造器
+ public UpRightPhone(Brand brand) {
+ super(brand);
+ }
+
+ public void open() {
+ super.open();
+ System.out.println(" 直立样式手机 ");
+ }
+
+ public void close() {
+ super.close();
+ System.out.println(" 直立样式手机 ");
+ }
+
+ public void call() {
+ super.call();
+ System.out.println(" 直立样式手机 ");
+ }
+}
diff --git a/desginPattern/src/com/atguigu/bridge/Vivo.java b/desginPattern/src/com/atguigu/bridge/Vivo.java
new file mode 100644
index 0000000..2c9e5fe
--- /dev/null
+++ b/desginPattern/src/com/atguigu/bridge/Vivo.java
@@ -0,0 +1,23 @@
+package com.atguigu.bridge;
+
+public class Vivo implements Brand {
+
+ @Override
+ public void open() {
+ // TODO Auto-generated method stub
+ System.out.println(" Vivo手机开机 ");
+ }
+
+ @Override
+ public void close() {
+ // TODO Auto-generated method stub
+ System.out.println(" Vivo手机关机 ");
+ }
+
+ @Override
+ public void call() {
+ // TODO Auto-generated method stub
+ System.out.println(" Vivo手机打电话 ");
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/bridge/XiaoMi.java b/desginPattern/src/com/atguigu/bridge/XiaoMi.java
new file mode 100644
index 0000000..ef8adb4
--- /dev/null
+++ b/desginPattern/src/com/atguigu/bridge/XiaoMi.java
@@ -0,0 +1,23 @@
+package com.atguigu.bridge;
+
+public class XiaoMi implements Brand {
+
+ @Override
+ public void open() {
+ // TODO Auto-generated method stub
+ System.out.println(" 小米手机开机 ");
+ }
+
+ @Override
+ public void close() {
+ // TODO Auto-generated method stub
+ System.out.println(" 小米手机关机 ");
+ }
+
+ @Override
+ public void call() {
+ // TODO Auto-generated method stub
+ System.out.println(" 小米手机打电话 ");
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/bridge/newfile.cld b/desginPattern/src/com/atguigu/bridge/newfile.cld
new file mode 100644
index 0000000..d7fb254
--- /dev/null
+++ b/desginPattern/src/com/atguigu/bridge/newfile.cld
@@ -0,0 +1,644 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 372
+ 149
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 170
+ 145
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 71
+ 279
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ FoldedPhone
+ false
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 191
+ 282
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ UpRightPhone
+ false
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 268
+ 40
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Client
+ false
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ brand
+ Brand
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Phone
+ false
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 347
+ 279
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Vivo
+ false
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 452
+ 278
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ XiaoMi
+ false
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ call
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+
+ Brand
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/builder/AbstractHouse.java b/desginPattern/src/com/atguigu/builder/AbstractHouse.java
new file mode 100644
index 0000000..58c866a
--- /dev/null
+++ b/desginPattern/src/com/atguigu/builder/AbstractHouse.java
@@ -0,0 +1,18 @@
+package com.atguigu.builder;
+
+public abstract class AbstractHouse {
+
+ //打地基
+ public abstract void buildBasic();
+ //砌墙
+ public abstract void buildWalls();
+ //封顶
+ public abstract void roofed();
+
+ public void build() {
+ buildBasic();
+ buildWalls();
+ roofed();
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/builder/Client.java b/desginPattern/src/com/atguigu/builder/Client.java
new file mode 100644
index 0000000..a489680
--- /dev/null
+++ b/desginPattern/src/com/atguigu/builder/Client.java
@@ -0,0 +1,11 @@
+package com.atguigu.builder;
+
+public class Client {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ CommonHouse commonHouse = new CommonHouse();
+ commonHouse.build();
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/builder/CommonHouse.java b/desginPattern/src/com/atguigu/builder/CommonHouse.java
new file mode 100644
index 0000000..e788e52
--- /dev/null
+++ b/desginPattern/src/com/atguigu/builder/CommonHouse.java
@@ -0,0 +1,23 @@
+package com.atguigu.builder;
+
+public class CommonHouse extends AbstractHouse {
+
+ @Override
+ public void buildBasic() {
+ // TODO Auto-generated method stub
+ System.out.println(" 普通房子打地基 ");
+ }
+
+ @Override
+ public void buildWalls() {
+ // TODO Auto-generated method stub
+ System.out.println(" 普通房子砌墙 ");
+ }
+
+ @Override
+ public void roofed() {
+ // TODO Auto-generated method stub
+ System.out.println(" 普通房子封顶 ");
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/builder/improve/Client.java b/desginPattern/src/com/atguigu/builder/improve/Client.java
new file mode 100644
index 0000000..932ae25
--- /dev/null
+++ b/desginPattern/src/com/atguigu/builder/improve/Client.java
@@ -0,0 +1,27 @@
+package com.atguigu.builder.improve;
+
+public class Client {
+ public static void main(String[] args) {
+
+ //盖普通房子
+ CommonHouse commonHouse = new CommonHouse();
+ //准备创建房子的指挥者
+ HouseDirector houseDirector = new HouseDirector(commonHouse);
+
+ //完成盖房子,返回产品(普通房子)
+ House house = houseDirector.constructHouse();
+
+ //System.out.println("输出流程");
+
+ System.out.println("--------------------------");
+ //盖高楼
+ HighBuilding highBuilding = new HighBuilding();
+ //重置建造者
+ houseDirector.setHouseBuilder(highBuilding);
+ //完成盖房子,返回产品(高楼)
+ houseDirector.constructHouse();
+
+
+
+ }
+}
diff --git a/desginPattern/src/com/atguigu/builder/improve/CommonHouse.java b/desginPattern/src/com/atguigu/builder/improve/CommonHouse.java
new file mode 100644
index 0000000..44ba99d
--- /dev/null
+++ b/desginPattern/src/com/atguigu/builder/improve/CommonHouse.java
@@ -0,0 +1,23 @@
+package com.atguigu.builder.improve;
+
+public class CommonHouse extends HouseBuilder {
+
+ @Override
+ public void buildBasic() {
+ // TODO Auto-generated method stub
+ System.out.println(" 普通房子打地基5米 ");
+ }
+
+ @Override
+ public void buildWalls() {
+ // TODO Auto-generated method stub
+ System.out.println(" 普通房子砌墙10cm ");
+ }
+
+ @Override
+ public void roofed() {
+ // TODO Auto-generated method stub
+ System.out.println(" 普通房子屋顶 ");
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/builder/improve/HighBuilding.java b/desginPattern/src/com/atguigu/builder/improve/HighBuilding.java
new file mode 100644
index 0000000..82d6643
--- /dev/null
+++ b/desginPattern/src/com/atguigu/builder/improve/HighBuilding.java
@@ -0,0 +1,23 @@
+package com.atguigu.builder.improve;
+
+public class HighBuilding extends HouseBuilder {
+
+ @Override
+ public void buildBasic() {
+ // TODO Auto-generated method stub
+ System.out.println(" 高楼的打地基100米 ");
+ }
+
+ @Override
+ public void buildWalls() {
+ // TODO Auto-generated method stub
+ System.out.println(" 高楼的砌墙20cm ");
+ }
+
+ @Override
+ public void roofed() {
+ // TODO Auto-generated method stub
+ System.out.println(" 高楼的透明屋顶 ");
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/builder/improve/House.java b/desginPattern/src/com/atguigu/builder/improve/House.java
new file mode 100644
index 0000000..ab86952
--- /dev/null
+++ b/desginPattern/src/com/atguigu/builder/improve/House.java
@@ -0,0 +1,27 @@
+package com.atguigu.builder.improve;
+
+//产品->Product
+public class House {
+ private String baise;
+ private String wall;
+ private String roofed;
+ public String getBaise() {
+ return baise;
+ }
+ public void setBaise(String baise) {
+ this.baise = baise;
+ }
+ public String getWall() {
+ return wall;
+ }
+ public void setWall(String wall) {
+ this.wall = wall;
+ }
+ public String getRoofed() {
+ return roofed;
+ }
+ public void setRoofed(String roofed) {
+ this.roofed = roofed;
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/builder/improve/HouseBuilder.java b/desginPattern/src/com/atguigu/builder/improve/HouseBuilder.java
new file mode 100644
index 0000000..d124a52
--- /dev/null
+++ b/desginPattern/src/com/atguigu/builder/improve/HouseBuilder.java
@@ -0,0 +1,19 @@
+package com.atguigu.builder.improve;
+
+
+// 抽象的建造者
+public abstract class HouseBuilder {
+
+ protected House house = new House();
+
+ //将建造的流程写好, 抽象的方法
+ public abstract void buildBasic();
+ public abstract void buildWalls();
+ public abstract void roofed();
+
+ //建造房子好, 将产品(房子) 返回
+ public House buildHouse() {
+ return house;
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/builder/improve/HouseDirector.java b/desginPattern/src/com/atguigu/builder/improve/HouseDirector.java
new file mode 100644
index 0000000..cbd3072
--- /dev/null
+++ b/desginPattern/src/com/atguigu/builder/improve/HouseDirector.java
@@ -0,0 +1,27 @@
+package com.atguigu.builder.improve;
+
+//指挥者,这里去指定制作流程,返回产品
+public class HouseDirector {
+
+ HouseBuilder houseBuilder = null;
+
+ //构造器传入 houseBuilder
+ public HouseDirector(HouseBuilder houseBuilder) {
+ this.houseBuilder = houseBuilder;
+ }
+
+ //通过setter 传入 houseBuilder
+ public void setHouseBuilder(HouseBuilder houseBuilder) {
+ this.houseBuilder = houseBuilder;
+ }
+
+ //如何处理建造房子的流程,交给指挥者
+ public House constructHouse() {
+ houseBuilder.buildBasic();
+ houseBuilder.buildWalls();
+ houseBuilder.roofed();
+ return houseBuilder.buildHouse();
+ }
+
+
+}
diff --git a/desginPattern/src/com/atguigu/builder/improve/newfile.cld b/desginPattern/src/com/atguigu/builder/improve/newfile.cld
new file mode 100644
index 0000000..82cf8f5
--- /dev/null
+++ b/desginPattern/src/com/atguigu/builder/improve/newfile.cld
@@ -0,0 +1,913 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ 30
+ 100
+ 537
+ 43
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ 浜у搧
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 277
+ 95
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 191
+ 294
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 55
+ 224
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 379
+ 288
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ HighBuilding
+ false
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 532
+ 289
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ OtherHouse
+ false
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Client
+ false
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ CommonHouse
+ false
+
+
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 29
+ 110
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ houseBuilder
+ HouseBuilder
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ HouseDirector
+ false
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ house
+ House = new House()
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ buildBisic
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ buildWalls
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ roofed
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ build
+ House
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ HouseBuilder
+ false
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 539
+ 116
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ House
+ false
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/builder/newfile.cld b/desginPattern/src/com/atguigu/builder/newfile.cld
new file mode 100644
index 0000000..4b28d06
--- /dev/null
+++ b/desginPattern/src/com/atguigu/builder/newfile.cld
@@ -0,0 +1,474 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 190
+ 276
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 298
+ 366
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 402
+ 282
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ HighBuilding
+ false
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Client
+ false
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ CommonHouse
+ false
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 250
+ 115
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ buildBaisc
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ buildWalls
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ roofed
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ build
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ AbstractHouse
+ false
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/command/Client.java b/desginPattern/src/com/atguigu/command/Client.java
new file mode 100644
index 0000000..d4c1be0
--- /dev/null
+++ b/desginPattern/src/com/atguigu/command/Client.java
@@ -0,0 +1,50 @@
+package com.atguigu.command;
+
+public class Client {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+
+ //使用命令设计模式,完成通过遥控器,对电灯的操作
+
+ //创建电灯的对象(接受者)
+ LightReceiver lightReceiver = new LightReceiver();
+
+ //创建电灯相关的开关命令
+ LightOnCommand lightOnCommand = new LightOnCommand(lightReceiver);
+ LightOffCommand lightOffCommand = new LightOffCommand(lightReceiver);
+
+ //需要一个遥控器
+ RemoteController remoteController = new RemoteController();
+
+ //给我们的遥控器设置命令, 比如 no = 0 是电灯的开和关的操作
+ remoteController.setCommand(0, lightOnCommand, lightOffCommand);
+
+ System.out.println("--------按下灯的开按钮-----------");
+ remoteController.onButtonWasPushed(0);
+ System.out.println("--------按下灯的关按钮-----------");
+ remoteController.offButtonWasPushed(0);
+ System.out.println("--------按下撤销按钮-----------");
+ remoteController.undoButtonWasPushed();
+
+
+ System.out.println("=========使用遥控器操作电视机==========");
+
+ TVReceiver tvReceiver = new TVReceiver();
+
+ TVOffCommand tvOffCommand = new TVOffCommand(tvReceiver);
+ TVOnCommand tvOnCommand = new TVOnCommand(tvReceiver);
+
+ //给我们的遥控器设置命令, 比如 no = 1 是电视机的开和关的操作
+ remoteController.setCommand(1, tvOnCommand, tvOffCommand);
+
+ System.out.println("--------按下电视机的开按钮-----------");
+ remoteController.onButtonWasPushed(1);
+ System.out.println("--------按下电视机的关按钮-----------");
+ remoteController.offButtonWasPushed(1);
+ System.out.println("--------按下撤销按钮-----------");
+ remoteController.undoButtonWasPushed();
+
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/command/Command.java b/desginPattern/src/com/atguigu/command/Command.java
new file mode 100644
index 0000000..27e3611
--- /dev/null
+++ b/desginPattern/src/com/atguigu/command/Command.java
@@ -0,0 +1,11 @@
+package com.atguigu.command;
+
+
+//创建命令接口
+public interface Command {
+
+ //执行动作(操作)
+ public void execute();
+ //撤销动作(操作)
+ public void undo();
+}
diff --git a/desginPattern/src/com/atguigu/command/LightOffCommand.java b/desginPattern/src/com/atguigu/command/LightOffCommand.java
new file mode 100644
index 0000000..72ddc83
--- /dev/null
+++ b/desginPattern/src/com/atguigu/command/LightOffCommand.java
@@ -0,0 +1,28 @@
+package com.atguigu.command;
+
+public class LightOffCommand implements Command {
+
+ // 聚合LightReceiver
+
+ LightReceiver light;
+
+ // 构造器
+ public LightOffCommand(LightReceiver light) {
+ super();
+ this.light = light;
+ }
+
+ @Override
+ public void execute() {
+ // TODO Auto-generated method stub
+ // 调用接收者的方法
+ light.off();
+ }
+
+ @Override
+ public void undo() {
+ // TODO Auto-generated method stub
+ // 调用接收者的方法
+ light.on();
+ }
+}
diff --git a/desginPattern/src/com/atguigu/command/LightOnCommand.java b/desginPattern/src/com/atguigu/command/LightOnCommand.java
new file mode 100644
index 0000000..98bca42
--- /dev/null
+++ b/desginPattern/src/com/atguigu/command/LightOnCommand.java
@@ -0,0 +1,31 @@
+package com.atguigu.command;
+
+public class LightOnCommand implements Command {
+
+ //聚合LightReceiver
+
+ LightReceiver light;
+
+ //构造器
+ public LightOnCommand(LightReceiver light) {
+ super();
+ this.light = light;
+ }
+
+ @Override
+ public void execute() {
+ // TODO Auto-generated method stub
+ //调用接收者的方法
+ light.on();
+ }
+
+
+
+ @Override
+ public void undo() {
+ // TODO Auto-generated method stub
+ //调用接收者的方法
+ light.off();
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/command/LightReceiver.java b/desginPattern/src/com/atguigu/command/LightReceiver.java
new file mode 100644
index 0000000..b629ddf
--- /dev/null
+++ b/desginPattern/src/com/atguigu/command/LightReceiver.java
@@ -0,0 +1,12 @@
+package com.atguigu.command;
+
+public class LightReceiver {
+
+ public void on() {
+ System.out.println(" 电灯打开了.. ");
+ }
+
+ public void off() {
+ System.out.println(" 电灯关闭了.. ");
+ }
+}
diff --git a/desginPattern/src/com/atguigu/command/NoCommand.java b/desginPattern/src/com/atguigu/command/NoCommand.java
new file mode 100644
index 0000000..b2e6e2b
--- /dev/null
+++ b/desginPattern/src/com/atguigu/command/NoCommand.java
@@ -0,0 +1,23 @@
+package com.atguigu.command;
+
+/**
+ * 没有任何命令,即空执行: 用于初始化每个按钮, 当调用空命令时,对象什么都不做
+ * 其实,这样是一种设计模式, 可以省掉对空判断
+ * @author Administrator
+ *
+ */
+public class NoCommand implements Command {
+
+ @Override
+ public void execute() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void undo() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/command/RemoteController.java b/desginPattern/src/com/atguigu/command/RemoteController.java
new file mode 100644
index 0000000..066765d
--- /dev/null
+++ b/desginPattern/src/com/atguigu/command/RemoteController.java
@@ -0,0 +1,54 @@
+package com.atguigu.command;
+
+public class RemoteController {
+
+ // 开 按钮的命令数组
+ Command[] onCommands;
+ Command[] offCommands;
+
+ // 执行撤销的命令
+ Command undoCommand;
+
+ // 构造器,完成对按钮初始化
+
+ public RemoteController() {
+
+ onCommands = new Command[5];
+ offCommands = new Command[5];
+
+ for (int i = 0; i < 5; i++) {
+ onCommands[i] = new NoCommand();
+ offCommands[i] = new NoCommand();
+ }
+ }
+
+ // 给我们的按钮设置你需要的命令
+ public void setCommand(int no, Command onCommand, Command offCommand) {
+ onCommands[no] = onCommand;
+ offCommands[no] = offCommand;
+ }
+
+ // 按下开按钮
+ public void onButtonWasPushed(int no) { // no 0
+ // 找到你按下的开的按钮, 并调用对应方法
+ onCommands[no].execute();
+ // 记录这次的操作,用于撤销
+ undoCommand = onCommands[no];
+
+ }
+
+ // 按下开按钮
+ public void offButtonWasPushed(int no) { // no 0
+ // 找到你按下的关的按钮, 并调用对应方法
+ offCommands[no].execute();
+ // 记录这次的操作,用于撤销
+ undoCommand = offCommands[no];
+
+ }
+
+ // 按下撤销按钮
+ public void undoButtonWasPushed() {
+ undoCommand.undo();
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/command/TVOffCommand.java b/desginPattern/src/com/atguigu/command/TVOffCommand.java
new file mode 100644
index 0000000..6a6e77f
--- /dev/null
+++ b/desginPattern/src/com/atguigu/command/TVOffCommand.java
@@ -0,0 +1,28 @@
+package com.atguigu.command;
+
+public class TVOffCommand implements Command {
+
+ // 聚合TVReceiver
+
+ TVReceiver tv;
+
+ // 构造器
+ public TVOffCommand(TVReceiver tv) {
+ super();
+ this.tv = tv;
+ }
+
+ @Override
+ public void execute() {
+ // TODO Auto-generated method stub
+ // 调用接收者的方法
+ tv.off();
+ }
+
+ @Override
+ public void undo() {
+ // TODO Auto-generated method stub
+ // 调用接收者的方法
+ tv.on();
+ }
+}
diff --git a/desginPattern/src/com/atguigu/command/TVOnCommand.java b/desginPattern/src/com/atguigu/command/TVOnCommand.java
new file mode 100644
index 0000000..a12440d
--- /dev/null
+++ b/desginPattern/src/com/atguigu/command/TVOnCommand.java
@@ -0,0 +1,28 @@
+package com.atguigu.command;
+
+public class TVOnCommand implements Command {
+
+ // 聚合TVReceiver
+
+ TVReceiver tv;
+
+ // 构造器
+ public TVOnCommand(TVReceiver tv) {
+ super();
+ this.tv = tv;
+ }
+
+ @Override
+ public void execute() {
+ // TODO Auto-generated method stub
+ // 调用接收者的方法
+ tv.on();
+ }
+
+ @Override
+ public void undo() {
+ // TODO Auto-generated method stub
+ // 调用接收者的方法
+ tv.off();
+ }
+}
diff --git a/desginPattern/src/com/atguigu/command/TVReceiver.java b/desginPattern/src/com/atguigu/command/TVReceiver.java
new file mode 100644
index 0000000..e73204a
--- /dev/null
+++ b/desginPattern/src/com/atguigu/command/TVReceiver.java
@@ -0,0 +1,12 @@
+package com.atguigu.command;
+
+public class TVReceiver {
+
+ public void on() {
+ System.out.println(" 电视机打开了.. ");
+ }
+
+ public void off() {
+ System.out.println(" 电视机关闭了.. ");
+ }
+}
diff --git a/desginPattern/src/com/atguigu/command/command.cld b/desginPattern/src/com/atguigu/command/command.cld
new file mode 100644
index 0000000..ed697ca
--- /dev/null
+++ b/desginPattern/src/com/atguigu/command/command.cld
@@ -0,0 +1,875 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 367
+ 98
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 49
+ 97
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 73
+ 391
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 223
+ 266
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 383
+ 391
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 441
+ 272
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ LightOffCommand
+ false
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ on
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ off
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ LightReceiver
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ execute
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ undo
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ LightOnCommand
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Client
+ false
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ onCommands
+ Command[]
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ offCommands
+ Command[]
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ RemoteController
+ false
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 616
+ 267
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ 87
+ 135
+ 622
+ 148
+
+
+
+
+
+
+
+ NoCommand 琛ㄧず绌哄懡浠
+瀵逛簬绠鍖栨搷浣滐紝鏈夊府鍔
+鍙互鐪佸幓瀵圭┖鐨勫垽鏂
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ NoCommand
+ false
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ execute
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ undo
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+
+ Command
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/command/newfile.cld b/desginPattern/src/com/atguigu/command/newfile.cld
new file mode 100644
index 0000000..621d3bc
--- /dev/null
+++ b/desginPattern/src/com/atguigu/command/newfile.cld
@@ -0,0 +1,27 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/composite/Client.java b/desginPattern/src/com/atguigu/composite/Client.java
new file mode 100644
index 0000000..f3e2fec
--- /dev/null
+++ b/desginPattern/src/com/atguigu/composite/Client.java
@@ -0,0 +1,33 @@
+package com.atguigu.composite;
+
+public class Client {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+
+ //从大到小创建对象 学校
+ OrganizationComponent university = new University("清华大学", " 中国顶级大学 ");
+
+ //创建 学院
+ OrganizationComponent computerCollege = new College("计算机学院", " 计算机学院 ");
+ OrganizationComponent infoEngineercollege = new College("信息工程学院", " 信息工程学院 ");
+
+
+ //创建各个学院下面的系(专业)
+ computerCollege.add(new Department("软件工程", " 软件工程不错 "));
+ computerCollege.add(new Department("网络工程", " 网络工程不错 "));
+ computerCollege.add(new Department("计算机科学与技术", " 计算机科学与技术是老牌的专业 "));
+
+ //
+ infoEngineercollege.add(new Department("通信工程", " 通信工程不好学 "));
+ infoEngineercollege.add(new Department("信息工程", " 信息工程好学 "));
+
+ //将学院加入到 学校
+ university.add(computerCollege);
+ university.add(infoEngineercollege);
+
+ //university.print();
+ infoEngineercollege.print();
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/composite/College.java b/desginPattern/src/com/atguigu/composite/College.java
new file mode 100644
index 0000000..6abddda
--- /dev/null
+++ b/desginPattern/src/com/atguigu/composite/College.java
@@ -0,0 +1,56 @@
+package com.atguigu.composite;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class College extends OrganizationComponent {
+
+ //List 中 存放的Department
+ List organizationComponents = new ArrayList();
+
+ // 构造器
+ public College(String name, String des) {
+ super(name, des);
+ // TODO Auto-generated constructor stub
+ }
+
+ // 重写add
+ @Override
+ protected void add(OrganizationComponent organizationComponent) {
+ // TODO Auto-generated method stub
+ // 将来实际业务中,Colleage 的 add 和 University add 不一定完全一样
+ organizationComponents.add(organizationComponent);
+ }
+
+ // 重写remove
+ @Override
+ protected void remove(OrganizationComponent organizationComponent) {
+ // TODO Auto-generated method stub
+ organizationComponents.remove(organizationComponent);
+ }
+
+ @Override
+ public String getName() {
+ // TODO Auto-generated method stub
+ return super.getName();
+ }
+
+ @Override
+ public String getDes() {
+ // TODO Auto-generated method stub
+ return super.getDes();
+ }
+
+ // print方法,就是输出University 包含的学院
+ @Override
+ protected void print() {
+ // TODO Auto-generated method stub
+ System.out.println("--------------" + getName() + "--------------");
+ //遍历 organizationComponents
+ for (OrganizationComponent organizationComponent : organizationComponents) {
+ organizationComponent.print();
+ }
+ }
+
+
+}
diff --git a/desginPattern/src/com/atguigu/composite/Department.java b/desginPattern/src/com/atguigu/composite/Department.java
new file mode 100644
index 0000000..a5fda46
--- /dev/null
+++ b/desginPattern/src/com/atguigu/composite/Department.java
@@ -0,0 +1,33 @@
+package com.atguigu.composite;
+
+public class Department extends OrganizationComponent {
+
+ //没有集合
+
+ public Department(String name, String des) {
+ super(name, des);
+ // TODO Auto-generated constructor stub
+ }
+
+
+ //add , remove 就不用写了,因为他是叶子节点
+
+ @Override
+ public String getName() {
+ // TODO Auto-generated method stub
+ return super.getName();
+ }
+
+ @Override
+ public String getDes() {
+ // TODO Auto-generated method stub
+ return super.getDes();
+ }
+
+ @Override
+ protected void print() {
+ // TODO Auto-generated method stub
+ System.out.println(getName());
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/composite/OrganizationComponent.java b/desginPattern/src/com/atguigu/composite/OrganizationComponent.java
new file mode 100644
index 0000000..8fc9217
--- /dev/null
+++ b/desginPattern/src/com/atguigu/composite/OrganizationComponent.java
@@ -0,0 +1,45 @@
+package com.atguigu.composite;
+
+public abstract class OrganizationComponent {
+
+ private String name; // 名字
+ private String des; // 说明
+
+ protected void add(OrganizationComponent organizationComponent) {
+ //默认实现
+ throw new UnsupportedOperationException();
+ }
+
+ protected void remove(OrganizationComponent organizationComponent) {
+ //默认实现
+ throw new UnsupportedOperationException();
+ }
+
+ //构造器
+ public OrganizationComponent(String name, String des) {
+ super();
+ this.name = name;
+ this.des = des;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDes() {
+ return des;
+ }
+
+ public void setDes(String des) {
+ this.des = des;
+ }
+
+ //方法print, 做成抽象的, 子类都需要实现
+ protected abstract void print();
+
+
+}
diff --git a/desginPattern/src/com/atguigu/composite/University.java b/desginPattern/src/com/atguigu/composite/University.java
new file mode 100644
index 0000000..c998769
--- /dev/null
+++ b/desginPattern/src/com/atguigu/composite/University.java
@@ -0,0 +1,54 @@
+package com.atguigu.composite;
+
+import java.util.ArrayList;
+import java.util.List;
+
+//University 就是 Composite , 可以管理College
+public class University extends OrganizationComponent {
+
+ List organizationComponents = new ArrayList();
+
+ // 构造器
+ public University(String name, String des) {
+ super(name, des);
+ // TODO Auto-generated constructor stub
+ }
+
+ // 重写add
+ @Override
+ protected void add(OrganizationComponent organizationComponent) {
+ // TODO Auto-generated method stub
+ organizationComponents.add(organizationComponent);
+ }
+
+ // 重写remove
+ @Override
+ protected void remove(OrganizationComponent organizationComponent) {
+ // TODO Auto-generated method stub
+ organizationComponents.remove(organizationComponent);
+ }
+
+ @Override
+ public String getName() {
+ // TODO Auto-generated method stub
+ return super.getName();
+ }
+
+ @Override
+ public String getDes() {
+ // TODO Auto-generated method stub
+ return super.getDes();
+ }
+
+ // print方法,就是输出University 包含的学院
+ @Override
+ protected void print() {
+ // TODO Auto-generated method stub
+ System.out.println("--------------" + getName() + "--------------");
+ //遍历 organizationComponents
+ for (OrganizationComponent organizationComponent : organizationComponents) {
+ organizationComponent.print();
+ }
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/composite/newfile.cld b/desginPattern/src/com/atguigu/composite/newfile.cld
new file mode 100644
index 0000000..dfc4be1
--- /dev/null
+++ b/desginPattern/src/com/atguigu/composite/newfile.cld
@@ -0,0 +1,1039 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 404
+ 63
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 562
+ 215
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 453
+ 216
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ College
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ University
+ false
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 142
+ 76
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Client
+ false
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 313
+ 215
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Department
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ add
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ remove
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ print
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ OrganizationComponent
+ false
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 537
+ 311
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 528
+ 415
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 625
+ 479
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 757
+ 422
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Node
+ false
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 230
+ 337
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Client
+ false
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ HashMap
+ false
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ AbstractHashMap
+ false
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ put
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ putall
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+
+ Map
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/decorator/Chocolate.java b/desginPattern/src/com/atguigu/decorator/Chocolate.java
new file mode 100644
index 0000000..8a051bc
--- /dev/null
+++ b/desginPattern/src/com/atguigu/decorator/Chocolate.java
@@ -0,0 +1,12 @@
+package com.atguigu.decorator;
+
+//具体的Decorator, 这里就是调味品
+public class Chocolate extends Decorator {
+
+ public Chocolate(Drink obj) {
+ super(obj);
+ setDes(" 巧克力 ");
+ setPrice(3.0f); // 调味品 的价格
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/decorator/Coffee.java b/desginPattern/src/com/atguigu/decorator/Coffee.java
new file mode 100644
index 0000000..ed8c6b3
--- /dev/null
+++ b/desginPattern/src/com/atguigu/decorator/Coffee.java
@@ -0,0 +1,12 @@
+package com.atguigu.decorator;
+
+public class Coffee extends Drink {
+
+ @Override
+ public float cost() {
+ // TODO Auto-generated method stub
+ return super.getPrice();
+ }
+
+
+}
diff --git a/desginPattern/src/com/atguigu/decorator/CoffeeBar.java b/desginPattern/src/com/atguigu/decorator/CoffeeBar.java
new file mode 100644
index 0000000..00d1d7c
--- /dev/null
+++ b/desginPattern/src/com/atguigu/decorator/CoffeeBar.java
@@ -0,0 +1,49 @@
+package com.atguigu.decorator;
+
+public class CoffeeBar {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ // 装饰者模式下的订单:2份巧克力+一份牛奶的LongBlack
+
+ // 1. 点一份 LongBlack
+ Drink order = new LongBlack();
+ System.out.println("费用1=" + order.cost());
+ System.out.println("描述=" + order.getDes());
+
+ // 2. order 加入一份牛奶
+ order = new Milk(order);
+
+ System.out.println("order 加入一份牛奶 费用 =" + order.cost());
+ System.out.println("order 加入一份牛奶 描述 = " + order.getDes());
+
+ // 3. order 加入一份巧克力
+
+ order = new Chocolate(order);
+
+ System.out.println("order 加入一份牛奶 加入一份巧克力 费用 =" + order.cost());
+ System.out.println("order 加入一份牛奶 加入一份巧克力 描述 = " + order.getDes());
+
+ // 3. order 加入一份巧克力
+
+ order = new Chocolate(order);
+
+ System.out.println("order 加入一份牛奶 加入2份巧克力 费用 =" + order.cost());
+ System.out.println("order 加入一份牛奶 加入2份巧克力 描述 = " + order.getDes());
+
+ System.out.println("===========================");
+
+ Drink order2 = new DeCaf();
+
+ System.out.println("order2 无因咖啡 费用 =" + order2.cost());
+ System.out.println("order2 无因咖啡 描述 = " + order2.getDes());
+
+ order2 = new Milk(order2);
+
+ System.out.println("order2 无因咖啡 加入一份牛奶 费用 =" + order2.cost());
+ System.out.println("order2 无因咖啡 加入一份牛奶 描述 = " + order2.getDes());
+
+
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/decorator/DeCaf.java b/desginPattern/src/com/atguigu/decorator/DeCaf.java
new file mode 100644
index 0000000..0a5e94f
--- /dev/null
+++ b/desginPattern/src/com/atguigu/decorator/DeCaf.java
@@ -0,0 +1,9 @@
+package com.atguigu.decorator;
+
+public class DeCaf extends Coffee {
+
+ public DeCaf() {
+ setDes(" 无因咖啡 ");
+ setPrice(1.0f);
+ }
+}
diff --git a/desginPattern/src/com/atguigu/decorator/Decorator.java b/desginPattern/src/com/atguigu/decorator/Decorator.java
new file mode 100644
index 0000000..20be2e6
--- /dev/null
+++ b/desginPattern/src/com/atguigu/decorator/Decorator.java
@@ -0,0 +1,27 @@
+package com.atguigu.decorator;
+
+public class Decorator extends Drink {
+ private Drink obj;
+
+ public Decorator(Drink obj) { //组合
+ // TODO Auto-generated constructor stub
+ this.obj = obj;
+ }
+
+ @Override
+ public float cost() {
+ // TODO Auto-generated method stub
+ // getPrice 自己价格
+ return super.getPrice() + obj.cost();
+ }
+
+ @Override
+ public String getDes() {
+ // TODO Auto-generated method stub
+ // obj.getDes() 输出被装饰者的信息
+ return des + " " + getPrice() + " && " + obj.getDes();
+ }
+
+
+
+}
diff --git a/desginPattern/src/com/atguigu/decorator/Drink.java b/desginPattern/src/com/atguigu/decorator/Drink.java
new file mode 100644
index 0000000..e2c520e
--- /dev/null
+++ b/desginPattern/src/com/atguigu/decorator/Drink.java
@@ -0,0 +1,24 @@
+package com.atguigu.decorator;
+
+public abstract class Drink {
+
+ public String des; // 描述
+ private float price = 0.0f;
+ public String getDes() {
+ return des;
+ }
+ public void setDes(String des) {
+ this.des = des;
+ }
+ public float getPrice() {
+ return price;
+ }
+ public void setPrice(float price) {
+ this.price = price;
+ }
+
+ //计算费用的抽象方法
+ //子类来实现
+ public abstract float cost();
+
+}
diff --git a/desginPattern/src/com/atguigu/decorator/Espresso.java b/desginPattern/src/com/atguigu/decorator/Espresso.java
new file mode 100644
index 0000000..b3c490d
--- /dev/null
+++ b/desginPattern/src/com/atguigu/decorator/Espresso.java
@@ -0,0 +1,9 @@
+package com.atguigu.decorator;
+
+public class Espresso extends Coffee {
+
+ public Espresso() {
+ setDes(" 意大利咖啡 ");
+ setPrice(6.0f);
+ }
+}
diff --git a/desginPattern/src/com/atguigu/decorator/LongBlack.java b/desginPattern/src/com/atguigu/decorator/LongBlack.java
new file mode 100644
index 0000000..19526dc
--- /dev/null
+++ b/desginPattern/src/com/atguigu/decorator/LongBlack.java
@@ -0,0 +1,9 @@
+package com.atguigu.decorator;
+
+public class LongBlack extends Coffee {
+
+ public LongBlack() {
+ setDes(" longblack ");
+ setPrice(5.0f);
+ }
+}
diff --git a/desginPattern/src/com/atguigu/decorator/Milk.java b/desginPattern/src/com/atguigu/decorator/Milk.java
new file mode 100644
index 0000000..f70d639
--- /dev/null
+++ b/desginPattern/src/com/atguigu/decorator/Milk.java
@@ -0,0 +1,12 @@
+package com.atguigu.decorator;
+
+public class Milk extends Decorator {
+
+ public Milk(Drink obj) {
+ super(obj);
+ // TODO Auto-generated constructor stub
+ setDes(" 牛奶 ");
+ setPrice(2.0f);
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/decorator/ShortBlack.java b/desginPattern/src/com/atguigu/decorator/ShortBlack.java
new file mode 100644
index 0000000..e941990
--- /dev/null
+++ b/desginPattern/src/com/atguigu/decorator/ShortBlack.java
@@ -0,0 +1,9 @@
+package com.atguigu.decorator;
+
+public class ShortBlack extends Coffee{
+
+ public ShortBlack() {
+ setDes(" shortblack ");
+ setPrice(4.0f);
+ }
+}
diff --git a/desginPattern/src/com/atguigu/decorator/Soy.java b/desginPattern/src/com/atguigu/decorator/Soy.java
new file mode 100644
index 0000000..9b28b12
--- /dev/null
+++ b/desginPattern/src/com/atguigu/decorator/Soy.java
@@ -0,0 +1,12 @@
+package com.atguigu.decorator;
+
+public class Soy extends Decorator{
+
+ public Soy(Drink obj) {
+ super(obj);
+ // TODO Auto-generated constructor stub
+ setDes(" 豆浆 ");
+ setPrice(1.5f);
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/facade/Client.java b/desginPattern/src/com/atguigu/facade/Client.java
new file mode 100644
index 0000000..f46fe7a
--- /dev/null
+++ b/desginPattern/src/com/atguigu/facade/Client.java
@@ -0,0 +1,16 @@
+package com.atguigu.facade;
+
+public class Client {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ //这里直接调用。。 很麻烦
+ HomeTheaterFacade homeTheaterFacade = new HomeTheaterFacade();
+ homeTheaterFacade.ready();
+ homeTheaterFacade.play();
+
+
+ homeTheaterFacade.end();
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/facade/DVDPlayer.java b/desginPattern/src/com/atguigu/facade/DVDPlayer.java
new file mode 100644
index 0000000..a8cfb06
--- /dev/null
+++ b/desginPattern/src/com/atguigu/facade/DVDPlayer.java
@@ -0,0 +1,27 @@
+package com.atguigu.facade;
+
+public class DVDPlayer {
+
+ //使用单例模式, 使用饿汉式
+ private static DVDPlayer instance = new DVDPlayer();
+
+ public static DVDPlayer getInstanc() {
+ return instance;
+ }
+
+ public void on() {
+ System.out.println(" dvd on ");
+ }
+ public void off() {
+ System.out.println(" dvd off ");
+ }
+
+ public void play() {
+ System.out.println(" dvd is playing ");
+ }
+
+ //....
+ public void pause() {
+ System.out.println(" dvd pause ..");
+ }
+}
diff --git a/desginPattern/src/com/atguigu/facade/HomeTheaterFacade.java b/desginPattern/src/com/atguigu/facade/HomeTheaterFacade.java
new file mode 100644
index 0000000..24f6926
--- /dev/null
+++ b/desginPattern/src/com/atguigu/facade/HomeTheaterFacade.java
@@ -0,0 +1,58 @@
+package com.atguigu.facade;
+
+public class HomeTheaterFacade {
+
+ //定义各个子系统对象
+ private TheaterLight theaterLight;
+ private Popcorn popcorn;
+ private Stereo stereo;
+ private Projector projector;
+ private Screen screen;
+ private DVDPlayer dVDPlayer;
+
+
+ //构造器
+ public HomeTheaterFacade() {
+ super();
+ this.theaterLight = TheaterLight.getInstance();
+ this.popcorn = Popcorn.getInstance();
+ this.stereo = Stereo.getInstance();
+ this.projector = Projector.getInstance();
+ this.screen = Screen.getInstance();
+ this.dVDPlayer = DVDPlayer.getInstanc();
+ }
+
+ //操作分成 4 步
+
+ public void ready() {
+ popcorn.on();
+ popcorn.pop();
+ screen.down();
+ projector.on();
+ stereo.on();
+ dVDPlayer.on();
+ theaterLight.dim();
+ }
+
+ public void play() {
+ dVDPlayer.play();
+ }
+
+ public void pause() {
+ dVDPlayer.pause();
+ }
+
+ public void end() {
+ popcorn.off();
+ theaterLight.bright();
+ screen.up();
+ projector.off();
+ stereo.off();
+ dVDPlayer.off();
+ }
+
+
+
+
+
+}
diff --git a/desginPattern/src/com/atguigu/facade/Popcorn.java b/desginPattern/src/com/atguigu/facade/Popcorn.java
new file mode 100644
index 0000000..a43c7da
--- /dev/null
+++ b/desginPattern/src/com/atguigu/facade/Popcorn.java
@@ -0,0 +1,22 @@
+package com.atguigu.facade;
+
+public class Popcorn {
+
+ private static Popcorn instance = new Popcorn();
+
+ public static Popcorn getInstance() {
+ return instance;
+ }
+
+ public void on() {
+ System.out.println(" popcorn on ");
+ }
+
+ public void off() {
+ System.out.println(" popcorn ff ");
+ }
+
+ public void pop() {
+ System.out.println(" popcorn is poping ");
+ }
+}
diff --git a/desginPattern/src/com/atguigu/facade/Projector.java b/desginPattern/src/com/atguigu/facade/Projector.java
new file mode 100644
index 0000000..3f9970f
--- /dev/null
+++ b/desginPattern/src/com/atguigu/facade/Projector.java
@@ -0,0 +1,24 @@
+package com.atguigu.facade;
+
+public class Projector {
+
+ private static Projector instance = new Projector();
+
+ public static Projector getInstance() {
+ return instance;
+ }
+
+ public void on() {
+ System.out.println(" Projector on ");
+ }
+
+ public void off() {
+ System.out.println(" Projector ff ");
+ }
+
+ public void focus() {
+ System.out.println(" Projector is Projector ");
+ }
+
+ //...
+}
diff --git a/desginPattern/src/com/atguigu/facade/Screen.java b/desginPattern/src/com/atguigu/facade/Screen.java
new file mode 100644
index 0000000..d5db6ae
--- /dev/null
+++ b/desginPattern/src/com/atguigu/facade/Screen.java
@@ -0,0 +1,23 @@
+package com.atguigu.facade;
+
+public class Screen {
+
+ private static Screen instance = new Screen();
+
+ public static Screen getInstance() {
+ return instance;
+ }
+
+
+
+
+ public void up() {
+ System.out.println(" Screen up ");
+ }
+
+ public void down() {
+ System.out.println(" Screen down ");
+ }
+
+
+}
diff --git a/desginPattern/src/com/atguigu/facade/Stereo.java b/desginPattern/src/com/atguigu/facade/Stereo.java
new file mode 100644
index 0000000..2aaf9d2
--- /dev/null
+++ b/desginPattern/src/com/atguigu/facade/Stereo.java
@@ -0,0 +1,24 @@
+package com.atguigu.facade;
+
+public class Stereo {
+
+ private static Stereo instance = new Stereo();
+
+ public static Stereo getInstance() {
+ return instance;
+ }
+
+ public void on() {
+ System.out.println(" Stereo on ");
+ }
+
+ public void off() {
+ System.out.println(" Screen off ");
+ }
+
+ public void up() {
+ System.out.println(" Screen up.. ");
+ }
+
+ //...
+}
diff --git a/desginPattern/src/com/atguigu/facade/TheaterLight.java b/desginPattern/src/com/atguigu/facade/TheaterLight.java
new file mode 100644
index 0000000..d3cbf28
--- /dev/null
+++ b/desginPattern/src/com/atguigu/facade/TheaterLight.java
@@ -0,0 +1,26 @@
+package com.atguigu.facade;
+
+public class TheaterLight {
+
+ private static TheaterLight instance = new TheaterLight();
+
+ public static TheaterLight getInstance() {
+ return instance;
+ }
+
+ public void on() {
+ System.out.println(" TheaterLight on ");
+ }
+
+ public void off() {
+ System.out.println(" TheaterLight off ");
+ }
+
+ public void dim() {
+ System.out.println(" TheaterLight dim.. ");
+ }
+
+ public void bright() {
+ System.out.println(" TheaterLight bright.. ");
+ }
+}
diff --git a/desginPattern/src/com/atguigu/facade/newfile.cld b/desginPattern/src/com/atguigu/facade/newfile.cld
new file mode 100644
index 0000000..1175e06
--- /dev/null
+++ b/desginPattern/src/com/atguigu/facade/newfile.cld
@@ -0,0 +1,432 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 245
+ 158
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 105
+ 251
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ 瀛愮郴缁1
+ false
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 241
+ 252
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ 瀛愮郴缁2
+ false
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 382
+ 253
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ 瀛愮郴缁3
+ false
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 408
+ 154
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Client
+ false
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ 澶栬绫
+ false
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/factory/absfactory/pizzastore/newfile.cld b/desginPattern/src/com/atguigu/factory/absfactory/pizzastore/newfile.cld
new file mode 100644
index 0000000..e02816c
--- /dev/null
+++ b/desginPattern/src/com/atguigu/factory/absfactory/pizzastore/newfile.cld
@@ -0,0 +1,1102 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 391
+ 270
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 538
+ 272
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ LDPepperPizza
+ false
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 110
+ 272
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 227
+ 372
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 350
+ 453
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 78
+ 463
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ OrderPizza
+ false
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 567
+ 466
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ OrderPizza2
+ false
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ createPizza
+ Pizza
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+
+ AbsFactory
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 245
+ 270
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ BJPepperPizza
+ false
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ BJFactory
+ false
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ BJCheessPizza
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 461
+ 378
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ LDFactory
+ false
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ LDCheessPizza
+ false
+
+
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 343
+ 61
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ prepare
+ void
+
+ false
+ false
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ bake
+ void
+
+ false
+ false
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ cut
+ void
+
+ false
+ false
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ box
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Pizza
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/factory/absfactory/pizzastore/order/AbsFactory.java b/desginPattern/src/com/atguigu/factory/absfactory/pizzastore/order/AbsFactory.java
new file mode 100644
index 0000000..0bb2105
--- /dev/null
+++ b/desginPattern/src/com/atguigu/factory/absfactory/pizzastore/order/AbsFactory.java
@@ -0,0 +1,9 @@
+package com.atguigu.factory.absfactory.pizzastore.order;
+
+import com.atguigu.factory.absfactory.pizzastore.pizza.Pizza;
+
+//一个抽象工厂模式的抽象层(接口)
+public interface AbsFactory {
+ //让下面的工厂子类来 具体实现
+ public Pizza createPizza(String orderType);
+}
diff --git a/desginPattern/src/com/atguigu/factory/absfactory/pizzastore/order/BJFactory.java b/desginPattern/src/com/atguigu/factory/absfactory/pizzastore/order/BJFactory.java
new file mode 100644
index 0000000..3a1bbce
--- /dev/null
+++ b/desginPattern/src/com/atguigu/factory/absfactory/pizzastore/order/BJFactory.java
@@ -0,0 +1,23 @@
+package com.atguigu.factory.absfactory.pizzastore.order;
+
+import com.atguigu.factory.absfactory.pizzastore.pizza.BJCheesePizza;
+import com.atguigu.factory.absfactory.pizzastore.pizza.BJPepperPizza;
+import com.atguigu.factory.absfactory.pizzastore.pizza.Pizza;
+
+//这是工厂子类
+public class BJFactory implements AbsFactory {
+
+ @Override
+ public Pizza createPizza(String orderType) {
+ System.out.println("~使用的是抽象工厂模式~");
+ // TODO Auto-generated method stub
+ Pizza pizza = null;
+ if(orderType.equals("cheese")) {
+ pizza = new BJCheesePizza();
+ } else if (orderType.equals("pepper")){
+ pizza = new BJPepperPizza();
+ }
+ return pizza;
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/factory/absfactory/pizzastore/order/LDFactory.java b/desginPattern/src/com/atguigu/factory/absfactory/pizzastore/order/LDFactory.java
new file mode 100644
index 0000000..c3f676a
--- /dev/null
+++ b/desginPattern/src/com/atguigu/factory/absfactory/pizzastore/order/LDFactory.java
@@ -0,0 +1,23 @@
+package com.atguigu.factory.absfactory.pizzastore.order;
+
+
+import com.atguigu.factory.absfactory.pizzastore.pizza.LDCheesePizza;
+import com.atguigu.factory.absfactory.pizzastore.pizza.LDPepperPizza;
+import com.atguigu.factory.absfactory.pizzastore.pizza.Pizza;
+
+
+public class LDFactory implements AbsFactory {
+
+ @Override
+ public Pizza createPizza(String orderType) {
+ System.out.println("~使用的是抽象工厂模式~");
+ Pizza pizza = null;
+ if (orderType.equals("cheese")) {
+ pizza = new LDCheesePizza();
+ } else if (orderType.equals("pepper")) {
+ pizza = new LDPepperPizza();
+ }
+ return pizza;
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/factory/absfactory/pizzastore/order/OrderPizza.java b/desginPattern/src/com/atguigu/factory/absfactory/pizzastore/order/OrderPizza.java
new file mode 100644
index 0000000..bc4614b
--- /dev/null
+++ b/desginPattern/src/com/atguigu/factory/absfactory/pizzastore/order/OrderPizza.java
@@ -0,0 +1,50 @@
+package com.atguigu.factory.absfactory.pizzastore.order;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import com.atguigu.factory.absfactory.pizzastore.pizza.Pizza;
+
+public class OrderPizza {
+
+ AbsFactory factory;
+
+ // 构造器
+ public OrderPizza(AbsFactory factory) {
+ setFactory(factory);
+ }
+
+ private void setFactory(AbsFactory factory) {
+ Pizza pizza = null;
+ String orderType = ""; // 用户输入
+ this.factory = factory;
+ do {
+ orderType = getType();
+ // factory 可能是北京的工厂子类,也可能是伦敦的工厂子类
+ pizza = factory.createPizza(orderType);
+ if (pizza != null) { // 订购ok
+ pizza.prepare();
+ pizza.bake();
+ pizza.cut();
+ pizza.box();
+ } else {
+ System.out.println("订购失败");
+ break;
+ }
+ } while (true);
+ }
+
+ // 写一个方法,可以获取客户希望订购的披萨种类
+ private String getType() {
+ try {
+ BufferedReader strin = new BufferedReader(new InputStreamReader(System.in));
+ System.out.println("input pizza 种类:");
+ String str = strin.readLine();
+ return str;
+ } catch (IOException e) {
+ e.printStackTrace();
+ return "";
+ }
+ }
+}
diff --git a/desginPattern/src/com/atguigu/factory/absfactory/pizzastore/order/PizzaStore.java b/desginPattern/src/com/atguigu/factory/absfactory/pizzastore/order/PizzaStore.java
new file mode 100644
index 0000000..139bd53
--- /dev/null
+++ b/desginPattern/src/com/atguigu/factory/absfactory/pizzastore/order/PizzaStore.java
@@ -0,0 +1,11 @@
+package com.atguigu.factory.absfactory.pizzastore.order;
+
+public class PizzaStore {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ //new OrderPizza(new BJFactory());
+ new OrderPizza(new LDFactory());
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/factory/absfactory/pizzastore/pizza/BJCheesePizza.java b/desginPattern/src/com/atguigu/factory/absfactory/pizzastore/pizza/BJCheesePizza.java
new file mode 100644
index 0000000..5595ee0
--- /dev/null
+++ b/desginPattern/src/com/atguigu/factory/absfactory/pizzastore/pizza/BJCheesePizza.java
@@ -0,0 +1,12 @@
+package com.atguigu.factory.absfactory.pizzastore.pizza;
+
+public class BJCheesePizza extends Pizza {
+
+ @Override
+ public void prepare() {
+ // TODO Auto-generated method stub
+ setName("北京的奶酪pizza");
+ System.out.println(" 北京的奶酪pizza 准备原材料");
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/factory/absfactory/pizzastore/pizza/BJPepperPizza.java b/desginPattern/src/com/atguigu/factory/absfactory/pizzastore/pizza/BJPepperPizza.java
new file mode 100644
index 0000000..90c084d
--- /dev/null
+++ b/desginPattern/src/com/atguigu/factory/absfactory/pizzastore/pizza/BJPepperPizza.java
@@ -0,0 +1,10 @@
+package com.atguigu.factory.absfactory.pizzastore.pizza;
+
+public class BJPepperPizza extends Pizza {
+ @Override
+ public void prepare() {
+ // TODO Auto-generated method stub
+ setName("北京的胡椒pizza");
+ System.out.println(" 北京的胡椒pizza 准备原材料");
+ }
+}
diff --git a/desginPattern/src/com/atguigu/factory/absfactory/pizzastore/pizza/LDCheesePizza.java b/desginPattern/src/com/atguigu/factory/absfactory/pizzastore/pizza/LDCheesePizza.java
new file mode 100644
index 0000000..5d9d882
--- /dev/null
+++ b/desginPattern/src/com/atguigu/factory/absfactory/pizzastore/pizza/LDCheesePizza.java
@@ -0,0 +1,11 @@
+package com.atguigu.factory.absfactory.pizzastore.pizza;
+
+public class LDCheesePizza extends Pizza{
+
+ @Override
+ public void prepare() {
+ // TODO Auto-generated method stub
+ setName("伦敦的奶酪pizza");
+ System.out.println(" 伦敦的奶酪pizza 准备原材料");
+ }
+}
diff --git a/desginPattern/src/com/atguigu/factory/absfactory/pizzastore/pizza/LDPepperPizza.java b/desginPattern/src/com/atguigu/factory/absfactory/pizzastore/pizza/LDPepperPizza.java
new file mode 100644
index 0000000..2e5d42c
--- /dev/null
+++ b/desginPattern/src/com/atguigu/factory/absfactory/pizzastore/pizza/LDPepperPizza.java
@@ -0,0 +1,10 @@
+package com.atguigu.factory.absfactory.pizzastore.pizza;
+
+public class LDPepperPizza extends Pizza{
+ @Override
+ public void prepare() {
+ // TODO Auto-generated method stub
+ setName("伦敦的胡椒pizza");
+ System.out.println(" 伦敦的胡椒pizza 准备原材料");
+ }
+}
diff --git a/desginPattern/src/com/atguigu/factory/absfactory/pizzastore/pizza/Pizza.java b/desginPattern/src/com/atguigu/factory/absfactory/pizzastore/pizza/Pizza.java
new file mode 100644
index 0000000..e5bfdb3
--- /dev/null
+++ b/desginPattern/src/com/atguigu/factory/absfactory/pizzastore/pizza/Pizza.java
@@ -0,0 +1,27 @@
+package com.atguigu.factory.absfactory.pizzastore.pizza;
+
+//将Pizza 类做成抽象
+public abstract class Pizza {
+ protected String name; //名字
+
+ //准备原材料, 不同的披萨不一样,因此,我们做成抽象方法
+ public abstract void prepare();
+
+
+ public void bake() {
+ System.out.println(name + " baking;");
+ }
+
+ public void cut() {
+ System.out.println(name + " cutting;");
+ }
+
+ //打包
+ public void box() {
+ System.out.println(name + " boxing;");
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
diff --git a/desginPattern/src/com/atguigu/factory/factorymethod/pizzastore/newfile.cld b/desginPattern/src/com/atguigu/factory/factorymethod/pizzastore/newfile.cld
new file mode 100644
index 0000000..9599661
--- /dev/null
+++ b/desginPattern/src/com/atguigu/factory/factorymethod/pizzastore/newfile.cld
@@ -0,0 +1,902 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 240
+ 265
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 338
+ 56
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 386
+ 265
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 449
+ 380
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 330
+ 452
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 208
+ 381
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ BJOrderPizza
+ false
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ createPizza
+ Pizza
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ OrderPizza
+ false
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 533
+ 267
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ LDPepperPizza
+ false
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ LDOrderPizza
+ false
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ LDCheessPizza
+ false
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ prepare
+ void
+
+ false
+ false
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ bake
+ void
+
+ false
+ false
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ cut
+ void
+
+ false
+ false
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ box
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Pizza
+ false
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ BJPepperPizza
+ false
+
+
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 105
+ 267
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ BJCheessPizza
+ false
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/factory/factorymethod/pizzastore/order/BJOrderPizza.java b/desginPattern/src/com/atguigu/factory/factorymethod/pizzastore/order/BJOrderPizza.java
new file mode 100644
index 0000000..e99e09a
--- /dev/null
+++ b/desginPattern/src/com/atguigu/factory/factorymethod/pizzastore/order/BJOrderPizza.java
@@ -0,0 +1,24 @@
+package com.atguigu.factory.factorymethod.pizzastore.order;
+
+import com.atguigu.factory.factorymethod.pizzastore.pizza.BJCheesePizza;
+import com.atguigu.factory.factorymethod.pizzastore.pizza.BJPepperPizza;
+import com.atguigu.factory.factorymethod.pizzastore.pizza.Pizza;
+
+
+public class BJOrderPizza extends OrderPizza {
+
+
+ @Override
+ Pizza createPizza(String orderType) {
+
+ Pizza pizza = null;
+ if(orderType.equals("cheese")) {
+ pizza = new BJCheesePizza();
+ } else if (orderType.equals("pepper")) {
+ pizza = new BJPepperPizza();
+ }
+ // TODO Auto-generated method stub
+ return pizza;
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/factory/factorymethod/pizzastore/order/LDOrderPizza.java b/desginPattern/src/com/atguigu/factory/factorymethod/pizzastore/order/LDOrderPizza.java
new file mode 100644
index 0000000..0b54b84
--- /dev/null
+++ b/desginPattern/src/com/atguigu/factory/factorymethod/pizzastore/order/LDOrderPizza.java
@@ -0,0 +1,26 @@
+package com.atguigu.factory.factorymethod.pizzastore.order;
+
+import com.atguigu.factory.factorymethod.pizzastore.pizza.BJCheesePizza;
+import com.atguigu.factory.factorymethod.pizzastore.pizza.BJPepperPizza;
+import com.atguigu.factory.factorymethod.pizzastore.pizza.LDCheesePizza;
+import com.atguigu.factory.factorymethod.pizzastore.pizza.LDPepperPizza;
+import com.atguigu.factory.factorymethod.pizzastore.pizza.Pizza;
+
+
+public class LDOrderPizza extends OrderPizza {
+
+
+ @Override
+ Pizza createPizza(String orderType) {
+
+ Pizza pizza = null;
+ if(orderType.equals("cheese")) {
+ pizza = new LDCheesePizza();
+ } else if (orderType.equals("pepper")) {
+ pizza = new LDPepperPizza();
+ }
+ // TODO Auto-generated method stub
+ return pizza;
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/factory/factorymethod/pizzastore/order/OrderPizza.java b/desginPattern/src/com/atguigu/factory/factorymethod/pizzastore/order/OrderPizza.java
new file mode 100644
index 0000000..336fd5c
--- /dev/null
+++ b/desginPattern/src/com/atguigu/factory/factorymethod/pizzastore/order/OrderPizza.java
@@ -0,0 +1,48 @@
+package com.atguigu.factory.factorymethod.pizzastore.order;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import com.atguigu.factory.factorymethod.pizzastore.pizza.Pizza;
+
+
+
+
+public abstract class OrderPizza {
+
+ //定义一个抽象方法,createPizza , 让各个工厂子类自己实现
+ abstract Pizza createPizza(String orderType);
+
+ // 构造器
+ public OrderPizza() {
+ Pizza pizza = null;
+ String orderType; // 订购披萨的类型
+ do {
+ orderType = getType();
+ pizza = createPizza(orderType); //抽象方法,由工厂子类完成
+ //输出pizza 制作过程
+ pizza.prepare();
+ pizza.bake();
+ pizza.cut();
+ pizza.box();
+
+ } while (true);
+ }
+
+
+
+ // 写一个方法,可以获取客户希望订购的披萨种类
+ private String getType() {
+ try {
+ BufferedReader strin = new BufferedReader(new InputStreamReader(System.in));
+ System.out.println("input pizza 种类:");
+ String str = strin.readLine();
+ return str;
+ } catch (IOException e) {
+ e.printStackTrace();
+ return "";
+ }
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/factory/factorymethod/pizzastore/order/PizzaStore.java b/desginPattern/src/com/atguigu/factory/factorymethod/pizzastore/order/PizzaStore.java
new file mode 100644
index 0000000..c247a66
--- /dev/null
+++ b/desginPattern/src/com/atguigu/factory/factorymethod/pizzastore/order/PizzaStore.java
@@ -0,0 +1,17 @@
+package com.atguigu.factory.factorymethod.pizzastore.order;
+
+public class PizzaStore {
+
+ public static void main(String[] args) {
+ String loc = "bj";
+ if (loc.equals("bj")) {
+ //创建北京口味的各种Pizza
+ new BJOrderPizza();
+ } else {
+ //创建伦敦口味的各种Pizza
+ new LDOrderPizza();
+ }
+ // TODO Auto-generated method stub
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/factory/factorymethod/pizzastore/pizza/BJCheesePizza.java b/desginPattern/src/com/atguigu/factory/factorymethod/pizzastore/pizza/BJCheesePizza.java
new file mode 100644
index 0000000..da83ffb
--- /dev/null
+++ b/desginPattern/src/com/atguigu/factory/factorymethod/pizzastore/pizza/BJCheesePizza.java
@@ -0,0 +1,12 @@
+package com.atguigu.factory.factorymethod.pizzastore.pizza;
+
+public class BJCheesePizza extends Pizza {
+
+ @Override
+ public void prepare() {
+ // TODO Auto-generated method stub
+ setName("北京的奶酪pizza");
+ System.out.println(" 北京的奶酪pizza 准备原材料");
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/factory/factorymethod/pizzastore/pizza/BJPepperPizza.java b/desginPattern/src/com/atguigu/factory/factorymethod/pizzastore/pizza/BJPepperPizza.java
new file mode 100644
index 0000000..8d60535
--- /dev/null
+++ b/desginPattern/src/com/atguigu/factory/factorymethod/pizzastore/pizza/BJPepperPizza.java
@@ -0,0 +1,10 @@
+package com.atguigu.factory.factorymethod.pizzastore.pizza;
+
+public class BJPepperPizza extends Pizza {
+ @Override
+ public void prepare() {
+ // TODO Auto-generated method stub
+ setName("北京的胡椒pizza");
+ System.out.println(" 北京的胡椒pizza 准备原材料");
+ }
+}
diff --git a/desginPattern/src/com/atguigu/factory/factorymethod/pizzastore/pizza/LDCheesePizza.java b/desginPattern/src/com/atguigu/factory/factorymethod/pizzastore/pizza/LDCheesePizza.java
new file mode 100644
index 0000000..9929972
--- /dev/null
+++ b/desginPattern/src/com/atguigu/factory/factorymethod/pizzastore/pizza/LDCheesePizza.java
@@ -0,0 +1,11 @@
+package com.atguigu.factory.factorymethod.pizzastore.pizza;
+
+public class LDCheesePizza extends Pizza{
+
+ @Override
+ public void prepare() {
+ // TODO Auto-generated method stub
+ setName("伦敦的奶酪pizza");
+ System.out.println(" 伦敦的奶酪pizza 准备原材料");
+ }
+}
diff --git a/desginPattern/src/com/atguigu/factory/factorymethod/pizzastore/pizza/LDPepperPizza.java b/desginPattern/src/com/atguigu/factory/factorymethod/pizzastore/pizza/LDPepperPizza.java
new file mode 100644
index 0000000..bb6a5aa
--- /dev/null
+++ b/desginPattern/src/com/atguigu/factory/factorymethod/pizzastore/pizza/LDPepperPizza.java
@@ -0,0 +1,10 @@
+package com.atguigu.factory.factorymethod.pizzastore.pizza;
+
+public class LDPepperPizza extends Pizza{
+ @Override
+ public void prepare() {
+ // TODO Auto-generated method stub
+ setName("伦敦的胡椒pizza");
+ System.out.println(" 伦敦的胡椒pizza 准备原材料");
+ }
+}
diff --git a/desginPattern/src/com/atguigu/factory/factorymethod/pizzastore/pizza/Pizza.java b/desginPattern/src/com/atguigu/factory/factorymethod/pizzastore/pizza/Pizza.java
new file mode 100644
index 0000000..a4214eb
--- /dev/null
+++ b/desginPattern/src/com/atguigu/factory/factorymethod/pizzastore/pizza/Pizza.java
@@ -0,0 +1,27 @@
+package com.atguigu.factory.factorymethod.pizzastore.pizza;
+
+//将Pizza 类做成抽象
+public abstract class Pizza {
+ protected String name; //名字
+
+ //准备原材料, 不同的披萨不一样,因此,我们做成抽象方法
+ public abstract void prepare();
+
+
+ public void bake() {
+ System.out.println(name + " baking;");
+ }
+
+ public void cut() {
+ System.out.println(name + " cutting;");
+ }
+
+ //打包
+ public void box() {
+ System.out.println(name + " boxing;");
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
diff --git a/desginPattern/src/com/atguigu/factory/simplefactory/pizzastore/newfile.cld b/desginPattern/src/com/atguigu/factory/simplefactory/pizzastore/newfile.cld
new file mode 100644
index 0000000..b885a10
--- /dev/null
+++ b/desginPattern/src/com/atguigu/factory/simplefactory/pizzastore/newfile.cld
@@ -0,0 +1,886 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 138
+ 280
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ CheessPizza
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 352
+ 278
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ GreekPizza
+ false
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 241
+ 80
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 519
+ 281
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ ChinaPizza
+ false
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ prepare
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ bake
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ cut
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ box
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Pizza
+ false
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 58
+ 378
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 393
+ 449
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ OrderPizza3
+ false
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 468
+ 361
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ OrderPizza2
+ false
+
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 253
+ 370
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ SimpleFactory
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ OrderPizza
+ false
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/factory/simplefactory/pizzastore/order/OrderPizza.java b/desginPattern/src/com/atguigu/factory/simplefactory/pizzastore/order/OrderPizza.java
new file mode 100644
index 0000000..49130bd
--- /dev/null
+++ b/desginPattern/src/com/atguigu/factory/simplefactory/pizzastore/order/OrderPizza.java
@@ -0,0 +1,83 @@
+package com.atguigu.factory.simplefactory.pizzastore.order;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+
+import com.atguigu.factory.simplefactory.pizzastore.pizza.Pizza;
+
+public class OrderPizza {
+
+ // 构造器
+// public OrderPizza() {
+// Pizza pizza = null;
+// String orderType; // 订购披萨的类型
+// do {
+// orderType = getType();
+// if (orderType.equals("greek")) {
+// pizza = new GreekPizza();
+// pizza.setName(" 希腊披萨 ");
+// } else if (orderType.equals("cheese")) {
+// pizza = new CheesePizza();
+// pizza.setName(" 奶酪披萨 ");
+// } else if (orderType.equals("pepper")) {
+// pizza = new PepperPizza();
+// pizza.setName("胡椒披萨");
+// } else {
+// break;
+// }
+// //输出pizza 制作过程
+// pizza.prepare();
+// pizza.bake();
+// pizza.cut();
+// pizza.box();
+//
+// } while (true);
+// }
+
+ //定义一个简单工厂对象
+ SimpleFactory simpleFactory;
+ Pizza pizza = null;
+
+ //构造器
+ public OrderPizza(SimpleFactory simpleFactory) {
+ setFactory(simpleFactory);
+ }
+
+ public void setFactory(SimpleFactory simpleFactory) {
+ String orderType = ""; //用户输入的
+
+ this.simpleFactory = simpleFactory; //设置简单工厂对象
+
+ do {
+ orderType = getType();
+ pizza = this.simpleFactory.createPizza(orderType);
+
+ //输出pizza
+ if(pizza != null) { //订购成功
+ pizza.prepare();
+ pizza.bake();
+ pizza.cut();
+ pizza.box();
+ } else {
+ System.out.println(" 订购披萨失败 ");
+ break;
+ }
+ }while(true);
+ }
+
+ // 写一个方法,可以获取客户希望订购的披萨种类
+ private String getType() {
+ try {
+ BufferedReader strin = new BufferedReader(new InputStreamReader(System.in));
+ System.out.println("input pizza 种类:");
+ String str = strin.readLine();
+ return str;
+ } catch (IOException e) {
+ e.printStackTrace();
+ return "";
+ }
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/factory/simplefactory/pizzastore/order/OrderPizza2.java b/desginPattern/src/com/atguigu/factory/simplefactory/pizzastore/order/OrderPizza2.java
new file mode 100644
index 0000000..f43e484
--- /dev/null
+++ b/desginPattern/src/com/atguigu/factory/simplefactory/pizzastore/order/OrderPizza2.java
@@ -0,0 +1,45 @@
+package com.atguigu.factory.simplefactory.pizzastore.order;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import com.atguigu.factory.simplefactory.pizzastore.pizza.Pizza;
+
+public class OrderPizza2 {
+
+ Pizza pizza = null;
+ String orderType = "";
+ // 构造器
+ public OrderPizza2() {
+
+ do {
+ orderType = getType();
+ pizza = SimpleFactory.createPizza2(orderType);
+
+ // 输出pizza
+ if (pizza != null) { // 订购成功
+ pizza.prepare();
+ pizza.bake();
+ pizza.cut();
+ pizza.box();
+ } else {
+ System.out.println(" 订购披萨失败 ");
+ break;
+ }
+ } while (true);
+ }
+
+ // 写一个方法,可以获取客户希望订购的披萨种类
+ private String getType() {
+ try {
+ BufferedReader strin = new BufferedReader(new InputStreamReader(System.in));
+ System.out.println("input pizza 种类:");
+ String str = strin.readLine();
+ return str;
+ } catch (IOException e) {
+ e.printStackTrace();
+ return "";
+ }
+ }
+}
diff --git a/desginPattern/src/com/atguigu/factory/simplefactory/pizzastore/order/PizzaStore.java b/desginPattern/src/com/atguigu/factory/simplefactory/pizzastore/order/PizzaStore.java
new file mode 100644
index 0000000..c491ba8
--- /dev/null
+++ b/desginPattern/src/com/atguigu/factory/simplefactory/pizzastore/order/PizzaStore.java
@@ -0,0 +1,17 @@
+package com.atguigu.factory.simplefactory.pizzastore.order;
+
+//相当于一个客户端,发出订购
+public class PizzaStore {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ //new OrderPizza();
+
+ //使用简单工厂模式
+ //new OrderPizza(new SimpleFactory());
+ //System.out.println("~~退出程序~~");
+
+ new OrderPizza2();
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/factory/simplefactory/pizzastore/order/SimpleFactory.java b/desginPattern/src/com/atguigu/factory/simplefactory/pizzastore/order/SimpleFactory.java
new file mode 100644
index 0000000..f0438e3
--- /dev/null
+++ b/desginPattern/src/com/atguigu/factory/simplefactory/pizzastore/order/SimpleFactory.java
@@ -0,0 +1,52 @@
+package com.atguigu.factory.simplefactory.pizzastore.order;
+
+import com.atguigu.factory.simplefactory.pizzastore.pizza.CheesePizza;
+import com.atguigu.factory.simplefactory.pizzastore.pizza.GreekPizza;
+import com.atguigu.factory.simplefactory.pizzastore.pizza.PepperPizza;
+import com.atguigu.factory.simplefactory.pizzastore.pizza.Pizza;
+
+//简单工厂类
+public class SimpleFactory {
+
+ //更加orderType 返回对应的Pizza 对象
+ public Pizza createPizza(String orderType) {
+
+ Pizza pizza = null;
+
+ System.out.println("使用简单工厂模式");
+ if (orderType.equals("greek")) {
+ pizza = new GreekPizza();
+ pizza.setName(" 希腊披萨 ");
+ } else if (orderType.equals("cheese")) {
+ pizza = new CheesePizza();
+ pizza.setName(" 奶酪披萨 ");
+ } else if (orderType.equals("pepper")) {
+ pizza = new PepperPizza();
+ pizza.setName("胡椒披萨");
+ }
+
+ return pizza;
+ }
+
+ //简单工厂模式 也叫 静态工厂模式
+
+ public static Pizza createPizza2(String orderType) {
+
+ Pizza pizza = null;
+
+ System.out.println("使用简单工厂模式2");
+ if (orderType.equals("greek")) {
+ pizza = new GreekPizza();
+ pizza.setName(" 希腊披萨 ");
+ } else if (orderType.equals("cheese")) {
+ pizza = new CheesePizza();
+ pizza.setName(" 奶酪披萨 ");
+ } else if (orderType.equals("pepper")) {
+ pizza = new PepperPizza();
+ pizza.setName("胡椒披萨");
+ }
+
+ return pizza;
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/factory/simplefactory/pizzastore/pizza/CheesePizza.java b/desginPattern/src/com/atguigu/factory/simplefactory/pizzastore/pizza/CheesePizza.java
new file mode 100644
index 0000000..99b6959
--- /dev/null
+++ b/desginPattern/src/com/atguigu/factory/simplefactory/pizzastore/pizza/CheesePizza.java
@@ -0,0 +1,11 @@
+package com.atguigu.factory.simplefactory.pizzastore.pizza;
+
+public class CheesePizza extends Pizza {
+
+ @Override
+ public void prepare() {
+ // TODO Auto-generated method stub
+ System.out.println(" 给制作奶酪披萨 准备原材料 ");
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/factory/simplefactory/pizzastore/pizza/GreekPizza.java b/desginPattern/src/com/atguigu/factory/simplefactory/pizzastore/pizza/GreekPizza.java
new file mode 100644
index 0000000..7f40aee
--- /dev/null
+++ b/desginPattern/src/com/atguigu/factory/simplefactory/pizzastore/pizza/GreekPizza.java
@@ -0,0 +1,11 @@
+package com.atguigu.factory.simplefactory.pizzastore.pizza;
+
+public class GreekPizza extends Pizza {
+
+ @Override
+ public void prepare() {
+ // TODO Auto-generated method stub
+ System.out.println(" 给希腊披萨 准备原材料 ");
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/factory/simplefactory/pizzastore/pizza/PepperPizza.java b/desginPattern/src/com/atguigu/factory/simplefactory/pizzastore/pizza/PepperPizza.java
new file mode 100644
index 0000000..c47dfc5
--- /dev/null
+++ b/desginPattern/src/com/atguigu/factory/simplefactory/pizzastore/pizza/PepperPizza.java
@@ -0,0 +1,11 @@
+package com.atguigu.factory.simplefactory.pizzastore.pizza;
+
+public class PepperPizza extends Pizza {
+
+ @Override
+ public void prepare() {
+ // TODO Auto-generated method stub
+ System.out.println(" 给胡椒披萨准备原材料 ");
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/factory/simplefactory/pizzastore/pizza/Pizza.java b/desginPattern/src/com/atguigu/factory/simplefactory/pizzastore/pizza/Pizza.java
new file mode 100644
index 0000000..bc21eaa
--- /dev/null
+++ b/desginPattern/src/com/atguigu/factory/simplefactory/pizzastore/pizza/Pizza.java
@@ -0,0 +1,27 @@
+package com.atguigu.factory.simplefactory.pizzastore.pizza;
+
+//将Pizza 类做成抽象
+public abstract class Pizza {
+ protected String name; //名字
+
+ //准备原材料, 不同的披萨不一样,因此,我们做成抽象方法
+ public abstract void prepare();
+
+
+ public void bake() {
+ System.out.println(name + " baking;");
+ }
+
+ public void cut() {
+ System.out.println(name + " cutting;");
+ }
+
+ //打包
+ public void box() {
+ System.out.println(name + " boxing;");
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
diff --git a/desginPattern/src/com/atguigu/flyweight/Client.java b/desginPattern/src/com/atguigu/flyweight/Client.java
new file mode 100644
index 0000000..8c899a3
--- /dev/null
+++ b/desginPattern/src/com/atguigu/flyweight/Client.java
@@ -0,0 +1,35 @@
+package com.atguigu.flyweight;
+
+public class Client {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+
+ // 创建一个工厂类
+ WebSiteFactory factory = new WebSiteFactory();
+
+ // 客户要一个以新闻形式发布的网站
+ WebSite webSite1 = factory.getWebSiteCategory("新闻");
+
+
+ webSite1.use(new User("tom"));
+
+ // 客户要一个以博客形式发布的网站
+ WebSite webSite2 = factory.getWebSiteCategory("博客");
+
+ webSite2.use(new User("jack"));
+
+ // 客户要一个以博客形式发布的网站
+ WebSite webSite3 = factory.getWebSiteCategory("博客");
+
+ webSite3.use(new User("smith"));
+
+ // 客户要一个以博客形式发布的网站
+ WebSite webSite4 = factory.getWebSiteCategory("博客");
+
+ webSite4.use(new User("king"));
+
+ System.out.println("网站的分类共=" + factory.getWebSiteCount());
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/flyweight/ConcreteWebSite.java b/desginPattern/src/com/atguigu/flyweight/ConcreteWebSite.java
new file mode 100644
index 0000000..57022c9
--- /dev/null
+++ b/desginPattern/src/com/atguigu/flyweight/ConcreteWebSite.java
@@ -0,0 +1,24 @@
+package com.atguigu.flyweight;
+
+//具体网站
+public class ConcreteWebSite extends WebSite {
+
+ //共享的部分,内部状态
+ private String type = ""; //网站发布的形式(类型)
+
+
+ //构造器
+ public ConcreteWebSite(String type) {
+
+ this.type = type;
+ }
+
+
+ @Override
+ public void use(User user) {
+ // TODO Auto-generated method stub
+ System.out.println("网站的发布形式为:" + type + " 在使用中 .. 使用者是" + user.getName());
+ }
+
+
+}
diff --git a/desginPattern/src/com/atguigu/flyweight/User.java b/desginPattern/src/com/atguigu/flyweight/User.java
new file mode 100644
index 0000000..b5f6ece
--- /dev/null
+++ b/desginPattern/src/com/atguigu/flyweight/User.java
@@ -0,0 +1,22 @@
+package com.atguigu.flyweight;
+
+public class User {
+
+ private String name;
+
+
+ public User(String name) {
+ super();
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+
+}
diff --git a/desginPattern/src/com/atguigu/flyweight/WebSite.java b/desginPattern/src/com/atguigu/flyweight/WebSite.java
new file mode 100644
index 0000000..1fa3e1c
--- /dev/null
+++ b/desginPattern/src/com/atguigu/flyweight/WebSite.java
@@ -0,0 +1,6 @@
+package com.atguigu.flyweight;
+
+public abstract class WebSite {
+
+ public abstract void use(User user);//抽象方法
+}
diff --git a/desginPattern/src/com/atguigu/flyweight/WebSiteFactory.java b/desginPattern/src/com/atguigu/flyweight/WebSiteFactory.java
new file mode 100644
index 0000000..1bece2b
--- /dev/null
+++ b/desginPattern/src/com/atguigu/flyweight/WebSiteFactory.java
@@ -0,0 +1,26 @@
+package com.atguigu.flyweight;
+
+import java.util.HashMap;
+
+// 网站工厂类,根据需要返回压一个网站
+public class WebSiteFactory {
+
+
+ //集合, 充当池的作用
+ private HashMap pool = new HashMap<>();
+
+ //根据网站的类型,返回一个网站, 如果没有就创建一个网站,并放入到池中,并返回
+ public WebSite getWebSiteCategory(String type) {
+ if(!pool.containsKey(type)) {
+ //就创建一个网站,并放入到池中
+ pool.put(type, new ConcreteWebSite(type));
+ }
+
+ return (WebSite)pool.get(type);
+ }
+
+ //获取网站分类的总数 (池中有多少个网站类型)
+ public int getWebSiteCount() {
+ return pool.size();
+ }
+}
diff --git a/desginPattern/src/com/atguigu/flyweight/newfile.cld b/desginPattern/src/com/atguigu/flyweight/newfile.cld
new file mode 100644
index 0000000..eba3f9a
--- /dev/null
+++ b/desginPattern/src/com/atguigu/flyweight/newfile.cld
@@ -0,0 +1,604 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 412
+ 244
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 424
+ 369
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ 67
+ 125
+ 562
+ 345
+
+
+
+
+
+
+
+ User鏄韩鍏冩ā寮忎腑鐨勶紝澶栭儴鐘舵
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 185
+ 258
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 135
+ 97
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ getWebSiteCategory
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ WebSiteFactory
+ false
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Client
+ false
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ User
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ use
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ ConcreteWebSite
+ false
+
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 434
+ 93
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ use
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ WebSite
+ false
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/interpreter/AddExpression.java b/desginPattern/src/com/atguigu/interpreter/AddExpression.java
new file mode 100644
index 0000000..c8ddf19
--- /dev/null
+++ b/desginPattern/src/com/atguigu/interpreter/AddExpression.java
@@ -0,0 +1,24 @@
+package com.atguigu.interpreter;
+
+import java.util.HashMap;
+
+/**
+ * 加法解释器
+ * @author Administrator
+ *
+ */
+public class AddExpression extends SymbolExpression {
+
+ public AddExpression(Expression left, Expression right) {
+ super(left, right);
+ }
+
+ //处理相加
+ //var 仍然是 {a=10,b=20}..
+ //一会我们debug 源码,就ok
+ public int interpreter(HashMap var) {
+ //super.left.interpreter(var) : 返回 left 表达式对应的值 a = 10
+ //super.right.interpreter(var): 返回right 表达式对应值 b = 20
+ return super.left.interpreter(var) + super.right.interpreter(var);
+ }
+}
diff --git a/desginPattern/src/com/atguigu/interpreter/Calculator.java b/desginPattern/src/com/atguigu/interpreter/Calculator.java
new file mode 100644
index 0000000..c0b5336
--- /dev/null
+++ b/desginPattern/src/com/atguigu/interpreter/Calculator.java
@@ -0,0 +1,49 @@
+package com.atguigu.interpreter;
+
+import java.util.HashMap;
+import java.util.Stack;
+
+public class Calculator {
+
+ // 定义表达式
+ private Expression expression;
+
+ // 构造函数传参,并解析
+ public Calculator(String expStr) { // expStr = a+b
+ // 安排运算先后顺序
+ Stack stack = new Stack<>();
+ // 表达式拆分成字符数组
+ char[] charArray = expStr.toCharArray();// [a, +, b]
+
+ Expression left = null;
+ Expression right = null;
+ //遍历我们的字符数组, 即遍历 [a, +, b]
+ //针对不同的情况,做处理
+ for (int i = 0; i < charArray.length; i++) {
+ switch (charArray[i]) {
+ case '+': //
+ left = stack.pop();// 从stack取出left => "a"
+ right = new VarExpression(String.valueOf(charArray[++i]));// 取出右表达式 "b"
+ stack.push(new AddExpression(left, right));// 然后根据得到left 和 right 构建 AddExpresson加入stack
+ break;
+ case '-': //
+ left = stack.pop();
+ right = new VarExpression(String.valueOf(charArray[++i]));
+ stack.push(new SubExpression(left, right));
+ break;
+ default:
+ //如果是一个 Var 就创建要给 VarExpression 对象,并push到 stack
+ stack.push(new VarExpression(String.valueOf(charArray[i])));
+ break;
+ }
+ }
+ //当遍历完整个 charArray 数组后,stack 就得到最后Expression
+ this.expression = stack.pop();
+ }
+
+ public int run(HashMap var) {
+ //最后将表达式a+b和 var = {a=10,b=20}
+ //然后传递给expression的interpreter进行解释执行
+ return this.expression.interpreter(var);
+ }
+}
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/interpreter/ClientTest.java b/desginPattern/src/com/atguigu/interpreter/ClientTest.java
new file mode 100644
index 0000000..165c937
--- /dev/null
+++ b/desginPattern/src/com/atguigu/interpreter/ClientTest.java
@@ -0,0 +1,40 @@
+package com.atguigu.interpreter;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.HashMap;
+
+public class ClientTest {
+
+ public static void main(String[] args) throws IOException {
+ // TODO Auto-generated method stub
+ String expStr = getExpStr(); // a+b
+ HashMap var = getValue(expStr);// var {a=10, b=20}
+ Calculator calculator = new Calculator(expStr);
+ System.out.println("运算结果:" + expStr + "=" + calculator.run(var));
+ }
+
+ // 获得表达式
+ public static String getExpStr() throws IOException {
+ System.out.print("请输入表达式:");
+ return (new BufferedReader(new InputStreamReader(System.in))).readLine();
+ }
+
+ // 获得值映射
+ public static HashMap getValue(String expStr) throws IOException {
+ HashMap map = new HashMap<>();
+
+ for (char ch : expStr.toCharArray()) {
+ if (ch != '+' && ch != '-') {
+ if (!map.containsKey(String.valueOf(ch))) {
+ System.out.print("请输入" + String.valueOf(ch) + "的值:");
+ String in = (new BufferedReader(new InputStreamReader(System.in))).readLine();
+ map.put(String.valueOf(ch), Integer.valueOf(in));
+ }
+ }
+ }
+
+ return map;
+ }
+}
diff --git a/desginPattern/src/com/atguigu/interpreter/Expression.java b/desginPattern/src/com/atguigu/interpreter/Expression.java
new file mode 100644
index 0000000..bd4440e
--- /dev/null
+++ b/desginPattern/src/com/atguigu/interpreter/Expression.java
@@ -0,0 +1,16 @@
+package com.atguigu.interpreter;
+
+import java.util.HashMap;
+
+/**
+ * 抽象类表达式,通过HashMap 键值对, 可以获取到变量的值
+ *
+ * @author Administrator
+ *
+ */
+public abstract class Expression {
+ // a + b - c
+ // 解释公式和数值, key 就是公式(表达式) 参数[a,b,c], value就是就是具体值
+ // HashMap {a=10, b=20}
+ public abstract int interpreter(HashMap var);
+}
diff --git a/desginPattern/src/com/atguigu/interpreter/SubExpression.java b/desginPattern/src/com/atguigu/interpreter/SubExpression.java
new file mode 100644
index 0000000..c94d98b
--- /dev/null
+++ b/desginPattern/src/com/atguigu/interpreter/SubExpression.java
@@ -0,0 +1,15 @@
+package com.atguigu.interpreter;
+
+import java.util.HashMap;
+
+public class SubExpression extends SymbolExpression {
+
+ public SubExpression(Expression left, Expression right) {
+ super(left, right);
+ }
+
+ //求出left 和 right 表达式相减后的结果
+ public int interpreter(HashMap var) {
+ return super.left.interpreter(var) - super.right.interpreter(var);
+ }
+}
diff --git a/desginPattern/src/com/atguigu/interpreter/SymbolExpression.java b/desginPattern/src/com/atguigu/interpreter/SymbolExpression.java
new file mode 100644
index 0000000..159031d
--- /dev/null
+++ b/desginPattern/src/com/atguigu/interpreter/SymbolExpression.java
@@ -0,0 +1,28 @@
+package com.atguigu.interpreter;
+
+import java.util.HashMap;
+
+/**
+ * 抽象运算符号解析器 这里,每个运算符号,都只和自己左右两个数字有关系,
+ * 但左右两个数字有可能也是一个解析的结果,无论何种类型,都是Expression类的实现类
+ *
+ * @author Administrator
+ *
+ */
+public class SymbolExpression extends Expression {
+
+ protected Expression left;
+ protected Expression right;
+
+ public SymbolExpression(Expression left, Expression right) {
+ this.left = left;
+ this.right = right;
+ }
+
+ //因为 SymbolExpression 是让其子类来实现,因此 interpreter 是一个默认实现
+ @Override
+ public int interpreter(HashMap var) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+}
diff --git a/desginPattern/src/com/atguigu/interpreter/VarExpression.java b/desginPattern/src/com/atguigu/interpreter/VarExpression.java
new file mode 100644
index 0000000..1106724
--- /dev/null
+++ b/desginPattern/src/com/atguigu/interpreter/VarExpression.java
@@ -0,0 +1,25 @@
+package com.atguigu.interpreter;
+
+import java.util.HashMap;
+
+
+/**
+ * 变量的解释器
+ * @author Administrator
+ *
+ */
+public class VarExpression extends Expression {
+
+ private String key; // key=a,key=b,key=c
+
+ public VarExpression(String key) {
+ this.key = key;
+ }
+
+ // var 就是{a=10, b=20}
+ // interpreter 根据 变量名称,返回对应值
+ @Override
+ public int interpreter(HashMap var) {
+ return var.get(this.key);
+ }
+}
diff --git a/desginPattern/src/com/atguigu/interpreter/expression.cld b/desginPattern/src/com/atguigu/interpreter/expression.cld
new file mode 100644
index 0000000..5661df0
--- /dev/null
+++ b/desginPattern/src/com/atguigu/interpreter/expression.cld
@@ -0,0 +1,743 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 313
+ 328
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ VarExpression
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 506
+ 327
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ 0.5
+
+ 111
+ 15
+
+
+ 3
+ -126
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 598
+ 431
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ AddExpression
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 409
+ 73
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 204
+ 72
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Client
+ false
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Calculator
+ false
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 424
+ 432
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ SubExpression
+ false
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ SymbolExpression
+ false
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 403
+ 177
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ interpreter
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Expression
+ false
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ 146
+ 127
+ 130
+ 184
+
+
+
+
+
+ 浣跨敤Stack
+1. 璁捐妯″紡
+2. 绋嬪簭鏈韩閫昏緫
+
+鎼炴竻绋嬪簭璁捐妯″紡+Debug婧愮爜
+
+ 浣跨敤Stack
+1. 璁捐妯″紡
+2. 绋嬪簭鏈韩閫昏緫
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/interpreter/newfile.cld b/desginPattern/src/com/atguigu/interpreter/newfile.cld
new file mode 100644
index 0000000..1d6f461
--- /dev/null
+++ b/desginPattern/src/com/atguigu/interpreter/newfile.cld
@@ -0,0 +1,479 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 387
+ 123
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 475
+ 295
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ NonTerminalExpression
+ false
+
+
+
+ 0.5
+
+ 171
+ 45
+
+
+ 70
+ -118
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 272
+ 290
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ TerminalExpression
+ false
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 178
+ 54
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 388
+ 25
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Context
+ false
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Client
+ false
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ interpret
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ AbstractExpression
+ false
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/iterator/Client.java b/desginPattern/src/com/atguigu/iterator/Client.java
new file mode 100644
index 0000000..5c17992
--- /dev/null
+++ b/desginPattern/src/com/atguigu/iterator/Client.java
@@ -0,0 +1,23 @@
+package com.atguigu.iterator;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Client {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ //创建学院
+ List collegeList = new ArrayList();
+
+ ComputerCollege computerCollege = new ComputerCollege();
+ InfoCollege infoCollege = new InfoCollege();
+
+ collegeList.add(computerCollege);
+ //collegeList.add(infoCollege);
+
+ OutPutImpl outPutImpl = new OutPutImpl(collegeList);
+ outPutImpl.printCollege();
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/iterator/College.java b/desginPattern/src/com/atguigu/iterator/College.java
new file mode 100644
index 0000000..1ae2b15
--- /dev/null
+++ b/desginPattern/src/com/atguigu/iterator/College.java
@@ -0,0 +1,14 @@
+package com.atguigu.iterator;
+
+import java.util.Iterator;
+
+public interface College {
+
+ public String getName();
+
+ //增加系的方法
+ public void addDepartment(String name, String desc);
+
+ //返回一个迭代器,遍历
+ public Iterator createIterator();
+}
diff --git a/desginPattern/src/com/atguigu/iterator/ComputerCollege.java b/desginPattern/src/com/atguigu/iterator/ComputerCollege.java
new file mode 100644
index 0000000..9767470
--- /dev/null
+++ b/desginPattern/src/com/atguigu/iterator/ComputerCollege.java
@@ -0,0 +1,40 @@
+package com.atguigu.iterator;
+
+import java.util.Iterator;
+
+public class ComputerCollege implements College {
+
+ Department[] departments;
+ int numOfDepartment = 0 ;// 保存当前数组的对象个数
+
+
+ public ComputerCollege() {
+ departments = new Department[5];
+ addDepartment("Java专业", " Java专业 ");
+ addDepartment("PHP专业", " PHP专业 ");
+ addDepartment("大数据专业", " 大数据专业 ");
+
+ }
+
+
+ @Override
+ public String getName() {
+ // TODO Auto-generated method stub
+ return "计算机学院";
+ }
+
+ @Override
+ public void addDepartment(String name, String desc) {
+ // TODO Auto-generated method stub
+ Department department = new Department(name, desc);
+ departments[numOfDepartment] = department;
+ numOfDepartment += 1;
+ }
+
+ @Override
+ public Iterator createIterator() {
+ // TODO Auto-generated method stub
+ return new ComputerCollegeIterator(departments);
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/iterator/ComputerCollegeIterator.java b/desginPattern/src/com/atguigu/iterator/ComputerCollegeIterator.java
new file mode 100644
index 0000000..6605cd7
--- /dev/null
+++ b/desginPattern/src/com/atguigu/iterator/ComputerCollegeIterator.java
@@ -0,0 +1,44 @@
+package com.atguigu.iterator;
+
+import java.util.Iterator;
+
+
+public class ComputerCollegeIterator implements Iterator {
+
+ //这里我们需要Department 是以怎样的方式存放=>数组
+ Department[] departments;
+ int position = 0; //遍历的位置
+
+
+
+
+ public ComputerCollegeIterator(Department[] departments) {
+ this.departments = departments;
+ }
+
+ //判断是否还有下一个元素
+ @Override
+ public boolean hasNext() {
+ // TODO Auto-generated method stub
+ if(position >= departments.length || departments[position] == null) {
+ return false;
+ }else {
+
+ return true;
+ }
+ }
+
+ @Override
+ public Object next() {
+ // TODO Auto-generated method stub
+ Department department = departments[position];
+ position += 1;
+ return department;
+ }
+
+ //删除的方法,默认空实现
+ public void remove() {
+
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/iterator/Department.java b/desginPattern/src/com/atguigu/iterator/Department.java
new file mode 100644
index 0000000..1c2d0ae
--- /dev/null
+++ b/desginPattern/src/com/atguigu/iterator/Department.java
@@ -0,0 +1,28 @@
+package com.atguigu.iterator;
+
+//系
+public class Department {
+
+ private String name;
+ private String desc;
+ public Department(String name, String desc) {
+ super();
+ this.name = name;
+ this.desc = desc;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getDesc() {
+ return desc;
+ }
+ public void setDesc(String desc) {
+ this.desc = desc;
+ }
+
+
+
+}
diff --git a/desginPattern/src/com/atguigu/iterator/InfoColleageIterator.java b/desginPattern/src/com/atguigu/iterator/InfoColleageIterator.java
new file mode 100644
index 0000000..2b93b7e
--- /dev/null
+++ b/desginPattern/src/com/atguigu/iterator/InfoColleageIterator.java
@@ -0,0 +1,40 @@
+package com.atguigu.iterator;
+
+import java.util.Iterator;
+import java.util.List;
+
+public class InfoColleageIterator implements Iterator {
+
+
+ List departmentList; // 信息工程学院是以List方式存放系
+ int index = -1;//索引
+
+
+ public InfoColleageIterator(List departmentList) {
+ this.departmentList = departmentList;
+ }
+
+ //判断list中还有没有下一个元素
+ @Override
+ public boolean hasNext() {
+ // TODO Auto-generated method stub
+ if(index >= departmentList.size() - 1) {
+ return false;
+ } else {
+ index += 1;
+ return true;
+ }
+ }
+
+ @Override
+ public Object next() {
+ // TODO Auto-generated method stub
+ return departmentList.get(index);
+ }
+
+ //空实现remove
+ public void remove() {
+
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/iterator/InfoCollege.java b/desginPattern/src/com/atguigu/iterator/InfoCollege.java
new file mode 100644
index 0000000..1dfa164
--- /dev/null
+++ b/desginPattern/src/com/atguigu/iterator/InfoCollege.java
@@ -0,0 +1,38 @@
+package com.atguigu.iterator;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+public class InfoCollege implements College {
+
+ List departmentList;
+
+
+ public InfoCollege() {
+ departmentList = new ArrayList();
+ addDepartment("信息安全专业", " 信息安全专业 ");
+ addDepartment("网络安全专业", " 网络安全专业 ");
+ addDepartment("服务器安全专业", " 服务器安全专业 ");
+ }
+
+ @Override
+ public String getName() {
+ // TODO Auto-generated method stub
+ return "信息工程学院";
+ }
+
+ @Override
+ public void addDepartment(String name, String desc) {
+ // TODO Auto-generated method stub
+ Department department = new Department(name, desc);
+ departmentList.add(department);
+ }
+
+ @Override
+ public Iterator createIterator() {
+ // TODO Auto-generated method stub
+ return new InfoColleageIterator(departmentList);
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/iterator/OutPutImpl.java b/desginPattern/src/com/atguigu/iterator/OutPutImpl.java
new file mode 100644
index 0000000..12c127b
--- /dev/null
+++ b/desginPattern/src/com/atguigu/iterator/OutPutImpl.java
@@ -0,0 +1,39 @@
+package com.atguigu.iterator;
+
+import java.util.Iterator;
+import java.util.List;
+
+public class OutPutImpl {
+
+ //学院集合
+ List collegeList;
+
+ public OutPutImpl(List collegeList) {
+
+ this.collegeList = collegeList;
+ }
+ //遍历所有学院,然后调用printDepartment 输出各个学院的系
+ public void printCollege() {
+
+ //从collegeList 取出所有学院, Java 中的 List 已经实现Iterator
+ Iterator iterator = collegeList.iterator();
+
+ while(iterator.hasNext()) {
+ //取出一个学院
+ College college = iterator.next();
+ System.out.println("=== "+college.getName() +"=====" );
+ printDepartment(college.createIterator()); //得到对应迭代器
+ }
+ }
+
+
+ //输出 学院输出 系
+
+ public void printDepartment(Iterator iterator) {
+ while(iterator.hasNext()) {
+ Department d = (Department)iterator.next();
+ System.out.println(d.getName());
+ }
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/iterator/newfile.cld b/desginPattern/src/com/atguigu/iterator/newfile.cld
new file mode 100644
index 0000000..affdadd
--- /dev/null
+++ b/desginPattern/src/com/atguigu/iterator/newfile.cld
@@ -0,0 +1,1000 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 355
+ 325
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 68
+ 286
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 97
+ 146
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 524
+ 321
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 511
+ 416
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Element
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ ConcreteIterator02
+ false
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 217
+ 40
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Client
+ false
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 231
+ 384
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ createIterator
+ Iterator
+
+ false
+ false
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ eles
+ 鏁扮粍
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ ConcreteAggregate02
+ false
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ createIterator
+ Iterator
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+
+ Aggregate
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ createIterator
+ Iterator
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ eles
+ ArrayList
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ ConcreteAggregate
+ false
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ ConcreteIterator
+ false
+
+
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 347
+ 114
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ hasNext
+ boolean
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ next
+ E
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ remove
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+
+ Iterator
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/iterator/showDepartment.cld b/desginPattern/src/com/atguigu/iterator/showDepartment.cld
new file mode 100644
index 0000000..d321816
--- /dev/null
+++ b/desginPattern/src/com/atguigu/iterator/showDepartment.cld
@@ -0,0 +1,1001 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 436
+ 76
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 297
+ 255
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 280
+ 402
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 529
+ 261
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 203
+ 301
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 88
+ 105
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 183
+ 16
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ 63
+ 111
+ 25
+ 15
+
+
+
+
+
+
+
+ 瀹屾垚瀵规墍鏈
+瀛﹂櫌鐨勮緭鍑
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 349
+ 10
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Client
+ false
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ OutputImpl
+ false
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 11
+ 245
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ ComputerColleage
+ false
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ createIterator
+ Iterator
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+
+ College
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ InfoColleage
+ false
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ InfoColleageIterator
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Department
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ ComputerCollegeIterator
+ false
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ hasNext
+ boolean
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ next
+ E
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ remove
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+
+ Iterator
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/mediator/newfile.cld b/desginPattern/src/com/atguigu/mediator/newfile.cld
new file mode 100644
index 0000000..6e6b091
--- /dev/null
+++ b/desginPattern/src/com/atguigu/mediator/newfile.cld
@@ -0,0 +1,656 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 432
+ 133
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 243
+ 91
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 282
+ 154
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Wife
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 281
+ 221
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Father
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 278
+ 296
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Brother
+ false
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 105
+ 76
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ 涓粙
+ false
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ HouseMaster
+ false
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ House
+ false
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 12
+ 127
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ 瀹㈡埛
+ false
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/mediator/smarthouse.cld b/desginPattern/src/com/atguigu/mediator/smarthouse.cld
new file mode 100644
index 0000000..981f880
--- /dev/null
+++ b/desginPattern/src/com/atguigu/mediator/smarthouse.cld
@@ -0,0 +1,1028 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 121
+ 246
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 488
+ 117
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 393
+ 240
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Alarm
+ false
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 427
+ 314
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ CoffeeMachine
+ false
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 489
+ 375
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Curtains
+ false
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 561
+ 462
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ TV
+ false
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 321
+ 47
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Client
+ false
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 648
+ 454
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Phone
+ false
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ sendMessage
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ getMediator
+ Mediator
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Colleague
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ colleagueMap
+ HashMap
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ getMessage
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ ConcreteMediator
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 176
+ 142
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Mediator
+ false
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/mediator/smarthouse/Alarm.java b/desginPattern/src/com/atguigu/mediator/smarthouse/Alarm.java
new file mode 100644
index 0000000..4c3ad17
--- /dev/null
+++ b/desginPattern/src/com/atguigu/mediator/smarthouse/Alarm.java
@@ -0,0 +1,25 @@
+package com.atguigu.mediator.smarthouse;
+
+//具体的同事类
+public class Alarm extends Colleague {
+
+ //构造器
+ public Alarm(Mediator mediator, String name) {
+ super(mediator, name);
+ // TODO Auto-generated constructor stub
+ //在创建Alarm 同事对象时,将自己放入到ConcreteMediator 对象中[集合]
+ mediator.Register(name, this);
+ }
+
+ public void SendAlarm(int stateChange) {
+ SendMessage(stateChange);
+ }
+
+ @Override
+ public void SendMessage(int stateChange) {
+ // TODO Auto-generated method stub
+ //调用的中介者对象的getMessage
+ this.GetMediator().GetMessage(stateChange, this.name);
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/mediator/smarthouse/ClientTest.java b/desginPattern/src/com/atguigu/mediator/smarthouse/ClientTest.java
new file mode 100644
index 0000000..2709a9d
--- /dev/null
+++ b/desginPattern/src/com/atguigu/mediator/smarthouse/ClientTest.java
@@ -0,0 +1,26 @@
+package com.atguigu.mediator.smarthouse;
+
+public class ClientTest {
+
+ public static void main(String[] args) {
+ //创建一个中介者对象
+ Mediator mediator = new ConcreteMediator();
+
+ //创建Alarm 并且加入到 ConcreteMediator 对象的HashMap
+ Alarm alarm = new Alarm(mediator, "alarm");
+
+ //创建了CoffeeMachine 对象,并 且加入到 ConcreteMediator 对象的HashMap
+ CoffeeMachine coffeeMachine = new CoffeeMachine(mediator,
+ "coffeeMachine");
+
+ //创建 Curtains , 并 且加入到 ConcreteMediator 对象的HashMap
+ Curtains curtains = new Curtains(mediator, "curtains");
+ TV tV = new TV(mediator, "TV");
+
+ //让闹钟发出消息
+ alarm.SendAlarm(0);
+ coffeeMachine.FinishCoffee();
+ alarm.SendAlarm(1);
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/mediator/smarthouse/CoffeeMachine.java b/desginPattern/src/com/atguigu/mediator/smarthouse/CoffeeMachine.java
new file mode 100644
index 0000000..7d25cad
--- /dev/null
+++ b/desginPattern/src/com/atguigu/mediator/smarthouse/CoffeeMachine.java
@@ -0,0 +1,27 @@
+package com.atguigu.mediator.smarthouse;
+
+public class CoffeeMachine extends Colleague {
+
+ public CoffeeMachine(Mediator mediator, String name) {
+ super(mediator, name);
+ // TODO Auto-generated constructor stub
+ mediator.Register(name, this);
+ }
+
+ @Override
+ public void SendMessage(int stateChange) {
+ // TODO Auto-generated method stub
+ this.GetMediator().GetMessage(stateChange, this.name);
+ }
+
+ public void StartCoffee() {
+ System.out.println("It's time to startcoffee!");
+ }
+
+ public void FinishCoffee() {
+
+ System.out.println("After 5 minutes!");
+ System.out.println("Coffee is ok!");
+ SendMessage(0);
+ }
+}
diff --git a/desginPattern/src/com/atguigu/mediator/smarthouse/Colleague.java b/desginPattern/src/com/atguigu/mediator/smarthouse/Colleague.java
new file mode 100644
index 0000000..f2f05eb
--- /dev/null
+++ b/desginPattern/src/com/atguigu/mediator/smarthouse/Colleague.java
@@ -0,0 +1,20 @@
+package com.atguigu.mediator.smarthouse;
+
+//同事抽象类
+public abstract class Colleague {
+ private Mediator mediator;
+ public String name;
+
+ public Colleague(Mediator mediator, String name) {
+
+ this.mediator = mediator;
+ this.name = name;
+
+ }
+
+ public Mediator GetMediator() {
+ return this.mediator;
+ }
+
+ public abstract void SendMessage(int stateChange);
+}
diff --git a/desginPattern/src/com/atguigu/mediator/smarthouse/ConcreteMediator.java b/desginPattern/src/com/atguigu/mediator/smarthouse/ConcreteMediator.java
new file mode 100644
index 0000000..6c405dd
--- /dev/null
+++ b/desginPattern/src/com/atguigu/mediator/smarthouse/ConcreteMediator.java
@@ -0,0 +1,70 @@
+package com.atguigu.mediator.smarthouse;
+
+import java.util.HashMap;
+
+//具体的中介者类
+public class ConcreteMediator extends Mediator {
+ //集合,放入所有的同事对象
+ private HashMap colleagueMap;
+ private HashMap interMap;
+
+ public ConcreteMediator() {
+ colleagueMap = new HashMap();
+ interMap = new HashMap();
+ }
+
+ @Override
+ public void Register(String colleagueName, Colleague colleague) {
+ // TODO Auto-generated method stub
+ colleagueMap.put(colleagueName, colleague);
+
+ // TODO Auto-generated method stub
+
+ if (colleague instanceof Alarm) {
+ interMap.put("Alarm", colleagueName);
+ } else if (colleague instanceof CoffeeMachine) {
+ interMap.put("CoffeeMachine", colleagueName);
+ } else if (colleague instanceof TV) {
+ interMap.put("TV", colleagueName);
+ } else if (colleague instanceof Curtains) {
+ interMap.put("Curtains", colleagueName);
+ }
+
+ }
+
+ //具体中介者的核心方法
+ //1. 根据得到消息,完成对应任务
+ //2. 中介者在这个方法,协调各个具体的同事对象,完成任务
+ @Override
+ public void GetMessage(int stateChange, String colleagueName) {
+ // TODO Auto-generated method stub
+
+ //处理闹钟发出的消息
+ if (colleagueMap.get(colleagueName) instanceof Alarm) {
+ if (stateChange == 0) {
+ ((CoffeeMachine) (colleagueMap.get(interMap
+ .get("CoffeeMachine")))).StartCoffee();
+ ((TV) (colleagueMap.get(interMap.get("TV")))).StartTv();
+ } else if (stateChange == 1) {
+ ((TV) (colleagueMap.get(interMap.get("TV")))).StopTv();
+ }
+
+ } else if (colleagueMap.get(colleagueName) instanceof CoffeeMachine) {
+ ((Curtains) (colleagueMap.get(interMap.get("Curtains"))))
+ .UpCurtains();
+
+ } else if (colleagueMap.get(colleagueName) instanceof TV) {//如果TV发现消息
+
+ } else if (colleagueMap.get(colleagueName) instanceof Curtains) {
+ //如果是以窗帘发出的消息,这里处理...
+ }
+
+ }
+
+ @Override
+ public void SendMessage() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/mediator/smarthouse/Curtains.java b/desginPattern/src/com/atguigu/mediator/smarthouse/Curtains.java
new file mode 100644
index 0000000..238a3e8
--- /dev/null
+++ b/desginPattern/src/com/atguigu/mediator/smarthouse/Curtains.java
@@ -0,0 +1,21 @@
+package com.atguigu.mediator.smarthouse;
+
+public class Curtains extends Colleague {
+
+ public Curtains(Mediator mediator, String name) {
+ super(mediator, name);
+ // TODO Auto-generated constructor stub
+ mediator.Register(name, this);
+ }
+
+ @Override
+ public void SendMessage(int stateChange) {
+ // TODO Auto-generated method stub
+ this.GetMediator().GetMessage(stateChange, this.name);
+ }
+
+ public void UpCurtains() {
+ System.out.println("I am holding Up Curtains!");
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/mediator/smarthouse/Mediator.java b/desginPattern/src/com/atguigu/mediator/smarthouse/Mediator.java
new file mode 100644
index 0000000..dd31ca0
--- /dev/null
+++ b/desginPattern/src/com/atguigu/mediator/smarthouse/Mediator.java
@@ -0,0 +1,11 @@
+package com.atguigu.mediator.smarthouse;
+
+public abstract class Mediator {
+ //将给中介者对象,加入到集合中
+ public abstract void Register(String colleagueName, Colleague colleague);
+
+ //接收消息, 具体的同事对象发出
+ public abstract void GetMessage(int stateChange, String colleagueName);
+
+ public abstract void SendMessage();
+}
diff --git a/desginPattern/src/com/atguigu/mediator/smarthouse/TV.java b/desginPattern/src/com/atguigu/mediator/smarthouse/TV.java
new file mode 100644
index 0000000..4a9071c
--- /dev/null
+++ b/desginPattern/src/com/atguigu/mediator/smarthouse/TV.java
@@ -0,0 +1,26 @@
+package com.atguigu.mediator.smarthouse;
+
+public class TV extends Colleague {
+
+ public TV(Mediator mediator, String name) {
+ super(mediator, name);
+ // TODO Auto-generated constructor stub
+ mediator.Register(name, this);
+ }
+
+ @Override
+ public void SendMessage(int stateChange) {
+ // TODO Auto-generated method stub
+ this.GetMediator().GetMessage(stateChange, this.name);
+ }
+
+ public void StartTv() {
+ // TODO Auto-generated method stub
+ System.out.println("It's time to StartTv!");
+ }
+
+ public void StopTv() {
+ // TODO Auto-generated method stub
+ System.out.println("StopTv!");
+ }
+}
diff --git a/desginPattern/src/com/atguigu/mediator/theory.cld b/desginPattern/src/com/atguigu/mediator/theory.cld
new file mode 100644
index 0000000..5dd6c36
--- /dev/null
+++ b/desginPattern/src/com/atguigu/mediator/theory.cld
@@ -0,0 +1,374 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 127
+ 302
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ ConcreteMediator
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 420
+ 201
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 400
+ 307
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ ConcreteColleague
+ false
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Colleague
+ false
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 128
+ 210
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Mediator
+ false
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/memento/game/Caretaker.java b/desginPattern/src/com/atguigu/memento/game/Caretaker.java
new file mode 100644
index 0000000..c743102
--- /dev/null
+++ b/desginPattern/src/com/atguigu/memento/game/Caretaker.java
@@ -0,0 +1,25 @@
+package com.atguigu.memento.game;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+//守护者对象, 保存游戏角色的状态
+public class Caretaker {
+
+ //如果只保存一次状态
+ private Memento memento;
+ //对GameRole 保存多次状态
+ //private ArrayList mementos;
+ //对多个游戏角色保存多个状态
+ //private HashMap> rolesMementos;
+
+ public Memento getMemento() {
+ return memento;
+ }
+
+ public void setMemento(Memento memento) {
+ this.memento = memento;
+ }
+
+
+}
diff --git a/desginPattern/src/com/atguigu/memento/game/Client.java b/desginPattern/src/com/atguigu/memento/game/Client.java
new file mode 100644
index 0000000..23ac941
--- /dev/null
+++ b/desginPattern/src/com/atguigu/memento/game/Client.java
@@ -0,0 +1,32 @@
+package com.atguigu.memento.game;
+
+public class Client {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ //创建游戏角色
+ GameRole gameRole = new GameRole();
+ gameRole.setVit(100);
+ gameRole.setDef(100);
+
+ System.out.println("和boss大战前的状态");
+ gameRole.display();
+
+ //把当前状态保存caretaker
+ Caretaker caretaker = new Caretaker();
+ caretaker.setMemento(gameRole.createMemento());
+
+ System.out.println("和boss大战~~~");
+ gameRole.setDef(30);
+ gameRole.setVit(30);
+
+ gameRole.display();
+
+ System.out.println("大战后,使用备忘录对象恢复到站前");
+
+ gameRole.recoverGameRoleFromMemento(caretaker.getMemento());
+ System.out.println("恢复后的状态");
+ gameRole.display();
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/memento/game/GameRole.java b/desginPattern/src/com/atguigu/memento/game/GameRole.java
new file mode 100644
index 0000000..a5f31fe
--- /dev/null
+++ b/desginPattern/src/com/atguigu/memento/game/GameRole.java
@@ -0,0 +1,41 @@
+package com.atguigu.memento.game;
+
+public class GameRole {
+
+ private int vit;
+ private int def;
+
+ //创建Memento ,即根据当前的状态得到Memento
+ public Memento createMemento() {
+ return new Memento(vit, def);
+ }
+
+ //从备忘录对象,恢复GameRole的状态
+ public void recoverGameRoleFromMemento(Memento memento) {
+ this.vit = memento.getVit();
+ this.def = memento.getDef();
+ }
+
+ //显示当前游戏角色的状态
+ public void display() {
+ System.out.println("游戏角色当前的攻击力:" + this.vit + " 防御力: " + this.def);
+ }
+
+ public int getVit() {
+ return vit;
+ }
+
+ public void setVit(int vit) {
+ this.vit = vit;
+ }
+
+ public int getDef() {
+ return def;
+ }
+
+ public void setDef(int def) {
+ this.def = def;
+ }
+
+
+}
diff --git a/desginPattern/src/com/atguigu/memento/game/Memento.java b/desginPattern/src/com/atguigu/memento/game/Memento.java
new file mode 100644
index 0000000..7412c71
--- /dev/null
+++ b/desginPattern/src/com/atguigu/memento/game/Memento.java
@@ -0,0 +1,30 @@
+package com.atguigu.memento.game;
+
+public class Memento {
+
+ //攻击力
+ private int vit;
+ //防御力
+ private int def;
+ public Memento(int vit, int def) {
+ super();
+ this.vit = vit;
+ this.def = def;
+ }
+ public int getVit() {
+ return vit;
+ }
+ public void setVit(int vit) {
+ this.vit = vit;
+ }
+ public int getDef() {
+ return def;
+ }
+ public void setDef(int def) {
+ this.def = def;
+ }
+
+
+
+
+}
diff --git a/desginPattern/src/com/atguigu/memento/game/newfile.cld b/desginPattern/src/com/atguigu/memento/game/newfile.cld
new file mode 100644
index 0000000..a51003e
--- /dev/null
+++ b/desginPattern/src/com/atguigu/memento/game/newfile.cld
@@ -0,0 +1,445 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 409
+ 144
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 399
+ 275
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ memento
+ Memento
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Caretaker
+ false
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 145
+ 150
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 196
+ 45
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Client
+ false
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ createMemento
+ Memento
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ GameRole
+ false
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ vit
+ int
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ def
+ int
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Memento
+ false
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/memento/newfile.cld b/desginPattern/src/com/atguigu/memento/newfile.cld
new file mode 100644
index 0000000..20c88bf
--- /dev/null
+++ b/desginPattern/src/com/atguigu/memento/newfile.cld
@@ -0,0 +1,406 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 262
+ 162
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 494
+ 154
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 434
+ 306
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ mementos: ArrayList<Memento>
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Caretaker
+ false
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 342
+ 67
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Client
+ false
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ state
+ String
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Memento
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ originator
+ false
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/memento/theory/Caretaker.java b/desginPattern/src/com/atguigu/memento/theory/Caretaker.java
new file mode 100644
index 0000000..7034d3f
--- /dev/null
+++ b/desginPattern/src/com/atguigu/memento/theory/Caretaker.java
@@ -0,0 +1,19 @@
+package com.atguigu.memento.theory;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Caretaker {
+
+ //在List 集合中会有很多的备忘录对象
+ private List mementoList = new ArrayList();
+
+ public void add(Memento memento) {
+ mementoList.add(memento);
+ }
+
+ //获取到第index个Originator 的 备忘录对象(即保存状态)
+ public Memento get(int index) {
+ return mementoList.get(index);
+ }
+}
diff --git a/desginPattern/src/com/atguigu/memento/theory/Client.java b/desginPattern/src/com/atguigu/memento/theory/Client.java
new file mode 100644
index 0000000..8bc34c8
--- /dev/null
+++ b/desginPattern/src/com/atguigu/memento/theory/Client.java
@@ -0,0 +1,40 @@
+package com.atguigu.memento.theory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+public class Client {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+
+ Originator originator = new Originator();
+ Caretaker caretaker = new Caretaker();
+
+ originator.setState(" 状态#1 攻击力 100 ");
+
+ //保存了当前的状态
+ caretaker.add(originator.saveStateMemento());
+
+ originator.setState(" 状态#2 攻击力 80 ");
+
+ caretaker.add(originator.saveStateMemento());
+
+ originator.setState(" 状态#3 攻击力 50 ");
+ caretaker.add(originator.saveStateMemento());
+
+
+
+ System.out.println("当前的状态是 =" + originator.getState());
+
+ //希望得到状态 1, 将 originator 恢复到状态1
+
+ originator.getStateFromMemento(caretaker.get(0));
+ System.out.println("恢复到状态1 , 当前的状态是");
+ System.out.println("当前的状态是 =" + originator.getState());
+
+
+
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/memento/theory/Memento.java b/desginPattern/src/com/atguigu/memento/theory/Memento.java
new file mode 100644
index 0000000..709d41a
--- /dev/null
+++ b/desginPattern/src/com/atguigu/memento/theory/Memento.java
@@ -0,0 +1,18 @@
+package com.atguigu.memento.theory;
+
+public class Memento {
+ private String state;
+
+ //构造器
+ public Memento(String state) {
+ super();
+ this.state = state;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+
+
+}
diff --git a/desginPattern/src/com/atguigu/memento/theory/Originator.java b/desginPattern/src/com/atguigu/memento/theory/Originator.java
new file mode 100644
index 0000000..1e4e940
--- /dev/null
+++ b/desginPattern/src/com/atguigu/memento/theory/Originator.java
@@ -0,0 +1,25 @@
+package com.atguigu.memento.theory;
+
+public class Originator {
+
+ private String state;//状态信息
+
+ public String getState() {
+ return state;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ //编写一个方法,可以保存一个状态对象 Memento
+ //因此编写一个方法,返回 Memento
+ public Memento saveStateMemento() {
+ return new Memento(state);
+ }
+
+ //通过备忘录对象,恢复状态
+ public void getStateFromMemento(Memento memento) {
+ state = memento.getState();
+ }
+}
diff --git a/desginPattern/src/com/atguigu/money/AbstractState.java b/desginPattern/src/com/atguigu/money/AbstractState.java
new file mode 100644
index 0000000..a3322d3
--- /dev/null
+++ b/desginPattern/src/com/atguigu/money/AbstractState.java
@@ -0,0 +1,46 @@
+package com.atguigu.money;
+
+public abstract class AbstractState implements State {
+
+ protected static final RuntimeException EXCEPTION = new RuntimeException("操作流程不允许");
+
+ @Override
+ public void checkEvent(Context context) {
+ throw EXCEPTION;
+ }
+
+ @Override
+ public void checkFailEvent(Context context) {
+ throw EXCEPTION;
+ }
+
+ @Override
+ public void makePriceEvent(Context context) {
+ throw EXCEPTION;
+ }
+
+ @Override
+ public void acceptOrderEvent(Context context) {
+ throw EXCEPTION;
+ }
+
+ @Override
+ public void notPeopleAcceptEvent(Context context) {
+ throw EXCEPTION;
+ }
+
+ @Override
+ public void payOrderEvent(Context context) {
+ throw EXCEPTION;
+ }
+
+ @Override
+ public void orderFailureEvent(Context context) {
+ throw EXCEPTION;
+ }
+
+ @Override
+ public void feedBackEvent(Context context) {
+ throw EXCEPTION;
+ }
+}
diff --git a/desginPattern/src/com/atguigu/money/AllState.java b/desginPattern/src/com/atguigu/money/AllState.java
new file mode 100644
index 0000000..7ba1532
--- /dev/null
+++ b/desginPattern/src/com/atguigu/money/AllState.java
@@ -0,0 +1,91 @@
+package com.atguigu.money;
+
+//各种具体状态类
+class FeedBackState extends AbstractState {
+
+ @Override
+ public String getCurrentState() {
+ return StateEnum.FEED_BACKED.getValue();
+ }
+}
+
+class GenerateState extends AbstractState {
+
+ @Override
+ public void checkEvent(Context context) {
+ context.setState(new ReviewState());
+ }
+
+ @Override
+ public void checkFailEvent(Context context) {
+ context.setState(new FeedBackState());
+ }
+
+ @Override
+ public String getCurrentState() {
+ return StateEnum.GENERATE.getValue();
+ }
+}
+
+class NotPayState extends AbstractState {
+
+ @Override
+ public void payOrderEvent(Context context) {
+ context.setState(new PaidState());
+ }
+
+ @Override
+ public void feedBackEvent(Context context) {
+ context.setState(new FeedBackState());
+ }
+
+ @Override
+ public String getCurrentState() {
+ return StateEnum.NOT_PAY.getValue();
+ }
+}
+
+class PaidState extends AbstractState {
+
+ @Override
+ public void feedBackEvent(Context context) {
+ context.setState(new FeedBackState());
+ }
+
+ @Override
+ public String getCurrentState() {
+ return StateEnum.PAID.getValue();
+ }
+}
+
+class PublishState extends AbstractState {
+
+ @Override
+ public void acceptOrderEvent(Context context) {
+ context.setState(new NotPayState());
+ }
+
+ @Override
+ public void notPeopleAcceptEvent(Context context) {
+ context.setState(new FeedBackState());
+ }
+
+ @Override
+ public String getCurrentState() {
+ return StateEnum.PUBLISHED.getValue();
+ }
+}
+
+class ReviewState extends AbstractState {
+
+ @Override
+ public void makePriceEvent(Context context) {
+ context.setState(new PublishState());
+ }
+
+ @Override
+ public String getCurrentState() {
+ return StateEnum.REVIEWED.getValue();
+ }
+
+}
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/money/ClientTest.java b/desginPattern/src/com/atguigu/money/ClientTest.java
new file mode 100644
index 0000000..b6d701d
--- /dev/null
+++ b/desginPattern/src/com/atguigu/money/ClientTest.java
@@ -0,0 +1,27 @@
+package com.atguigu.money;
+
+/**测试类*/
+public class ClientTest {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ Context context = new Context();
+ context.setState(new PublishState());
+ //然后可以根据操作变化状态.
+
+ //publish --> not pay
+ context.acceptOrderEvent(context);
+// //not pay --> paid
+ context.payOrderEvent(context);
+// // 失败, 检测失败时,会抛出异常
+// try {
+// context.checkFailEvent(context);
+// System.out.println("流程正常..");
+// } catch (Exception e) {
+// // TODO: handle exception
+// System.out.println(e.getMessage());
+// }
+
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/money/Context.java b/desginPattern/src/com/atguigu/money/Context.java
new file mode 100644
index 0000000..220bdd5
--- /dev/null
+++ b/desginPattern/src/com/atguigu/money/Context.java
@@ -0,0 +1,68 @@
+package com.atguigu.money;
+
+//环境上下文
+public class Context extends AbstractState{
+ private State state;
+
+ @Override
+ public void checkEvent(Context context) {
+ state.checkEvent(this);
+ getCurrentState();
+ }
+
+ @Override
+ public void checkFailEvent(Context context) {
+ state.checkFailEvent(this);
+ getCurrentState();
+ }
+
+ @Override
+ public void makePriceEvent(Context context) {
+ state.makePriceEvent(this);
+ getCurrentState();
+ }
+
+ @Override
+ public void acceptOrderEvent(Context context) {
+ state.acceptOrderEvent(this);
+ getCurrentState();
+ }
+
+ @Override
+ public void notPeopleAcceptEvent(Context context) {
+ state.notPeopleAcceptEvent(this);
+ getCurrentState();
+ }
+
+ @Override
+ public void payOrderEvent(Context context) {
+ state.payOrderEvent(this);
+ getCurrentState();
+ }
+
+ @Override
+ public void orderFailureEvent(Context context) {
+ state.orderFailureEvent(this);
+ getCurrentState();
+ }
+
+ @Override
+ public void feedBackEvent(Context context) {
+ state.feedBackEvent(this);
+ getCurrentState();
+ }
+
+ public State getState() {
+ return state;
+ }
+
+ public void setState(State state) {
+ this.state = state;
+ }
+
+ @Override
+ public String getCurrentState() {
+ System.out.println("当前状态 : " + state.getCurrentState());
+ return state.getCurrentState();
+ }
+}
diff --git a/desginPattern/src/com/atguigu/money/State.java b/desginPattern/src/com/atguigu/money/State.java
new file mode 100644
index 0000000..8b27ad1
--- /dev/null
+++ b/desginPattern/src/com/atguigu/money/State.java
@@ -0,0 +1,52 @@
+package com.atguigu.money;
+
+/**
+ * 状态接口
+ * @author Administrator
+ *
+ */
+public interface State {
+
+ /**
+ * 电审
+ */
+ void checkEvent(Context context);
+
+ /**
+ * 电审失败
+ */
+ void checkFailEvent(Context context);
+
+ /**
+ * 定价发布
+ */
+ void makePriceEvent(Context context);
+
+ /**
+ * 接单
+ */
+ void acceptOrderEvent(Context context);
+
+ /**
+ * 无人接单失效
+ */
+ void notPeopleAcceptEvent(Context context);
+
+ /**
+ * 付款
+ */
+ void payOrderEvent(Context context);
+
+ /**
+ * 接单有人支付失效
+ */
+ void orderFailureEvent(Context context);
+
+ /**
+ * 反馈
+ */
+ void feedBackEvent(Context context);
+
+
+ String getCurrentState();
+}
diff --git a/desginPattern/src/com/atguigu/money/StateEnum.java b/desginPattern/src/com/atguigu/money/StateEnum.java
new file mode 100644
index 0000000..c95fa1c
--- /dev/null
+++ b/desginPattern/src/com/atguigu/money/StateEnum.java
@@ -0,0 +1,37 @@
+package com.atguigu.money;
+
+/**
+ * 状态枚举类
+ * @author Administrator
+ *
+ */
+public enum StateEnum {
+
+ //订单生成
+ GENERATE(1, "GENERATE"),
+
+ //已审核
+ REVIEWED(2, "REVIEWED"),
+
+ //已发布
+ PUBLISHED(3, "PUBLISHED"),
+
+ //待付款
+ NOT_PAY(4, "NOT_PAY"),
+
+ //已付款
+ PAID(5, "PAID"),
+
+ //已完结
+ FEED_BACKED(6, "FEED_BACKED");
+
+ private int key;
+ private String value;
+
+ StateEnum(int key, String value) {
+ this.key = key;
+ this.value = value;
+ }
+ public int getKey() {return key;}
+ public String getValue() {return value;}
+}
diff --git a/desginPattern/src/com/atguigu/money/newfile.cld b/desginPattern/src/com/atguigu/money/newfile.cld
new file mode 100644
index 0000000..26a168b
--- /dev/null
+++ b/desginPattern/src/com/atguigu/money/newfile.cld
@@ -0,0 +1,1303 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 572
+ 349
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 452
+ 451
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ StateEnum
+ false
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 192
+ 348
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 428
+ 9
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ checkEvent
+ void
+
+
+ context
+ Context
+
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ checkFailEvent
+ void
+
+
+ context
+ Context
+
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ makePriceEvent
+ void
+
+
+ context
+ Context
+
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ acceptOrderEvent
+ void
+
+
+ context
+ Context
+
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ notPeopleAcceptEvent
+ void
+
+
+ context
+ Context
+
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ payOrderEvent
+ void
+
+
+ context
+ Context
+
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ orderFailureEvent
+ void
+
+
+ context
+ Context
+
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ feedBackEvent
+ void
+
+
+ context
+ Context
+
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ getCurrentState
+ String
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+
+ com.atguigu.money.State
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Context
+ false
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 667
+ 254
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ acceptOrderEvent
+ void
+
+
+ context
+ Context
+
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ getCurrentState
+ String
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ PublishState
+ false
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 142
+ 198
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Client
+ false
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ GenerateState
+ false
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 379
+ 346
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ FeedBackState
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 448
+ 111
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ void checkEvent
+ void
+
+
+ Context context
+ int
+
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+
+ State
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 487
+ 254
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ AbstractState
+ false
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/money/newfile2.cld b/desginPattern/src/com/atguigu/money/newfile2.cld
new file mode 100644
index 0000000..2f26d9b
--- /dev/null
+++ b/desginPattern/src/com/atguigu/money/newfile2.cld
@@ -0,0 +1,628 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 366
+ 45
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 351
+ 309
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ EXCEPTION
+ RuntimeException
+ true
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ checkEvent
+ void
+
+
+ context
+ Context
+
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ checkFailEvent
+ void
+
+
+ context
+ Context
+
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ makePriceEvent
+ void
+
+
+ context
+ Context
+
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ acceptOrderEvent
+ void
+
+
+ context
+ Context
+
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ notPeopleAcceptEvent
+ void
+
+
+ context
+ Context
+
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ payOrderEvent
+ void
+
+
+ context
+ Context
+
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ orderFailureEvent
+ void
+
+
+ context
+ Context
+
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ feedBackEvent
+ void
+
+
+ context
+ Context
+
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ com.atguigu.money.AbstractState
+ false
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ checkEvent
+ void
+
+
+ context
+ Context
+
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ checkFailEvent
+ void
+
+
+ context
+ Context
+
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ makePriceEvent
+ void
+
+
+ context
+ Context
+
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ acceptOrderEvent
+ void
+
+
+ context
+ Context
+
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ notPeopleAcceptEvent
+ void
+
+
+ context
+ Context
+
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ payOrderEvent
+ void
+
+
+ context
+ Context
+
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ orderFailureEvent
+ void
+
+
+ context
+ Context
+
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ feedBackEvent
+ void
+
+
+ context
+ Context
+
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ getCurrentState
+ String
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+
+ com.atguigu.money.State
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/observer/Client.java b/desginPattern/src/com/atguigu/observer/Client.java
new file mode 100644
index 0000000..ab259ac
--- /dev/null
+++ b/desginPattern/src/com/atguigu/observer/Client.java
@@ -0,0 +1,19 @@
+package com.atguigu.observer;
+
+public class Client {
+ public static void main(String[] args) {
+ //创建接入方 currentConditions
+ CurrentConditions currentConditions = new CurrentConditions();
+ //创建 WeatherData 并将 接入方 currentConditions 传递到 WeatherData中
+ WeatherData weatherData = new WeatherData(currentConditions);
+
+ //更新天气情况
+ weatherData.setData(30, 150, 40);
+
+ //天气情况变化
+ System.out.println("============天气情况变化=============");
+ weatherData.setData(40, 160, 20);
+
+
+ }
+}
diff --git a/desginPattern/src/com/atguigu/observer/CurrentConditions.java b/desginPattern/src/com/atguigu/observer/CurrentConditions.java
new file mode 100644
index 0000000..f8767ad
--- /dev/null
+++ b/desginPattern/src/com/atguigu/observer/CurrentConditions.java
@@ -0,0 +1,28 @@
+package com.atguigu.observer;
+
+/**
+ * 显示当前天气情况(可以理解成是气象站自己的网站)
+ * @author Administrator
+ *
+ */
+public class CurrentConditions {
+ // 温度,气压,湿度
+ private float temperature;
+ private float pressure;
+ private float humidity;
+
+ //更新 天气情况,是由 WeatherData 来调用,我使用推送模式
+ public void update(float temperature, float pressure, float humidity) {
+ this.temperature = temperature;
+ this.pressure = pressure;
+ this.humidity = humidity;
+ display();
+ }
+
+ //显示
+ public void display() {
+ System.out.println("***Today mTemperature: " + temperature + "***");
+ System.out.println("***Today mPressure: " + pressure + "***");
+ System.out.println("***Today mHumidity: " + humidity + "***");
+ }
+}
diff --git a/desginPattern/src/com/atguigu/observer/WeatherData.java b/desginPattern/src/com/atguigu/observer/WeatherData.java
new file mode 100644
index 0000000..8b59168
--- /dev/null
+++ b/desginPattern/src/com/atguigu/observer/WeatherData.java
@@ -0,0 +1,47 @@
+package com.atguigu.observer;
+
+/**
+ * 类是核心
+ * 1. 包含最新的天气情况信息
+ * 2. 含有 CurrentConditions 对象
+ * 3. 当数据有更新时,就主动的调用 CurrentConditions对象update方法(含 display), 这样他们(接入方)就看到最新的信息
+ * @author Administrator
+ *
+ */
+public class WeatherData {
+ private float temperatrue;
+ private float pressure;
+ private float humidity;
+ private CurrentConditions currentConditions;
+ //加入新的第三方
+
+ public WeatherData(CurrentConditions currentConditions) {
+ this.currentConditions = currentConditions;
+ }
+
+ public float getTemperature() {
+ return temperatrue;
+ }
+
+ public float getPressure() {
+ return pressure;
+ }
+
+ public float getHumidity() {
+ return humidity;
+ }
+
+ public void dataChange() {
+ //调用 接入方的 update
+ currentConditions.update(getTemperature(), getPressure(), getHumidity());
+ }
+
+ //当数据有更新时,就调用 setData
+ public void setData(float temperature, float pressure, float humidity) {
+ this.temperatrue = temperature;
+ this.pressure = pressure;
+ this.humidity = humidity;
+ //调用dataChange, 将最新的信息 推送给 接入方 currentConditions
+ dataChange();
+ }
+}
diff --git a/desginPattern/src/com/atguigu/observer/improve/BaiduSite.java b/desginPattern/src/com/atguigu/observer/improve/BaiduSite.java
new file mode 100644
index 0000000..33641ef
--- /dev/null
+++ b/desginPattern/src/com/atguigu/observer/improve/BaiduSite.java
@@ -0,0 +1,26 @@
+package com.atguigu.observer.improve;
+
+public class BaiduSite implements Observer {
+
+ // 温度,气压,湿度
+ private float temperature;
+ private float pressure;
+ private float humidity;
+
+ // 更新 天气情况,是由 WeatherData 来调用,我使用推送模式
+ public void update(float temperature, float pressure, float humidity) {
+ this.temperature = temperature;
+ this.pressure = pressure;
+ this.humidity = humidity;
+ display();
+ }
+
+ // 显示
+ public void display() {
+ System.out.println("===百度网站====");
+ System.out.println("***百度网站 气温 : " + temperature + "***");
+ System.out.println("***百度网站 气压: " + pressure + "***");
+ System.out.println("***百度网站 湿度: " + humidity + "***");
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/observer/improve/Client.java b/desginPattern/src/com/atguigu/observer/improve/Client.java
new file mode 100644
index 0000000..37b2f0e
--- /dev/null
+++ b/desginPattern/src/com/atguigu/observer/improve/Client.java
@@ -0,0 +1,30 @@
+package com.atguigu.observer.improve;
+
+public class Client {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ //创建一个WeatherData
+ WeatherData weatherData = new WeatherData();
+
+ //创建观察者
+ CurrentConditions currentConditions = new CurrentConditions();
+ BaiduSite baiduSite = new BaiduSite();
+
+ //注册到weatherData
+ weatherData.registerObserver(currentConditions);
+ weatherData.registerObserver(baiduSite);
+
+ //测试
+ System.out.println("通知各个注册的观察者, 看看信息");
+ weatherData.setData(10f, 100f, 30.3f);
+
+
+ weatherData.removeObserver(currentConditions);
+ //测试
+ System.out.println();
+ System.out.println("通知各个注册的观察者, 看看信息");
+ weatherData.setData(10f, 100f, 30.3f);
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/observer/improve/CurrentConditions.java b/desginPattern/src/com/atguigu/observer/improve/CurrentConditions.java
new file mode 100644
index 0000000..8ed3c3e
--- /dev/null
+++ b/desginPattern/src/com/atguigu/observer/improve/CurrentConditions.java
@@ -0,0 +1,24 @@
+package com.atguigu.observer.improve;
+
+public class CurrentConditions implements Observer {
+
+ // 温度,气压,湿度
+ private float temperature;
+ private float pressure;
+ private float humidity;
+
+ // 更新 天气情况,是由 WeatherData 来调用,我使用推送模式
+ public void update(float temperature, float pressure, float humidity) {
+ this.temperature = temperature;
+ this.pressure = pressure;
+ this.humidity = humidity;
+ display();
+ }
+
+ // 显示
+ public void display() {
+ System.out.println("***Today mTemperature: " + temperature + "***");
+ System.out.println("***Today mPressure: " + pressure + "***");
+ System.out.println("***Today mHumidity: " + humidity + "***");
+ }
+}
diff --git a/desginPattern/src/com/atguigu/observer/improve/Observer.java b/desginPattern/src/com/atguigu/observer/improve/Observer.java
new file mode 100644
index 0000000..e28b5ef
--- /dev/null
+++ b/desginPattern/src/com/atguigu/observer/improve/Observer.java
@@ -0,0 +1,7 @@
+package com.atguigu.observer.improve;
+
+//观察者接口,有观察者来实现
+public interface Observer {
+
+ public void update(float temperature, float pressure, float humidity);
+}
diff --git a/desginPattern/src/com/atguigu/observer/improve/Subject.java b/desginPattern/src/com/atguigu/observer/improve/Subject.java
new file mode 100644
index 0000000..73f44c5
--- /dev/null
+++ b/desginPattern/src/com/atguigu/observer/improve/Subject.java
@@ -0,0 +1,9 @@
+package com.atguigu.observer.improve;
+
+//接口, 让WeatherData 来实现
+public interface Subject {
+
+ public void registerObserver(Observer o);
+ public void removeObserver(Observer o);
+ public void notifyObservers();
+}
diff --git a/desginPattern/src/com/atguigu/observer/improve/WeatherData.java b/desginPattern/src/com/atguigu/observer/improve/WeatherData.java
new file mode 100644
index 0000000..65b6ba3
--- /dev/null
+++ b/desginPattern/src/com/atguigu/observer/improve/WeatherData.java
@@ -0,0 +1,77 @@
+package com.atguigu.observer.improve;
+
+import java.util.ArrayList;
+
+/**
+ * 类是核心
+ * 1. 包含最新的天气情况信息
+ * 2. 含有 观察者集合,使用ArrayList管理
+ * 3. 当数据有更新时,就主动的调用 ArrayList, 通知所有的(接入方)就看到最新的信息
+ * @author Administrator
+ *
+ */
+public class WeatherData implements Subject {
+ private float temperatrue;
+ private float pressure;
+ private float humidity;
+ //观察者集合
+ private ArrayList observers;
+
+ //加入新的第三方
+
+ public WeatherData() {
+ observers = new ArrayList();
+ }
+
+ public float getTemperature() {
+ return temperatrue;
+ }
+
+ public float getPressure() {
+ return pressure;
+ }
+
+ public float getHumidity() {
+ return humidity;
+ }
+
+ public void dataChange() {
+ //调用 接入方的 update
+
+ notifyObservers();
+ }
+
+ //当数据有更新时,就调用 setData
+ public void setData(float temperature, float pressure, float humidity) {
+ this.temperatrue = temperature;
+ this.pressure = pressure;
+ this.humidity = humidity;
+ //调用dataChange, 将最新的信息 推送给 接入方 currentConditions
+ dataChange();
+ }
+
+ //注册一个观察者
+ @Override
+ public void registerObserver(Observer o) {
+ // TODO Auto-generated method stub
+ observers.add(o);
+ }
+
+ //移除一个观察者
+ @Override
+ public void removeObserver(Observer o) {
+ // TODO Auto-generated method stub
+ if(observers.contains(o)) {
+ observers.remove(o);
+ }
+ }
+
+ //遍历所有的观察者,并通知
+ @Override
+ public void notifyObservers() {
+ // TODO Auto-generated method stub
+ for(int i = 0; i < observers.size(); i++) {
+ observers.get(i).update(this.temperatrue, this.pressure, this.humidity);
+ }
+ }
+}
diff --git a/desginPattern/src/com/atguigu/observer/improve/newfile.cld b/desginPattern/src/com/atguigu/observer/improve/newfile.cld
new file mode 100644
index 0000000..58ce693
--- /dev/null
+++ b/desginPattern/src/com/atguigu/observer/improve/newfile.cld
@@ -0,0 +1,778 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 67
+ 103
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 454
+ 102
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 102
+ 297
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ 60
+ 187
+ 113
+ 393
+
+
+
+
+
+
+
+ 鏍稿績绫
+1. 澶╂皵淇℃伅
+2. 绠$悊瑙傚療鑰匫bservers
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ observers
+ ArrayList
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ WeatherData
+ false
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 334
+ 314
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ CurrentCondition
+ false
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 493
+ 305
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Baidu
+ false
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 586
+ 302
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Sina
+ false
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 296
+ 16
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Client
+ false
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ update
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+
+ Observer
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ registerObserver
+ void
+
+
+ o
+ Observer
+
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ remove
+ void
+
+
+ o
+ Observer
+
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ notifyObservers
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+
+ Subject
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/principle/composite/newfile.cld b/desginPattern/src/com/atguigu/principle/composite/newfile.cld
new file mode 100644
index 0000000..621d3bc
--- /dev/null
+++ b/desginPattern/src/com/atguigu/principle/composite/newfile.cld
@@ -0,0 +1,27 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/principle/demeter/Demeter1.java b/desginPattern/src/com/atguigu/principle/demeter/Demeter1.java
new file mode 100644
index 0000000..f7b6de2
--- /dev/null
+++ b/desginPattern/src/com/atguigu/principle/demeter/Demeter1.java
@@ -0,0 +1,100 @@
+package com.atguigu.principle.demeter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+//客户端
+public class Demeter1 {
+
+ public static void main(String[] args) {
+ //创建了一个 SchoolManager 对象
+ SchoolManager schoolManager = new SchoolManager();
+ //输出学院的员工id 和 学校总部的员工信息
+ schoolManager.printAllEmployee(new CollegeManager());
+
+ }
+
+}
+
+
+//学校总部员工类
+class Employee {
+ private String id;
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getId() {
+ return id;
+ }
+}
+
+
+//学院的员工类
+class CollegeEmployee {
+ private String id;
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getId() {
+ return id;
+ }
+}
+
+
+//管理学院员工的管理类
+class CollegeManager {
+ //返回学院的所有员工
+ public List getAllEmployee() {
+ List list = new ArrayList();
+ for (int i = 0; i < 10; i++) { //这里我们增加了10个员工到 list
+ CollegeEmployee emp = new CollegeEmployee();
+ emp.setId("学院员工id= " + i);
+ list.add(emp);
+ }
+ return list;
+ }
+}
+
+//学校管理类
+
+//分析 SchoolManager 类的直接朋友类有哪些 Employee、CollegeManager
+//CollegeEmployee 不是 直接朋友 而是一个陌生类,这样违背了 迪米特法则
+class SchoolManager {
+ //返回学校总部的员工
+ public List getAllEmployee() {
+ List list = new ArrayList();
+
+ for (int i = 0; i < 5; i++) { //这里我们增加了5个员工到 list
+ Employee emp = new Employee();
+ emp.setId("学校总部员工id= " + i);
+ list.add(emp);
+ }
+ return list;
+ }
+
+ //该方法完成输出学校总部和学院员工信息(id)
+ void printAllEmployee(CollegeManager sub) {
+
+ //分析问题
+ //1. 这里的 CollegeEmployee 不是 SchoolManager的直接朋友
+ //2. CollegeEmployee 是以局部变量方式出现在 SchoolManager
+ //3. 违反了 迪米特法则
+
+ //获取到学院员工
+ List list1 = sub.getAllEmployee();
+ System.out.println("------------学院员工------------");
+ for (CollegeEmployee e : list1) {
+ System.out.println(e.getId());
+ }
+ //获取到学校总部员工
+ List list2 = this.getAllEmployee();
+ System.out.println("------------学校总部员工------------");
+ for (Employee e : list2) {
+ System.out.println(e.getId());
+ }
+ }
+}
diff --git a/desginPattern/src/com/atguigu/principle/demeter/improve/Demeter1.java b/desginPattern/src/com/atguigu/principle/demeter/improve/Demeter1.java
new file mode 100644
index 0000000..8ed61b0
--- /dev/null
+++ b/desginPattern/src/com/atguigu/principle/demeter/improve/Demeter1.java
@@ -0,0 +1,104 @@
+package com.atguigu.principle.demeter.improve;
+
+import java.util.ArrayList;
+import java.util.List;
+
+//客户端
+public class Demeter1 {
+
+ public static void main(String[] args) {
+ System.out.println("~~~使用迪米特法则的改进~~~");
+ //创建了一个 SchoolManager 对象
+ SchoolManager schoolManager = new SchoolManager();
+ //输出学院的员工id 和 学校总部的员工信息
+ schoolManager.printAllEmployee(new CollegeManager());
+
+ }
+
+}
+
+
+//学校总部员工类
+class Employee {
+ private String id;
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getId() {
+ return id;
+ }
+}
+
+
+//学院的员工类
+class CollegeEmployee {
+ private String id;
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getId() {
+ return id;
+ }
+}
+
+
+//管理学院员工的管理类
+class CollegeManager {
+ //返回学院的所有员工
+ public List getAllEmployee() {
+ List list = new ArrayList();
+ for (int i = 0; i < 10; i++) { //这里我们增加了10个员工到 list
+ CollegeEmployee emp = new CollegeEmployee();
+ emp.setId("学院员工id= " + i);
+ list.add(emp);
+ }
+ return list;
+ }
+
+ //输出学院员工的信息
+ public void printEmployee() {
+ //获取到学院员工
+ List list1 = getAllEmployee();
+ System.out.println("------------学院员工------------");
+ for (CollegeEmployee e : list1) {
+ System.out.println(e.getId());
+ }
+ }
+}
+
+//学校管理类
+
+//分析 SchoolManager 类的直接朋友类有哪些 Employee、CollegeManager
+//CollegeEmployee 不是 直接朋友 而是一个陌生类,这样违背了 迪米特法则
+class SchoolManager {
+ //返回学校总部的员工
+ public List getAllEmployee() {
+ List list = new ArrayList();
+
+ for (int i = 0; i < 5; i++) { //这里我们增加了5个员工到 list
+ Employee emp = new Employee();
+ emp.setId("学校总部员工id= " + i);
+ list.add(emp);
+ }
+ return list;
+ }
+
+ //该方法完成输出学校总部和学院员工信息(id)
+ void printAllEmployee(CollegeManager sub) {
+
+ //分析问题
+ //1. 将输出学院的员工方法,封装到CollegeManager
+ sub.printEmployee();
+
+ //获取到学校总部员工
+ List list2 = this.getAllEmployee();
+ System.out.println("------------学校总部员工------------");
+ for (Employee e : list2) {
+ System.out.println(e.getId());
+ }
+ }
+}
diff --git a/desginPattern/src/com/atguigu/principle/inversion/DependecyInversion.java b/desginPattern/src/com/atguigu/principle/inversion/DependecyInversion.java
new file mode 100644
index 0000000..81cbe25
--- /dev/null
+++ b/desginPattern/src/com/atguigu/principle/inversion/DependecyInversion.java
@@ -0,0 +1,29 @@
+package com.atguigu.principle.inversion;
+
+public class DependecyInversion {
+
+ public static void main(String[] args) {
+ Person person = new Person();
+ person.receive(new Email());
+ }
+
+}
+
+
+class Email {
+ public String getInfo() {
+ return "电子邮件信息: hello,world";
+ }
+}
+
+//完成Person接收消息的功能
+//方式1分析
+//1. 简单,比较容易想到
+//2. 如果我们获取的对象是 微信,短信等等,则新增类,同时Perons也要增加相应的接收方法
+//3. 解决思路:引入一个抽象的接口IReceiver, 表示接收者, 这样Person类与接口IReceiver发生依赖
+// 因为Email, WeiXin 等等属于接收的范围,他们各自实现IReceiver 接口就ok, 这样我们就符号依赖倒转原则
+class Person {
+ public void receive(Email email ) {
+ System.out.println(email.getInfo());
+ }
+}
diff --git a/desginPattern/src/com/atguigu/principle/inversion/improve/DependecyInversion.java b/desginPattern/src/com/atguigu/principle/inversion/improve/DependecyInversion.java
new file mode 100644
index 0000000..9576385
--- /dev/null
+++ b/desginPattern/src/com/atguigu/principle/inversion/improve/DependecyInversion.java
@@ -0,0 +1,39 @@
+package com.atguigu.principle.inversion.improve;
+
+public class DependecyInversion {
+
+ public static void main(String[] args) {
+ //客户端无需改变
+ Person person = new Person();
+ person.receive(new Email());
+
+ person.receive(new WeiXin());
+ }
+
+}
+
+//定义接口
+interface IReceiver {
+ public String getInfo();
+}
+
+class Email implements IReceiver {
+ public String getInfo() {
+ return "电子邮件信息: hello,world";
+ }
+}
+
+//增加微信
+class WeiXin implements IReceiver {
+ public String getInfo() {
+ return "微信信息: hello,ok";
+ }
+}
+
+//方式2
+class Person {
+ //这里我们是对接口的依赖
+ public void receive(IReceiver receiver ) {
+ System.out.println(receiver.getInfo());
+ }
+}
diff --git a/desginPattern/src/com/atguigu/principle/inversion/improve/DependencyPass.java b/desginPattern/src/com/atguigu/principle/inversion/improve/DependencyPass.java
new file mode 100644
index 0000000..c92014f
--- /dev/null
+++ b/desginPattern/src/com/atguigu/principle/inversion/improve/DependencyPass.java
@@ -0,0 +1,98 @@
+package com.atguigu.principle.inversion.improve;
+
+public class DependencyPass {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ ChangHong changHong = new ChangHong();
+// OpenAndClose openAndClose = new OpenAndClose();
+// openAndClose.open(changHong);
+
+ //通过构造器进行依赖传递
+// OpenAndClose openAndClose = new OpenAndClose(changHong);
+// openAndClose.open();
+ //通过setter方法进行依赖传递
+ OpenAndClose openAndClose = new OpenAndClose();
+ openAndClose.setTv(changHong);
+ openAndClose.open();
+
+ }
+
+}
+
+// 方式1: 通过接口传递实现依赖
+// 开关的接口
+// interface IOpenAndClose {
+// public void open(ITV tv); //抽象方法,接收接口
+// }
+//
+// interface ITV { //ITV接口
+// public void play();
+// }
+//
+// class ChangHong implements ITV {
+//
+// @Override
+// public void play() {
+// // TODO Auto-generated method stub
+// System.out.println("长虹电视机,打开");
+// }
+//
+// }
+//// 实现接口
+// class OpenAndClose implements IOpenAndClose{
+// public void open(ITV tv){
+// tv.play();
+// }
+// }
+
+// 方式2: 通过构造方法依赖传递
+// interface IOpenAndClose {
+// public void open(); //抽象方法
+// }
+// interface ITV { //ITV接口
+// public void play();
+// }
+// class OpenAndClose implements IOpenAndClose{
+// public ITV tv; //成员
+// public OpenAndClose(ITV tv){ //构造器
+// this.tv = tv;
+// }
+// public void open(){
+// this.tv.play();
+// }
+// }
+
+
+// 方式3 , 通过setter方法传递
+interface IOpenAndClose {
+ public void open(); // 抽象方法
+
+ public void setTv(ITV tv);
+}
+
+interface ITV { // ITV接口
+ public void play();
+}
+
+class OpenAndClose implements IOpenAndClose {
+ private ITV tv;
+
+ public void setTv(ITV tv) {
+ this.tv = tv;
+ }
+
+ public void open() {
+ this.tv.play();
+ }
+}
+
+class ChangHong implements ITV {
+
+ @Override
+ public void play() {
+ // TODO Auto-generated method stub
+ System.out.println("长虹电视机,打开");
+ }
+
+}
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/principle/liskov/Liskov.java b/desginPattern/src/com/atguigu/principle/liskov/Liskov.java
new file mode 100644
index 0000000..87e15b7
--- /dev/null
+++ b/desginPattern/src/com/atguigu/principle/liskov/Liskov.java
@@ -0,0 +1,42 @@
+package com.atguigu.principle.liskov;
+
+public class Liskov {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ A a = new A();
+ System.out.println("11-3=" + a.func1(11, 3));
+ System.out.println("1-8=" + a.func1(1, 8));
+
+ System.out.println("-----------------------");
+ B b = new B();
+ System.out.println("11-3=" + b.func1(11, 3));//这里本意是求出11-3
+ System.out.println("1-8=" + b.func1(1, 8));// 1-8
+ System.out.println("11+3+9=" + b.func2(11, 3));
+
+
+
+ }
+
+}
+
+// A类
+class A {
+ // 返回两个数的差
+ public int func1(int num1, int num2) {
+ return num1 - num2;
+ }
+}
+
+// B类继承了A
+// 增加了一个新功能:完成两个数相加,然后和9求和
+class B extends A {
+ //这里,重写了A类的方法, 可能是无意识
+ public int func1(int a, int b) {
+ return a + b;
+ }
+
+ public int func2(int a, int b) {
+ return func1(a, b) + 9;
+ }
+}
diff --git a/desginPattern/src/com/atguigu/principle/liskov/improve/Liskov.java b/desginPattern/src/com/atguigu/principle/liskov/improve/Liskov.java
new file mode 100644
index 0000000..3f863c9
--- /dev/null
+++ b/desginPattern/src/com/atguigu/principle/liskov/improve/Liskov.java
@@ -0,0 +1,60 @@
+package com.atguigu.principle.liskov.improve;
+
+public class Liskov {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ A a = new A();
+ System.out.println("11-3=" + a.func1(11, 3));
+ System.out.println("1-8=" + a.func1(1, 8));
+
+ System.out.println("-----------------------");
+ B b = new B();
+ //因为B类不再继承A类,因此调用者,不会再func1是求减法
+ //调用完成的功能就会很明确
+ System.out.println("11+3=" + b.func1(11, 3));//这里本意是求出11+3
+ System.out.println("1+8=" + b.func1(1, 8));// 1+8
+ System.out.println("11+3+9=" + b.func2(11, 3));
+
+
+ //使用组合仍然可以使用到A类相关方法
+ System.out.println("11-3=" + b.func3(11, 3));// 这里本意是求出11-3
+
+
+ }
+
+}
+
+//创建一个更加基础的基类
+class Base {
+ //把更加基础的方法和成员写到Base类
+}
+
+// A类
+class A extends Base {
+ // 返回两个数的差
+ public int func1(int num1, int num2) {
+ return num1 - num2;
+ }
+}
+
+// B类继承了A
+// 增加了一个新功能:完成两个数相加,然后和9求和
+class B extends Base {
+ //如果B需要使用A类的方法,使用组合关系
+ private A a = new A();
+
+ //这里,重写了A类的方法, 可能是无意识
+ public int func1(int a, int b) {
+ return a + b;
+ }
+
+ public int func2(int a, int b) {
+ return func1(a, b) + 9;
+ }
+
+ //我们仍然想使用A的方法
+ public int func3(int a, int b) {
+ return this.a.func1(a, b);
+ }
+}
diff --git a/desginPattern/src/com/atguigu/principle/liskov/newfile.cld b/desginPattern/src/com/atguigu/principle/liskov/newfile.cld
new file mode 100644
index 0000000..e3f767d
--- /dev/null
+++ b/desginPattern/src/com/atguigu/principle/liskov/newfile.cld
@@ -0,0 +1,278 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 221
+ 84
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 314
+ 190
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 139
+ 192
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ B
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ A
+ false
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Base
+ false
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/principle/ocp/Ocp.java b/desginPattern/src/com/atguigu/principle/ocp/Ocp.java
new file mode 100644
index 0000000..2b83898
--- /dev/null
+++ b/desginPattern/src/com/atguigu/principle/ocp/Ocp.java
@@ -0,0 +1,65 @@
+package com.atguigu.principle.ocp;
+
+public class Ocp {
+
+ public static void main(String[] args) {
+ //使用看看存在的问题
+ GraphicEditor graphicEditor = new GraphicEditor();
+ graphicEditor.drawShape(new Rectangle());
+ graphicEditor.drawShape(new Circle());
+ graphicEditor.drawShape(new Triangle());
+ }
+
+}
+
+//这是一个用于绘图的类 [使用方]
+class GraphicEditor {
+ //接收Shape对象,然后根据type,来绘制不同的图形
+ public void drawShape(Shape s) {
+ if (s.m_type == 1)
+ drawRectangle(s);
+ else if (s.m_type == 2)
+ drawCircle(s);
+ else if (s.m_type == 3)
+ drawTriangle(s);
+ }
+
+ //绘制矩形
+ public void drawRectangle(Shape r) {
+ System.out.println(" 绘制矩形 ");
+ }
+
+ //绘制圆形
+ public void drawCircle(Shape r) {
+ System.out.println(" 绘制圆形 ");
+ }
+
+ //绘制三角形
+ public void drawTriangle(Shape r) {
+ System.out.println(" 绘制三角形 ");
+ }
+}
+
+//Shape类,基类
+class Shape {
+ int m_type;
+}
+
+class Rectangle extends Shape {
+ Rectangle() {
+ super.m_type = 1;
+ }
+}
+
+class Circle extends Shape {
+ Circle() {
+ super.m_type = 2;
+ }
+}
+
+//新增画三角形
+class Triangle extends Shape {
+ Triangle() {
+ super.m_type = 3;
+ }
+}
diff --git a/desginPattern/src/com/atguigu/principle/ocp/improve/Ocp.java b/desginPattern/src/com/atguigu/principle/ocp/improve/Ocp.java
new file mode 100644
index 0000000..f92ca4c
--- /dev/null
+++ b/desginPattern/src/com/atguigu/principle/ocp/improve/Ocp.java
@@ -0,0 +1,79 @@
+package com.atguigu.principle.ocp.improve;
+
+public class Ocp {
+
+ public static void main(String[] args) {
+ //使用看看存在的问题
+ GraphicEditor graphicEditor = new GraphicEditor();
+ graphicEditor.drawShape(new Rectangle());
+ graphicEditor.drawShape(new Circle());
+ graphicEditor.drawShape(new Triangle());
+ graphicEditor.drawShape(new OtherGraphic());
+ }
+
+}
+
+//这是一个用于绘图的类 [使用方]
+class GraphicEditor {
+ //接收Shape对象,调用draw方法
+ public void drawShape(Shape s) {
+ s.draw();
+ }
+
+
+}
+
+//Shape类,基类
+abstract class Shape {
+ int m_type;
+
+ public abstract void draw();//抽象方法
+}
+
+class Rectangle extends Shape {
+ Rectangle() {
+ super.m_type = 1;
+ }
+
+ @Override
+ public void draw() {
+ // TODO Auto-generated method stub
+ System.out.println(" 绘制矩形 ");
+ }
+}
+
+class Circle extends Shape {
+ Circle() {
+ super.m_type = 2;
+ }
+ @Override
+ public void draw() {
+ // TODO Auto-generated method stub
+ System.out.println(" 绘制圆形 ");
+ }
+}
+
+//新增画三角形
+class Triangle extends Shape {
+ Triangle() {
+ super.m_type = 3;
+ }
+ @Override
+ public void draw() {
+ // TODO Auto-generated method stub
+ System.out.println(" 绘制三角形 ");
+ }
+}
+
+//新增一个图形
+class OtherGraphic extends Shape {
+ OtherGraphic() {
+ super.m_type = 4;
+ }
+
+ @Override
+ public void draw() {
+ // TODO Auto-generated method stub
+ System.out.println(" 绘制其它图形 ");
+ }
+}
diff --git a/desginPattern/src/com/atguigu/principle/segregation/Segregation1.java b/desginPattern/src/com/atguigu/principle/segregation/Segregation1.java
new file mode 100644
index 0000000..d9146e2
--- /dev/null
+++ b/desginPattern/src/com/atguigu/principle/segregation/Segregation1.java
@@ -0,0 +1,81 @@
+package com.atguigu.principle.segregation;
+
+public class Segregation1 {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
+
+//接口
+interface Interface1 {
+ void operation1();
+ void operation2();
+ void operation3();
+ void operation4();
+ void operation5();
+}
+
+class B implements Interface1 {
+ public void operation1() {
+ System.out.println("B 实现了 operation1");
+ }
+
+ public void operation2() {
+ System.out.println("B 实现了 operation2");
+ }
+ public void operation3() {
+ System.out.println("B 实现了 operation3");
+ }
+ public void operation4() {
+ System.out.println("B 实现了 operation4");
+ }
+ public void operation5() {
+ System.out.println("B 实现了 operation5");
+ }
+}
+
+class D implements Interface1 {
+ public void operation1() {
+ System.out.println("D 实现了 operation1");
+ }
+
+ public void operation2() {
+ System.out.println("D 实现了 operation2");
+ }
+ public void operation3() {
+ System.out.println("D 实现了 operation3");
+ }
+ public void operation4() {
+ System.out.println("D 实现了 operation4");
+ }
+ public void operation5() {
+ System.out.println("D 实现了 operation5");
+ }
+}
+
+class A { //A 类通过接口Interface1 依赖(使用) B类,但是只会用到1,2,3方法
+ public void depend1(Interface1 i) {
+ i.operation1();
+ }
+ public void depend2(Interface1 i) {
+ i.operation2();
+ }
+ public void depend3(Interface1 i) {
+ i.operation3();
+ }
+}
+
+class C { //C 类通过接口Interface1 依赖(使用) D类,但是只会用到1,4,5方法
+ public void depend1(Interface1 i) {
+ i.operation1();
+ }
+ public void depend4(Interface1 i) {
+ i.operation4();
+ }
+ public void depend5(Interface1 i) {
+ i.operation5();
+ }
+}
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/principle/segregation/improve/Segregation1.java b/desginPattern/src/com/atguigu/principle/segregation/improve/Segregation1.java
new file mode 100644
index 0000000..600bc6b
--- /dev/null
+++ b/desginPattern/src/com/atguigu/principle/segregation/improve/Segregation1.java
@@ -0,0 +1,98 @@
+package com.atguigu.principle.segregation.improve;
+
+public class Segregation1 {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ // 使用一把
+ A a = new A();
+ a.depend1(new B()); // A类通过接口去依赖B类
+ a.depend2(new B());
+ a.depend3(new B());
+
+ C c = new C();
+
+ c.depend1(new D()); // C类通过接口去依赖(使用)D类
+ c.depend4(new D());
+ c.depend5(new D());
+
+ }
+
+}
+
+// 接口1
+interface Interface1 {
+ void operation1();
+
+}
+
+// 接口2
+interface Interface2 {
+ void operation2();
+
+ void operation3();
+}
+
+// 接口3
+interface Interface3 {
+ void operation4();
+
+ void operation5();
+}
+
+class B implements Interface1, Interface2 {
+ public void operation1() {
+ System.out.println("B 实现了 operation1");
+ }
+
+ public void operation2() {
+ System.out.println("B 实现了 operation2");
+ }
+
+ public void operation3() {
+ System.out.println("B 实现了 operation3");
+ }
+
+}
+
+class D implements Interface1, Interface3 {
+ public void operation1() {
+ System.out.println("D 实现了 operation1");
+ }
+
+ public void operation4() {
+ System.out.println("D 实现了 operation4");
+ }
+
+ public void operation5() {
+ System.out.println("D 实现了 operation5");
+ }
+}
+
+class A { // A 类通过接口Interface1,Interface2 依赖(使用) B类,但是只会用到1,2,3方法
+ public void depend1(Interface1 i) {
+ i.operation1();
+ }
+
+ public void depend2(Interface2 i) {
+ i.operation2();
+ }
+
+ public void depend3(Interface2 i) {
+ i.operation3();
+ }
+}
+
+class C { // C 类通过接口Interface1,Interface3 依赖(使用) D类,但是只会用到1,4,5方法
+ public void depend1(Interface1 i) {
+ i.operation1();
+ }
+
+ public void depend4(Interface3 i) {
+ i.operation4();
+ }
+
+ public void depend5(Interface3 i) {
+ i.operation5();
+ }
+}
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/principle/segregation/newfile.cld b/desginPattern/src/com/atguigu/principle/segregation/newfile.cld
new file mode 100644
index 0000000..f52aabe
--- /dev/null
+++ b/desginPattern/src/com/atguigu/principle/segregation/newfile.cld
@@ -0,0 +1,524 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 266
+ 119
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 518
+ 128
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ B
+ false
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 521
+ 241
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ D
+ false
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 111
+ 126
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ A
+ false
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 115
+ 221
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ C
+ false
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation1
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation2
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation3
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation4
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation5
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+
+ Interface1
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/principle/segregation/newfile2.cld b/desginPattern/src/com/atguigu/principle/segregation/newfile2.cld
new file mode 100644
index 0000000..621d3bc
--- /dev/null
+++ b/desginPattern/src/com/atguigu/principle/segregation/newfile2.cld
@@ -0,0 +1,27 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/principle/singleresponsibility/SingleResponsibility1.java b/desginPattern/src/com/atguigu/principle/singleresponsibility/SingleResponsibility1.java
new file mode 100644
index 0000000..0bc332d
--- /dev/null
+++ b/desginPattern/src/com/atguigu/principle/singleresponsibility/SingleResponsibility1.java
@@ -0,0 +1,23 @@
+package com.atguigu.principle.singleresponsibility;
+
+public class SingleResponsibility1 {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ Vehicle vehicle = new Vehicle();
+ vehicle.run("摩托车");
+ vehicle.run("汽车");
+ vehicle.run("飞机");
+ }
+
+}
+
+// 交通工具类
+// 方式1
+// 1. 在方式1 的run方法中,违反了单一职责原则
+// 2. 解决的方案非常的简单,根据交通工具运行方法不同,分解成不同类即可
+class Vehicle {
+ public void run(String vehicle) {
+ System.out.println(vehicle + " 在公路上运行....");
+ }
+}
diff --git a/desginPattern/src/com/atguigu/principle/singleresponsibility/SingleResponsibility2.java b/desginPattern/src/com/atguigu/principle/singleresponsibility/SingleResponsibility2.java
new file mode 100644
index 0000000..8728241
--- /dev/null
+++ b/desginPattern/src/com/atguigu/principle/singleresponsibility/SingleResponsibility2.java
@@ -0,0 +1,39 @@
+package com.atguigu.principle.singleresponsibility;
+
+public class SingleResponsibility2 {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ RoadVehicle roadVehicle = new RoadVehicle();
+ roadVehicle.run("摩托车");
+ roadVehicle.run("汽车");
+
+ AirVehicle airVehicle = new AirVehicle();
+
+ airVehicle.run("飞机");
+ }
+
+}
+
+//方案2的分析
+//1. 遵守单一职责原则
+//2. 但是这样做的改动很大,即将类分解,同时修改客户端
+//3. 改进:直接修改Vehicle 类,改动的代码会比较少=>方案3
+
+class RoadVehicle {
+ public void run(String vehicle) {
+ System.out.println(vehicle + "公路运行");
+ }
+}
+
+class AirVehicle {
+ public void run(String vehicle) {
+ System.out.println(vehicle + "天空运行");
+ }
+}
+
+class WaterVehicle {
+ public void run(String vehicle) {
+ System.out.println(vehicle + "水中运行");
+ }
+}
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/principle/singleresponsibility/SingleResponsibility3.java b/desginPattern/src/com/atguigu/principle/singleresponsibility/SingleResponsibility3.java
new file mode 100644
index 0000000..ae8db2f
--- /dev/null
+++ b/desginPattern/src/com/atguigu/principle/singleresponsibility/SingleResponsibility3.java
@@ -0,0 +1,40 @@
+package com.atguigu.principle.singleresponsibility;
+
+public class SingleResponsibility3 {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ Vehicle2 vehicle2 = new Vehicle2();
+ vehicle2.run("汽车");
+ vehicle2.runWater("轮船");
+ vehicle2.runAir("飞机");
+ }
+
+}
+
+
+//方式3的分析
+//1. 这种修改方法没有对原来的类做大的修改,只是增加方法
+//2. 这里虽然没有在类这个级别上遵守单一职责原则,但是在方法级别上,仍然是遵守单一职责
+class Vehicle2 {
+ public void run(String vehicle) {
+ //处理
+
+ System.out.println(vehicle + " 在公路上运行....");
+
+ }
+
+ public void runAir(String vehicle) {
+ System.out.println(vehicle + " 在天空上运行....");
+ }
+
+ public void runWater(String vehicle) {
+ System.out.println(vehicle + " 在水中行....");
+ }
+
+ //方法2.
+ //..
+ //..
+
+ //...
+}
diff --git a/desginPattern/src/com/atguigu/prototype/Client.java b/desginPattern/src/com/atguigu/prototype/Client.java
new file mode 100644
index 0000000..0961f28
--- /dev/null
+++ b/desginPattern/src/com/atguigu/prototype/Client.java
@@ -0,0 +1,24 @@
+package com.atguigu.prototype;
+
+public class Client {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ //传统的方法
+ Sheep sheep = new Sheep("tom", 1, "白色");
+
+ Sheep sheep2 = new Sheep(sheep.getName(), sheep.getAge(), sheep.getColor());
+ Sheep sheep3 = new Sheep(sheep.getName(), sheep.getAge(), sheep.getColor());
+ Sheep sheep4 = new Sheep(sheep.getName(), sheep.getAge(), sheep.getColor());
+ Sheep sheep5 = new Sheep(sheep.getName(), sheep.getAge(), sheep.getColor());
+ //....
+
+ System.out.println(sheep);
+ System.out.println(sheep2);
+ System.out.println(sheep3);
+ System.out.println(sheep4);
+ System.out.println(sheep5);
+ //...
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/prototype/Sheep.java b/desginPattern/src/com/atguigu/prototype/Sheep.java
new file mode 100644
index 0000000..49c89a6
--- /dev/null
+++ b/desginPattern/src/com/atguigu/prototype/Sheep.java
@@ -0,0 +1,37 @@
+package com.atguigu.prototype;
+
+public class Sheep {
+ private String name;
+ private int age;
+ private String color;
+ public Sheep(String name, int age, String color) {
+ super();
+ this.name = name;
+ this.age = age;
+ this.color = color;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public int getAge() {
+ return age;
+ }
+ public void setAge(int age) {
+ this.age = age;
+ }
+ public String getColor() {
+ return color;
+ }
+ public void setColor(String color) {
+ this.color = color;
+ }
+ @Override
+ public String toString() {
+ return "Sheep [name=" + name + ", age=" + age + ", color=" + color + "]";
+ }
+
+
+}
diff --git a/desginPattern/src/com/atguigu/prototype/deepclone/Client.java b/desginPattern/src/com/atguigu/prototype/deepclone/Client.java
new file mode 100644
index 0000000..6fa5f6b
--- /dev/null
+++ b/desginPattern/src/com/atguigu/prototype/deepclone/Client.java
@@ -0,0 +1,26 @@
+package com.atguigu.prototype.deepclone;
+
+public class Client {
+
+ public static void main(String[] args) throws Exception {
+ // TODO Auto-generated method stub
+ DeepProtoType p = new DeepProtoType();
+ p.name = "宋江";
+ p.deepCloneableTarget = new DeepCloneableTarget("大牛", "小牛");
+
+ //方式1 完成深拷贝
+
+// DeepProtoType p2 = (DeepProtoType) p.clone();
+//
+// System.out.println("p.name=" + p.name + "p.deepCloneableTarget=" + p.deepCloneableTarget.hashCode());
+// System.out.println("p2.name=" + p.name + "p2.deepCloneableTarget=" + p2.deepCloneableTarget.hashCode());
+
+ //方式2 完成深拷贝
+ DeepProtoType p2 = (DeepProtoType) p.deepClone();
+
+ System.out.println("p.name=" + p.name + "p.deepCloneableTarget=" + p.deepCloneableTarget.hashCode());
+ System.out.println("p2.name=" + p.name + "p2.deepCloneableTarget=" + p2.deepCloneableTarget.hashCode());
+
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/prototype/deepclone/DeepCloneableTarget.java b/desginPattern/src/com/atguigu/prototype/deepclone/DeepCloneableTarget.java
new file mode 100644
index 0000000..f7a46a3
--- /dev/null
+++ b/desginPattern/src/com/atguigu/prototype/deepclone/DeepCloneableTarget.java
@@ -0,0 +1,27 @@
+package com.atguigu.prototype.deepclone;
+
+import java.io.Serializable;
+
+public class DeepCloneableTarget implements Serializable, Cloneable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private String cloneName;
+
+ private String cloneClass;
+
+ //构造器
+ public DeepCloneableTarget(String cloneName, String cloneClass) {
+ this.cloneName = cloneName;
+ this.cloneClass = cloneClass;
+ }
+
+ //因为该类的属性,都是String , 因此我们这里使用默认的clone完成即可
+ @Override
+ protected Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+}
diff --git a/desginPattern/src/com/atguigu/prototype/deepclone/DeepProtoType.java b/desginPattern/src/com/atguigu/prototype/deepclone/DeepProtoType.java
new file mode 100644
index 0000000..3053e9e
--- /dev/null
+++ b/desginPattern/src/com/atguigu/prototype/deepclone/DeepProtoType.java
@@ -0,0 +1,76 @@
+package com.atguigu.prototype.deepclone;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+
+public class DeepProtoType implements Serializable, Cloneable{
+
+ public String name; //String 属性
+ public DeepCloneableTarget deepCloneableTarget;// 引用类型
+ public DeepProtoType() {
+ super();
+ }
+
+
+ //深拷贝 - 方式 1 使用clone 方法
+ @Override
+ protected Object clone() throws CloneNotSupportedException {
+
+ Object deep = null;
+ //这里完成对基本数据类型(属性)和String的克隆
+ deep = super.clone();
+ //对引用类型的属性,进行单独处理
+ DeepProtoType deepProtoType = (DeepProtoType)deep;
+ deepProtoType.deepCloneableTarget = (DeepCloneableTarget)deepCloneableTarget.clone();
+
+ // TODO Auto-generated method stub
+ return deepProtoType;
+ }
+
+ //深拷贝 - 方式2 通过对象的序列化实现 (推荐)
+
+ public Object deepClone() {
+
+ //创建流对象
+ ByteArrayOutputStream bos = null;
+ ObjectOutputStream oos = null;
+ ByteArrayInputStream bis = null;
+ ObjectInputStream ois = null;
+
+ try {
+
+ //序列化
+ bos = new ByteArrayOutputStream();
+ oos = new ObjectOutputStream(bos);
+ oos.writeObject(this); //当前这个对象以对象流的方式输出
+
+ //反序列化
+ bis = new ByteArrayInputStream(bos.toByteArray());
+ ois = new ObjectInputStream(bis);
+ DeepProtoType copyObj = (DeepProtoType)ois.readObject();
+
+ return copyObj;
+
+ } catch (Exception e) {
+ // TODO: handle exception
+ e.printStackTrace();
+ return null;
+ } finally {
+ //关闭流
+ try {
+ bos.close();
+ oos.close();
+ bis.close();
+ ois.close();
+ } catch (Exception e2) {
+ // TODO: handle exception
+ System.out.println(e2.getMessage());
+ }
+ }
+
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/prototype/improve/Client.java b/desginPattern/src/com/atguigu/prototype/improve/Client.java
new file mode 100644
index 0000000..20a4998
--- /dev/null
+++ b/desginPattern/src/com/atguigu/prototype/improve/Client.java
@@ -0,0 +1,25 @@
+package com.atguigu.prototype.improve;
+
+
+
+public class Client {
+
+ public static void main(String[] args) {
+ System.out.println("原型模式完成对象的创建");
+ // TODO Auto-generated method stub
+ Sheep sheep = new Sheep("tom", 1, "白色");
+
+ sheep.friend = new Sheep("jack", 2, "黑色");
+
+ Sheep sheep2 = (Sheep)sheep.clone(); //克隆
+ Sheep sheep3 = (Sheep)sheep.clone(); //克隆
+ Sheep sheep4 = (Sheep)sheep.clone(); //克隆
+ Sheep sheep5 = (Sheep)sheep.clone(); //克隆
+
+ System.out.println("sheep2 =" + sheep2 + "sheep2.friend=" + sheep2.friend.hashCode());
+ System.out.println("sheep3 =" + sheep3 + "sheep3.friend=" + sheep3.friend.hashCode());
+ System.out.println("sheep4 =" + sheep4 + "sheep4.friend=" + sheep4.friend.hashCode());
+ System.out.println("sheep5 =" + sheep5 + "sheep5.friend=" + sheep5.friend.hashCode());
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/prototype/improve/Sheep.java b/desginPattern/src/com/atguigu/prototype/improve/Sheep.java
new file mode 100644
index 0000000..006588a
--- /dev/null
+++ b/desginPattern/src/com/atguigu/prototype/improve/Sheep.java
@@ -0,0 +1,59 @@
+package com.atguigu.prototype.improve;
+
+
+
+
+public class Sheep implements Cloneable {
+ private String name;
+ private int age;
+ private String color;
+ private String address = "蒙古羊";
+ public Sheep friend; //是对象, 克隆是会如何处理
+ public Sheep(String name, int age, String color) {
+ super();
+ this.name = name;
+ this.age = age;
+ this.color = color;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public int getAge() {
+ return age;
+ }
+ public void setAge(int age) {
+ this.age = age;
+ }
+ public String getColor() {
+ return color;
+ }
+ public void setColor(String color) {
+ this.color = color;
+ }
+
+
+
+ @Override
+ public String toString() {
+ return "Sheep [name=" + name + ", age=" + age + ", color=" + color + ", address=" + address + "]";
+ }
+ //克隆该实例,使用默认的clone方法来完成
+ @Override
+ protected Object clone() {
+
+ Sheep sheep = null;
+ try {
+ sheep = (Sheep)super.clone();
+ } catch (Exception e) {
+ // TODO: handle exception
+ System.out.println(e.getMessage());
+ }
+ // TODO Auto-generated method stub
+ return sheep;
+ }
+
+
+}
diff --git a/desginPattern/src/com/atguigu/prototype/newfile.cld b/desginPattern/src/com/atguigu/prototype/newfile.cld
new file mode 100644
index 0000000..663d6df
--- /dev/null
+++ b/desginPattern/src/com/atguigu/prototype/newfile.cld
@@ -0,0 +1,216 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 283
+ 107
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 78
+ 129
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Client
+ false
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ name
+ String
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ age
+ int
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Sheep
+ false
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/proxy/cglib/Client.java b/desginPattern/src/com/atguigu/proxy/cglib/Client.java
new file mode 100644
index 0000000..4ae8d76
--- /dev/null
+++ b/desginPattern/src/com/atguigu/proxy/cglib/Client.java
@@ -0,0 +1,17 @@
+package com.atguigu.proxy.cglib;
+
+public class Client {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ //创建目标对象
+ TeacherDao target = new TeacherDao();
+ //获取到代理对象,并且将目标对象传递给代理对象
+ TeacherDao proxyInstance = (TeacherDao)new ProxyFactory(target).getProxyInstance();
+
+ //执行代理对象的方法,触发intecept 方法,从而实现 对目标对象的调用
+ String res = proxyInstance.teach();
+ System.out.println("res=" + res);
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/proxy/cglib/ProxyFactory.java b/desginPattern/src/com/atguigu/proxy/cglib/ProxyFactory.java
new file mode 100644
index 0000000..412ceb1
--- /dev/null
+++ b/desginPattern/src/com/atguigu/proxy/cglib/ProxyFactory.java
@@ -0,0 +1,43 @@
+package com.atguigu.proxy.cglib;
+
+import java.lang.reflect.Method;
+
+import net.sf.cglib.proxy.Enhancer;
+import net.sf.cglib.proxy.MethodInterceptor;
+import net.sf.cglib.proxy.MethodProxy;
+
+public class ProxyFactory implements MethodInterceptor {
+
+ //维护一个目标对象
+ private Object target;
+
+ //构造器,传入一个被代理的对象
+ public ProxyFactory(Object target) {
+ this.target = target;
+ }
+
+ //返回一个代理对象: 是 target 对象的代理对象
+ public Object getProxyInstance() {
+ //1. 创建一个工具类
+ Enhancer enhancer = new Enhancer();
+ //2. 设置父类
+ enhancer.setSuperclass(target.getClass());
+ //3. 设置回调函数
+ enhancer.setCallback(this);
+ //4. 创建子类对象,即代理对象
+ return enhancer.create();
+
+ }
+
+
+ //重写 intercept 方法,会调用目标对象的方法
+ @Override
+ public Object intercept(Object arg0, Method method, Object[] args, MethodProxy arg3) throws Throwable {
+ // TODO Auto-generated method stub
+ System.out.println("Cglib代理模式 ~~ 开始");
+ Object returnVal = method.invoke(target, args);
+ System.out.println("Cglib代理模式 ~~ 提交");
+ return returnVal;
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/proxy/cglib/TeacherDao.java b/desginPattern/src/com/atguigu/proxy/cglib/TeacherDao.java
new file mode 100644
index 0000000..4d76b40
--- /dev/null
+++ b/desginPattern/src/com/atguigu/proxy/cglib/TeacherDao.java
@@ -0,0 +1,9 @@
+package com.atguigu.proxy.cglib;
+
+public class TeacherDao {
+
+ public String teach() {
+ System.out.println(" 老师授课中 , 我是cglib代理,不需要实现接口 ");
+ return "hello";
+ }
+}
diff --git a/desginPattern/src/com/atguigu/proxy/cglib/newfile.cld b/desginPattern/src/com/atguigu/proxy/cglib/newfile.cld
new file mode 100644
index 0000000..756facd
--- /dev/null
+++ b/desginPattern/src/com/atguigu/proxy/cglib/newfile.cld
@@ -0,0 +1,571 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 109
+ 140
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 127
+ 43
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+
+ MethodInterceptor
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ 120
+ 261
+ 342
+ 19
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ 0.5
+
+ 0
+ 0
+
+
+ 150
+ 0
+
+
+
+ 0.5
+
+ 150
+ 0
+
+
+ 150
+ -80
+
+
+
+ 0.5
+
+ 150
+ -80
+
+
+ 0
+ -80
+
+
+
+
+
+
+
+
+
+
+
+ getInstacne()缁欑洰鏍囧璞arget 鍒涘缓涓涓唬鐞嗗璞
+
+閲嶅啓intecept鏂规硶, 瀹炵幇瀵硅浠g悊瀵硅薄(鐩爣瀵硅薄)
+鏂规硶鎺夎皟鐢
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 310
+ 291
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Client
+ false
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ target
+ Object
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ proxyFactory
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ getProxyInstance
+ Object
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ intecept
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ ProxyFactory
+ false
+
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 400
+ 164
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ teach
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ TeacherDao
+ false
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/proxy/dynamic/Client.java b/desginPattern/src/com/atguigu/proxy/dynamic/Client.java
new file mode 100644
index 0000000..c498bdf
--- /dev/null
+++ b/desginPattern/src/com/atguigu/proxy/dynamic/Client.java
@@ -0,0 +1,22 @@
+package com.atguigu.proxy.dynamic;
+
+public class Client {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ //创建目标对象
+ ITeacherDao target = new TeacherDao();
+
+ //给目标对象,创建代理对象, 可以转成 ITeacherDao
+ ITeacherDao proxyInstance = (ITeacherDao)new ProxyFactory(target).getProxyInstance();
+
+ // proxyInstance=class com.sun.proxy.$Proxy0 内存中动态生成了代理对象
+ System.out.println("proxyInstance=" + proxyInstance.getClass());
+
+ //通过代理对象,调用目标对象的方法
+ //proxyInstance.teach();
+
+ proxyInstance.sayHello(" tom ");
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/proxy/dynamic/ITeacherDao.java b/desginPattern/src/com/atguigu/proxy/dynamic/ITeacherDao.java
new file mode 100644
index 0000000..2840c18
--- /dev/null
+++ b/desginPattern/src/com/atguigu/proxy/dynamic/ITeacherDao.java
@@ -0,0 +1,8 @@
+package com.atguigu.proxy.dynamic;
+
+//接口
+public interface ITeacherDao {
+
+ void teach(); // 授课方法
+ void sayHello(String name);
+}
diff --git a/desginPattern/src/com/atguigu/proxy/dynamic/ProxyFactory.java b/desginPattern/src/com/atguigu/proxy/dynamic/ProxyFactory.java
new file mode 100644
index 0000000..eadef3f
--- /dev/null
+++ b/desginPattern/src/com/atguigu/proxy/dynamic/ProxyFactory.java
@@ -0,0 +1,48 @@
+package com.atguigu.proxy.dynamic;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+public class ProxyFactory {
+
+ //维护一个目标对象 , Object
+ private Object target;
+
+ //构造器 , 对target 进行初始化
+ public ProxyFactory(Object target) {
+
+ this.target = target;
+ }
+
+ //给目标对象 生成一个代理对象
+ public Object getProxyInstance() {
+
+ //说明
+ /*
+ * public static Object newProxyInstance(ClassLoader loader,
+ Class>[] interfaces,
+ InvocationHandler h)
+
+ //1. ClassLoader loader : 指定当前目标对象使用的类加载器, 获取加载器的方法固定
+ //2. Class>[] interfaces: 目标对象实现的接口类型,使用泛型方法确认类型
+ //3. InvocationHandler h : 事情处理,执行目标对象的方法时,会触发事情处理器方法, 会把当前执行的目标对象方法作为参数传入
+ */
+ return Proxy.newProxyInstance(target.getClass().getClassLoader(),
+ target.getClass().getInterfaces(),
+ new InvocationHandler() {
+
+ @Override
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ // TODO Auto-generated method stub
+ System.out.println("JDK代理开始~~");
+ //反射机制调用目标对象的方法
+ Object returnVal = method.invoke(target, args);
+ System.out.println("JDK代理提交");
+ return returnVal;
+ }
+ });
+ }
+
+
+}
diff --git a/desginPattern/src/com/atguigu/proxy/dynamic/TeacherDao.java b/desginPattern/src/com/atguigu/proxy/dynamic/TeacherDao.java
new file mode 100644
index 0000000..f204a09
--- /dev/null
+++ b/desginPattern/src/com/atguigu/proxy/dynamic/TeacherDao.java
@@ -0,0 +1,17 @@
+package com.atguigu.proxy.dynamic;
+
+public class TeacherDao implements ITeacherDao {
+
+ @Override
+ public void teach() {
+ // TODO Auto-generated method stub
+ System.out.println(" 老师授课中.... ");
+ }
+
+ @Override
+ public void sayHello(String name) {
+ // TODO Auto-generated method stub
+ System.out.println("hello " + name);
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/proxy/dynamic/newfile.cld b/desginPattern/src/com/atguigu/proxy/dynamic/newfile.cld
new file mode 100644
index 0000000..015b256
--- /dev/null
+++ b/desginPattern/src/com/atguigu/proxy/dynamic/newfile.cld
@@ -0,0 +1,472 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 428
+ 124
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 449
+ 257
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 165
+ 281
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 125
+ 120
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ 99
+ 298
+ 91
+ 0
+
+
+
+
+
+
+
+ getProxyInstacne():
+1. 鏍规嵁浼犲叆鐨勫璞★紙TeacherDao锛,鐩爣瀵硅薄
+2. 鍒╃敤杩斿洖鏈哄埗锛 杩斿洖涓涓唬鐞嗗璞
+3. 鐒跺悗閫氳繃浠g悊瀵硅薄锛岃皟鐢ㄧ洰鏍囧璞℃柟娉
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ ProxyFactory
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ getProxyInstacne
+ Object
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ ProxyFactory
+ false
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Client
+ false
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ teach
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ TeacherDao
+ false
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ teach
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+
+ ITeacherDao
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/proxy/newfile.cld b/desginPattern/src/com/atguigu/proxy/newfile.cld
new file mode 100644
index 0000000..56155c2
--- /dev/null
+++ b/desginPattern/src/com/atguigu/proxy/newfile.cld
@@ -0,0 +1,304 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 460
+ 225
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 294
+ 115
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 157
+ 232
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Client
+ false
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ ProxyObject
+ false
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation1
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation2
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ TargetObject
+ false
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/proxy/staticproxy/Client.java b/desginPattern/src/com/atguigu/proxy/staticproxy/Client.java
new file mode 100644
index 0000000..cdd5ec6
--- /dev/null
+++ b/desginPattern/src/com/atguigu/proxy/staticproxy/Client.java
@@ -0,0 +1,18 @@
+package com.atguigu.proxy.staticproxy;
+
+public class Client {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ //创建目标对象(被代理对象)
+ TeacherDao teacherDao = new TeacherDao();
+
+ //创建代理对象, 同时将被代理对象传递给代理对象
+ TeacherDaoProxy teacherDaoProxy = new TeacherDaoProxy(teacherDao);
+
+ //通过代理对象,调用到被代理对象的方法
+ //即:执行的是代理对象的方法,代理对象再去调用目标对象的方法
+ teacherDaoProxy.teach();
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/proxy/staticproxy/ITeacherDao.java b/desginPattern/src/com/atguigu/proxy/staticproxy/ITeacherDao.java
new file mode 100644
index 0000000..09ec5e7
--- /dev/null
+++ b/desginPattern/src/com/atguigu/proxy/staticproxy/ITeacherDao.java
@@ -0,0 +1,8 @@
+package com.atguigu.proxy.staticproxy;
+
+
+//接口
+public interface ITeacherDao {
+
+ void teach(); // 授课的方法
+}
diff --git a/desginPattern/src/com/atguigu/proxy/staticproxy/TeacherDao.java b/desginPattern/src/com/atguigu/proxy/staticproxy/TeacherDao.java
new file mode 100644
index 0000000..776c193
--- /dev/null
+++ b/desginPattern/src/com/atguigu/proxy/staticproxy/TeacherDao.java
@@ -0,0 +1,11 @@
+package com.atguigu.proxy.staticproxy;
+
+public class TeacherDao implements ITeacherDao {
+
+ @Override
+ public void teach() {
+ // TODO Auto-generated method stub
+ System.out.println(" 老师授课中 。。。。。");
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/proxy/staticproxy/TeacherDaoProxy.java b/desginPattern/src/com/atguigu/proxy/staticproxy/TeacherDaoProxy.java
new file mode 100644
index 0000000..c086601
--- /dev/null
+++ b/desginPattern/src/com/atguigu/proxy/staticproxy/TeacherDaoProxy.java
@@ -0,0 +1,24 @@
+package com.atguigu.proxy.staticproxy;
+
+//代理对象,静态代理
+public class TeacherDaoProxy implements ITeacherDao{
+
+ private ITeacherDao target; // 目标对象,通过接口来聚合
+
+
+ //构造器
+ public TeacherDaoProxy(ITeacherDao target) {
+ this.target = target;
+ }
+
+
+
+ @Override
+ public void teach() {
+ // TODO Auto-generated method stub
+ System.out.println("开始代理 完成某些操作。。。。。 ");//方法
+ target.teach();
+ System.out.println("提交。。。。。");//方法
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/proxy/staticproxy/newfile.cld b/desginPattern/src/com/atguigu/proxy/staticproxy/newfile.cld
new file mode 100644
index 0000000..7117a1c
--- /dev/null
+++ b/desginPattern/src/com/atguigu/proxy/staticproxy/newfile.cld
@@ -0,0 +1,520 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 209
+ 263
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 164
+ 83
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 387
+ 84
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ teach
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+
+ ITeacherDao
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ teach
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ TeacherDaoProxy
+ false
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ 107
+ 281
+ 201
+ 378
+
+
+
+
+
+
+
+ Client
+1. 鍒涘缓TeacherDaoProxy浠g悊瀵硅薄
+2. 鍒涘缓TeacherDao 瀵硅薄
+3. 灏員eacherDao瀵硅薄锛屼氦涓猅eacherDaoProxy瀵硅薄 鎵ц鏂规硶
+
+ Client
+1. 鍒涘缓TeacherDaoProxy浠g悊瀵硅薄
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Client
+ false
+
+
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 421
+ 239
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ teach
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ TeacherDao
+ false
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/responsibilitychain/Approver.java b/desginPattern/src/com/atguigu/responsibilitychain/Approver.java
new file mode 100644
index 0000000..6c624a6
--- /dev/null
+++ b/desginPattern/src/com/atguigu/responsibilitychain/Approver.java
@@ -0,0 +1,21 @@
+package com.atguigu.responsibilitychain;
+
+public abstract class Approver {
+
+ Approver approver; //下一个处理者
+ String name; // 名字
+
+ public Approver(String name) {
+ // TODO Auto-generated constructor stub
+ this.name = name;
+ }
+
+ //下一个处理者
+ public void setApprover(Approver approver) {
+ this.approver = approver;
+ }
+
+ //处理审批请求的方法,得到一个请求, 处理是子类完成,因此该方法做成抽象
+ public abstract void processRequest(PurchaseRequest purchaseRequest);
+
+}
diff --git a/desginPattern/src/com/atguigu/responsibilitychain/Client.java b/desginPattern/src/com/atguigu/responsibilitychain/Client.java
new file mode 100644
index 0000000..65c3878
--- /dev/null
+++ b/desginPattern/src/com/atguigu/responsibilitychain/Client.java
@@ -0,0 +1,29 @@
+package com.atguigu.responsibilitychain;
+
+public class Client {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ //创建一个请求
+ PurchaseRequest purchaseRequest = new PurchaseRequest(1, 31000, 1);
+
+ //创建相关的审批人
+ DepartmentApprover departmentApprover = new DepartmentApprover("张主任");
+ CollegeApprover collegeApprover = new CollegeApprover("李院长");
+ ViceSchoolMasterApprover viceSchoolMasterApprover = new ViceSchoolMasterApprover("王副校");
+ SchoolMasterApprover schoolMasterApprover = new SchoolMasterApprover("佟校长");
+
+
+ //需要将各个审批级别的下一个设置好 (处理人构成环形: )
+ departmentApprover.setApprover(collegeApprover);
+ collegeApprover.setApprover(viceSchoolMasterApprover);
+ viceSchoolMasterApprover.setApprover(schoolMasterApprover);
+ schoolMasterApprover.setApprover(departmentApprover);
+
+
+
+ departmentApprover.processRequest(purchaseRequest);
+ viceSchoolMasterApprover.processRequest(purchaseRequest);
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/responsibilitychain/CollegeApprover.java b/desginPattern/src/com/atguigu/responsibilitychain/CollegeApprover.java
new file mode 100644
index 0000000..66d510f
--- /dev/null
+++ b/desginPattern/src/com/atguigu/responsibilitychain/CollegeApprover.java
@@ -0,0 +1,19 @@
+package com.atguigu.responsibilitychain;
+
+public class CollegeApprover extends Approver {
+
+ public CollegeApprover(String name) {
+ // TODO Auto-generated constructor stub
+ super(name);
+ }
+
+ @Override
+ public void processRequest(PurchaseRequest purchaseRequest) {
+ // TODO Auto-generated method stub
+ if(purchaseRequest.getPrice() < 5000 && purchaseRequest.getPrice() <= 10000) {
+ System.out.println(" 请求编号 id= " + purchaseRequest.getId() + " 被 " + this.name + " 处理");
+ }else {
+ approver.processRequest(purchaseRequest);
+ }
+ }
+}
diff --git a/desginPattern/src/com/atguigu/responsibilitychain/DepartmentApprover.java b/desginPattern/src/com/atguigu/responsibilitychain/DepartmentApprover.java
new file mode 100644
index 0000000..077f418
--- /dev/null
+++ b/desginPattern/src/com/atguigu/responsibilitychain/DepartmentApprover.java
@@ -0,0 +1,21 @@
+package com.atguigu.responsibilitychain;
+
+public class DepartmentApprover extends Approver {
+
+
+ public DepartmentApprover(String name) {
+ // TODO Auto-generated constructor stub
+ super(name);
+ }
+
+ @Override
+ public void processRequest(PurchaseRequest purchaseRequest) {
+ // TODO Auto-generated method stub
+ if(purchaseRequest.getPrice() <= 5000) {
+ System.out.println(" 请求编号 id= " + purchaseRequest.getId() + " 被 " + this.name + " 处理");
+ }else {
+ approver.processRequest(purchaseRequest);
+ }
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/responsibilitychain/PurchaseRequest.java b/desginPattern/src/com/atguigu/responsibilitychain/PurchaseRequest.java
new file mode 100644
index 0000000..1d7822f
--- /dev/null
+++ b/desginPattern/src/com/atguigu/responsibilitychain/PurchaseRequest.java
@@ -0,0 +1,30 @@
+package com.atguigu.responsibilitychain;
+
+
+//请求类
+public class PurchaseRequest {
+
+ private int type = 0; //请求类型
+ private float price = 0.0f; //请求金额
+ private int id = 0;
+ //构造器
+ public PurchaseRequest(int type, float price, int id) {
+ this.type = type;
+ this.price = price;
+ this.id = id;
+ }
+ public int getType() {
+ return type;
+ }
+ public float getPrice() {
+ return price;
+ }
+ public int getId() {
+ return id;
+ }
+
+
+
+
+
+}
diff --git a/desginPattern/src/com/atguigu/responsibilitychain/SchoolMasterApprover.java b/desginPattern/src/com/atguigu/responsibilitychain/SchoolMasterApprover.java
new file mode 100644
index 0000000..b90410b
--- /dev/null
+++ b/desginPattern/src/com/atguigu/responsibilitychain/SchoolMasterApprover.java
@@ -0,0 +1,19 @@
+package com.atguigu.responsibilitychain;
+
+public class SchoolMasterApprover extends Approver {
+
+ public SchoolMasterApprover(String name) {
+ // TODO Auto-generated constructor stub
+ super(name);
+ }
+
+ @Override
+ public void processRequest(PurchaseRequest purchaseRequest) {
+ // TODO Auto-generated method stub
+ if(purchaseRequest.getPrice() > 30000) {
+ System.out.println(" 请求编号 id= " + purchaseRequest.getId() + " 被 " + this.name + " 处理");
+ }else {
+ approver.processRequest(purchaseRequest);
+ }
+ }
+}
diff --git a/desginPattern/src/com/atguigu/responsibilitychain/ViceSchoolMasterApprover.java b/desginPattern/src/com/atguigu/responsibilitychain/ViceSchoolMasterApprover.java
new file mode 100644
index 0000000..6c72c03
--- /dev/null
+++ b/desginPattern/src/com/atguigu/responsibilitychain/ViceSchoolMasterApprover.java
@@ -0,0 +1,19 @@
+package com.atguigu.responsibilitychain;
+
+public class ViceSchoolMasterApprover extends Approver {
+
+ public ViceSchoolMasterApprover(String name) {
+ // TODO Auto-generated constructor stub
+ super(name);
+ }
+
+ @Override
+ public void processRequest(PurchaseRequest purchaseRequest) {
+ // TODO Auto-generated method stub
+ if(purchaseRequest.getPrice() < 10000 && purchaseRequest.getPrice() <= 30000) {
+ System.out.println(" 请求编号 id= " + purchaseRequest.getId() + " 被 " + this.name + " 处理");
+ }else {
+ approver.processRequest(purchaseRequest);
+ }
+ }
+}
diff --git a/desginPattern/src/com/atguigu/responsibilitychain/newfile.cld b/desginPattern/src/com/atguigu/responsibilitychain/newfile.cld
new file mode 100644
index 0000000..1d5ffb6
--- /dev/null
+++ b/desginPattern/src/com/atguigu/responsibilitychain/newfile.cld
@@ -0,0 +1,588 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 374
+ 130
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ 0.5
+
+ 0
+ 0
+
+
+ 99
+ 0
+
+
+
+ 0.5
+
+ 99
+ 0
+
+
+ 99
+ -54
+
+
+
+ 0.5
+
+ 99
+ -54
+
+
+ 0
+ -54
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 241
+ 62
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 106
+ 146
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Client
+ false
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Request
+ false
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 254
+ 283
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ processRequset
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ ConcreteHandlerA
+ false
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 500
+ 281
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ processRequset
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ ConcreteHandlerB
+ false
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ processRequset
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ successor
+ Handler
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Handler
+ false
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/responsibilitychain/oa.cld b/desginPattern/src/com/atguigu/responsibilitychain/oa.cld
new file mode 100644
index 0000000..2b55556
--- /dev/null
+++ b/desginPattern/src/com/atguigu/responsibilitychain/oa.cld
@@ -0,0 +1,755 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 322
+ 264
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ DepartmentApprover
+ false
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 462
+ 326
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ CollegeApprover
+ false
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 564
+ 369
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ ViceSchoolMasterApprover
+ false
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 596
+ 264
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ SchoolMasterApprover
+ false
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 411
+ 124
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ 0.5
+
+ 0
+ 0
+
+
+ 90
+ 0
+
+
+
+ 0.5
+
+ 90
+ 0
+
+
+ 90
+ -46
+
+
+
+ 0.5
+
+ 90
+ -46
+
+
+ 0
+ -46
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 204
+ 48
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 138
+ 155
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Client
+ false
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ PurchaseRequest
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ approver
+ Approver
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ processRequest
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Approver
+ false
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/singleton/type1/SingletonTest01.java b/desginPattern/src/com/atguigu/singleton/type1/SingletonTest01.java
new file mode 100644
index 0000000..0885a67
--- /dev/null
+++ b/desginPattern/src/com/atguigu/singleton/type1/SingletonTest01.java
@@ -0,0 +1,33 @@
+package com.atguigu.singleton.type1;
+
+public class SingletonTest01 {
+
+ public static void main(String[] args) {
+ //测试
+ Singleton instance = Singleton.getInstance();
+ Singleton instance2 = Singleton.getInstance();
+ System.out.println(instance == instance2); // true
+ System.out.println("instance.hashCode=" + instance.hashCode());
+ System.out.println("instance2.hashCode=" + instance2.hashCode());
+ }
+
+}
+
+//饿汉式(静态变量)
+
+class Singleton {
+
+ //1. 构造器私有化, 外部能new
+ private Singleton() {
+
+ }
+
+ //2.本类内部创建对象实例
+ private final static Singleton instance = new Singleton();
+
+ //3. 提供一个公有的静态方法,返回实例对象
+ public static Singleton getInstance() {
+ return instance;
+ }
+
+}
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/singleton/type2/SingletonTest02.java b/desginPattern/src/com/atguigu/singleton/type2/SingletonTest02.java
new file mode 100644
index 0000000..601007c
--- /dev/null
+++ b/desginPattern/src/com/atguigu/singleton/type2/SingletonTest02.java
@@ -0,0 +1,38 @@
+package com.atguigu.singleton.type2;
+
+public class SingletonTest02 {
+
+ public static void main(String[] args) {
+ //测试
+ Singleton instance = Singleton.getInstance();
+ Singleton instance2 = Singleton.getInstance();
+ System.out.println(instance == instance2); // true
+ System.out.println("instance.hashCode=" + instance.hashCode());
+ System.out.println("instance2.hashCode=" + instance2.hashCode());
+ }
+
+}
+
+//饿汉式(静态变量)
+
+class Singleton {
+
+ //1. 构造器私有化, 外部能new
+ private Singleton() {
+
+ }
+
+
+ //2.本类内部创建对象实例
+ private static Singleton instance;
+
+ static { // 在静态代码块中,创建单例对象
+ instance = new Singleton();
+ }
+
+ //3. 提供一个公有的静态方法,返回实例对象
+ public static Singleton getInstance() {
+ return instance;
+ }
+
+}
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/singleton/type3/SingletonTest03.java b/desginPattern/src/com/atguigu/singleton/type3/SingletonTest03.java
new file mode 100644
index 0000000..3612c9b
--- /dev/null
+++ b/desginPattern/src/com/atguigu/singleton/type3/SingletonTest03.java
@@ -0,0 +1,30 @@
+package com.atguigu.singleton.type3;
+
+
+public class SingletonTest03 {
+
+ public static void main(String[] args) {
+ System.out.println("懒汉式1 , 线程不安全~");
+ Singleton instance = Singleton.getInstance();
+ Singleton instance2 = Singleton.getInstance();
+ System.out.println(instance == instance2); // true
+ System.out.println("instance.hashCode=" + instance.hashCode());
+ System.out.println("instance2.hashCode=" + instance2.hashCode());
+ }
+
+}
+
+class Singleton {
+ private static Singleton instance;
+
+ private Singleton() {}
+
+ //提供一个静态的公有方法,当使用到该方法时,才去创建 instance
+ //即懒汉式
+ public static Singleton getInstance() {
+ if(instance == null) {
+ instance = new Singleton();
+ }
+ return instance;
+ }
+}
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/singleton/type4/SingletonTest04.java b/desginPattern/src/com/atguigu/singleton/type4/SingletonTest04.java
new file mode 100644
index 0000000..247deac
--- /dev/null
+++ b/desginPattern/src/com/atguigu/singleton/type4/SingletonTest04.java
@@ -0,0 +1,31 @@
+package com.atguigu.singleton.type4;
+
+
+public class SingletonTest04 {
+
+ public static void main(String[] args) {
+ System.out.println("懒汉式2 , 线程安全~");
+ Singleton instance = Singleton.getInstance();
+ Singleton instance2 = Singleton.getInstance();
+ System.out.println(instance == instance2); // true
+ System.out.println("instance.hashCode=" + instance.hashCode());
+ System.out.println("instance2.hashCode=" + instance2.hashCode());
+ }
+
+}
+
+// 懒汉式(线程安全,同步方法)
+class Singleton {
+ private static Singleton instance;
+
+ private Singleton() {}
+
+ //提供一个静态的公有方法,加入同步处理的代码,解决线程安全问题
+ //即懒汉式
+ public static synchronized Singleton getInstance() {
+ if(instance == null) {
+ instance = new Singleton();
+ }
+ return instance;
+ }
+}
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/singleton/type6/SingletonTest06.java b/desginPattern/src/com/atguigu/singleton/type6/SingletonTest06.java
new file mode 100644
index 0000000..c66a082
--- /dev/null
+++ b/desginPattern/src/com/atguigu/singleton/type6/SingletonTest06.java
@@ -0,0 +1,38 @@
+package com.atguigu.singleton.type6;
+
+
+public class SingletonTest06 {
+
+ public static void main(String[] args) {
+ System.out.println("双重检查");
+ Singleton instance = Singleton.getInstance();
+ Singleton instance2 = Singleton.getInstance();
+ System.out.println(instance == instance2); // true
+ System.out.println("instance.hashCode=" + instance.hashCode());
+ System.out.println("instance2.hashCode=" + instance2.hashCode());
+
+ }
+
+}
+
+// 懒汉式(线程安全,同步方法)
+class Singleton {
+ private static volatile Singleton instance;
+
+ private Singleton() {}
+
+ //提供一个静态的公有方法,加入双重检查代码,解决线程安全问题, 同时解决懒加载问题
+ //同时保证了效率, 推荐使用
+
+ public static synchronized Singleton getInstance() {
+ if(instance == null) {
+ synchronized (Singleton.class) {
+ if(instance == null) {
+ instance = new Singleton();
+ }
+ }
+
+ }
+ return instance;
+ }
+}
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/singleton/type7/SingletonTest07.java b/desginPattern/src/com/atguigu/singleton/type7/SingletonTest07.java
new file mode 100644
index 0000000..cf500a5
--- /dev/null
+++ b/desginPattern/src/com/atguigu/singleton/type7/SingletonTest07.java
@@ -0,0 +1,36 @@
+package com.atguigu.singleton.type7;
+
+
+public class SingletonTest07 {
+
+ public static void main(String[] args) {
+ System.out.println("使用静态内部类完成单例模式");
+ Singleton instance = Singleton.getInstance();
+ Singleton instance2 = Singleton.getInstance();
+ System.out.println(instance == instance2); // true
+ System.out.println("instance.hashCode=" + instance.hashCode());
+ System.out.println("instance2.hashCode=" + instance2.hashCode());
+
+ }
+
+}
+
+// 静态内部类完成, 推荐使用
+class Singleton {
+ private static volatile Singleton instance;
+
+ //构造器私有化
+ private Singleton() {}
+
+ //写一个静态内部类,该类中有一个静态属性 Singleton
+ private static class SingletonInstance {
+ private static final Singleton INSTANCE = new Singleton();
+ }
+
+ //提供一个静态的公有方法,直接返回SingletonInstance.INSTANCE
+
+ public static synchronized Singleton getInstance() {
+
+ return SingletonInstance.INSTANCE;
+ }
+}
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/singleton/type8/SingletonTest08.java b/desginPattern/src/com/atguigu/singleton/type8/SingletonTest08.java
new file mode 100644
index 0000000..4ab75e7
--- /dev/null
+++ b/desginPattern/src/com/atguigu/singleton/type8/SingletonTest08.java
@@ -0,0 +1,22 @@
+package com.atguigu.singleton.type8;
+
+public class SingletonTest08 {
+ public static void main(String[] args) {
+ Singleton instance = Singleton.INSTANCE;
+ Singleton instance2 = Singleton.INSTANCE;
+ System.out.println(instance == instance2);
+
+ System.out.println(instance.hashCode());
+ System.out.println(instance2.hashCode());
+
+ instance.sayOK();
+ }
+}
+
+//使用枚举,可以实现单例, 推荐
+enum Singleton {
+ INSTANCE; //属性
+ public void sayOK() {
+ System.out.println("ok~");
+ }
+}
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/state/CanRaffleState.java b/desginPattern/src/com/atguigu/state/CanRaffleState.java
new file mode 100644
index 0000000..42d99c1
--- /dev/null
+++ b/desginPattern/src/com/atguigu/state/CanRaffleState.java
@@ -0,0 +1,48 @@
+package com.atguigu.state;
+
+import java.util.Random;
+
+/**
+ * 可以抽奖的状态
+ * @author Administrator
+ *
+ */
+public class CanRaffleState extends State {
+
+ RaffleActivity activity;
+
+ public CanRaffleState(RaffleActivity activity) {
+ this.activity = activity;
+ }
+
+ //已经扣除了积分,不能再扣
+ @Override
+ public void deductMoney() {
+ System.out.println("已经扣取过了积分");
+ }
+
+ //可以抽奖, 抽完奖后,根据实际情况,改成新的状态
+ @Override
+ public boolean raffle() {
+ System.out.println("正在抽奖,请稍等!");
+ Random r = new Random();
+ int num = r.nextInt(10);
+ // 10%中奖机会
+ if(num == 0){
+ // 改变活动状态为发放奖品 context
+ activity.setState(activity.getDispenseState());
+ return true;
+ }else{
+ System.out.println("很遗憾没有抽中奖品!");
+ // 改变状态为不能抽奖
+ activity.setState(activity.getNoRafflleState());
+ return false;
+ }
+ }
+
+ // 不能发放奖品
+ @Override
+ public void dispensePrize() {
+ System.out.println("没中奖,不能发放奖品");
+ }
+}
diff --git a/desginPattern/src/com/atguigu/state/ClientTest.java b/desginPattern/src/com/atguigu/state/ClientTest.java
new file mode 100644
index 0000000..f196aa1
--- /dev/null
+++ b/desginPattern/src/com/atguigu/state/ClientTest.java
@@ -0,0 +1,26 @@
+package com.atguigu.state;
+
+/**
+ * 状态模式测试类
+ * @author Administrator
+ *
+ */
+public class ClientTest {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ // 创建活动对象,奖品有1个奖品
+ RaffleActivity activity = new RaffleActivity(1);
+
+ // 我们连续抽300次奖
+ for (int i = 0; i < 30; i++) {
+ System.out.println("--------第" + (i + 1) + "次抽奖----------");
+ // 参加抽奖,第一步点击扣除积分
+ activity.debuctMoney();
+
+ // 第二步抽奖
+ activity.raffle();
+ }
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/state/DispenseOutState.java b/desginPattern/src/com/atguigu/state/DispenseOutState.java
new file mode 100644
index 0000000..e82918f
--- /dev/null
+++ b/desginPattern/src/com/atguigu/state/DispenseOutState.java
@@ -0,0 +1,32 @@
+package com.atguigu.state;
+
+/**
+ * 奖品发放完毕状态
+ * 说明,当我们activity 改变成 DispenseOutState, 抽奖活动结束
+ * @author Administrator
+ *
+ */
+public class DispenseOutState extends State {
+
+ // 初始化时传入活动引用
+ RaffleActivity activity;
+
+ public DispenseOutState(RaffleActivity activity) {
+ this.activity = activity;
+ }
+ @Override
+ public void deductMoney() {
+ System.out.println("奖品发送完了,请下次再参加");
+ }
+
+ @Override
+ public boolean raffle() {
+ System.out.println("奖品发送完了,请下次再参加");
+ return false;
+ }
+
+ @Override
+ public void dispensePrize() {
+ System.out.println("奖品发送完了,请下次再参加");
+ }
+}
diff --git a/desginPattern/src/com/atguigu/state/DispenseState.java b/desginPattern/src/com/atguigu/state/DispenseState.java
new file mode 100644
index 0000000..0788100
--- /dev/null
+++ b/desginPattern/src/com/atguigu/state/DispenseState.java
@@ -0,0 +1,46 @@
+package com.atguigu.state;
+
+/**
+ * 发放奖品的状态
+ * @author Administrator
+ *
+ */
+public class DispenseState extends State {
+
+ // 初始化时传入活动引用,发放奖品后改变其状态
+ RaffleActivity activity;
+
+ public DispenseState(RaffleActivity activity) {
+ this.activity = activity;
+ }
+
+ //
+
+ @Override
+ public void deductMoney() {
+ System.out.println("不能扣除积分");
+ }
+
+ @Override
+ public boolean raffle() {
+ System.out.println("不能抽奖");
+ return false;
+ }
+
+ //发放奖品
+ @Override
+ public void dispensePrize() {
+ if(activity.getCount() > 0){
+ System.out.println("恭喜中奖了");
+ // 改变状态为不能抽奖
+ activity.setState(activity.getNoRafflleState());
+ }else{
+ System.out.println("很遗憾,奖品发送完了");
+ // 改变状态为奖品发送完毕, 后面我们就不可以抽奖
+ activity.setState(activity.getDispensOutState());
+ //System.out.println("抽奖活动结束");
+ //System.exit(0);
+ }
+
+ }
+}
diff --git a/desginPattern/src/com/atguigu/state/NoRaffleState.java b/desginPattern/src/com/atguigu/state/NoRaffleState.java
new file mode 100644
index 0000000..320f6b4
--- /dev/null
+++ b/desginPattern/src/com/atguigu/state/NoRaffleState.java
@@ -0,0 +1,36 @@
+package com.atguigu.state;
+
+/**
+ * 不能抽奖状态
+ * @author Administrator
+ *
+ */
+public class NoRaffleState extends State {
+
+ // 初始化时传入活动引用,扣除积分后改变其状态
+ RaffleActivity activity;
+
+ public NoRaffleState(RaffleActivity activity) {
+ this.activity = activity;
+ }
+
+ // 当前状态可以扣积分 , 扣除后,将状态设置成可以抽奖状态
+ @Override
+ public void deductMoney() {
+ System.out.println("扣除50积分成功,您可以抽奖了");
+ activity.setState(activity.getCanRaffleState());
+ }
+
+ // 当前状态不能抽奖
+ @Override
+ public boolean raffle() {
+ System.out.println("扣了积分才能抽奖喔!");
+ return false;
+ }
+
+ // 当前状态不能发奖品
+ @Override
+ public void dispensePrize() {
+ System.out.println("不能发放奖品");
+ }
+}
diff --git a/desginPattern/src/com/atguigu/state/RaffleActivity.java b/desginPattern/src/com/atguigu/state/RaffleActivity.java
new file mode 100644
index 0000000..58e2327
--- /dev/null
+++ b/desginPattern/src/com/atguigu/state/RaffleActivity.java
@@ -0,0 +1,96 @@
+package com.atguigu.state;
+
+/**
+ * 抽奖活动 //
+ *
+ * @author Administrator
+ *
+ */
+public class RaffleActivity {
+
+ // state 表示活动当前的状态,是变化
+ State state = null;
+ // 奖品数量
+ int count = 0;
+
+ // 四个属性,表示四种状态
+ State noRafflleState = new NoRaffleState(this);
+ State canRaffleState = new CanRaffleState(this);
+
+ State dispenseState = new DispenseState(this);
+ State dispensOutState = new DispenseOutState(this);
+
+ //构造器
+ //1. 初始化当前的状态为 noRafflleState(即不能抽奖的状态)
+ //2. 初始化奖品的数量
+ public RaffleActivity( int count) {
+ this.state = getNoRafflleState();
+ this.count = count;
+ }
+
+ //扣分, 调用当前状态的 deductMoney
+ public void debuctMoney(){
+ state.deductMoney();
+ }
+
+ //抽奖
+ public void raffle(){
+ // 如果当前的状态是抽奖成功
+ if(state.raffle()){
+ //领取奖品
+ state.dispensePrize();
+ }
+
+ }
+
+ public State getState() {
+ return state;
+ }
+
+ public void setState(State state) {
+ this.state = state;
+ }
+
+ //这里请大家注意,每领取一次奖品,count--
+ public int getCount() {
+ int curCount = count;
+ count--;
+ return curCount;
+ }
+
+ public void setCount(int count) {
+ this.count = count;
+ }
+
+ public State getNoRafflleState() {
+ return noRafflleState;
+ }
+
+ public void setNoRafflleState(State noRafflleState) {
+ this.noRafflleState = noRafflleState;
+ }
+
+ public State getCanRaffleState() {
+ return canRaffleState;
+ }
+
+ public void setCanRaffleState(State canRaffleState) {
+ this.canRaffleState = canRaffleState;
+ }
+
+ public State getDispenseState() {
+ return dispenseState;
+ }
+
+ public void setDispenseState(State dispenseState) {
+ this.dispenseState = dispenseState;
+ }
+
+ public State getDispensOutState() {
+ return dispensOutState;
+ }
+
+ public void setDispensOutState(State dispensOutState) {
+ this.dispensOutState = dispensOutState;
+ }
+}
diff --git a/desginPattern/src/com/atguigu/state/State.java b/desginPattern/src/com/atguigu/state/State.java
new file mode 100644
index 0000000..e416394
--- /dev/null
+++ b/desginPattern/src/com/atguigu/state/State.java
@@ -0,0 +1,20 @@
+package com.atguigu.state;
+
+/**
+ * 状态抽象类
+ * @author Administrator
+ *
+ */
+public abstract class State {
+
+
+ // 扣除积分 - 50
+ public abstract void deductMoney();
+
+ // 是否抽中奖品
+ public abstract boolean raffle();
+
+ // 发放奖品
+ public abstract void dispensePrize();
+
+}
diff --git a/desginPattern/src/com/atguigu/state/app.cld b/desginPattern/src/com/atguigu/state/app.cld
new file mode 100644
index 0000000..58ed4ac
--- /dev/null
+++ b/desginPattern/src/com/atguigu/state/app.cld
@@ -0,0 +1,1007 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 416
+ 32
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ deduceMoney
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ raffle
+ boolean
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ dispensePrize
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+
+ State
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 452
+ 305
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 434
+ 66
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 590
+ 299
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 635
+ 228
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ DispenseOutSate
+ false
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ 49
+ 207
+ 146
+ 15
+
+
+
+
+
+ Activity 绫 鍚墍鏈夌殑 鐘舵佸璞
+鍚勪釜鐘舵佸瓙绫讳篃鍚箟Activity瀵硅薄
+ Activity 绫 鍚墍鏈夌殑 鐘舵佸璞
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 64
+ 200
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Client
+ false
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 146
+ 116
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Activity
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ DispenseState
+ false
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ deduceMoney
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ raffle
+ boolean
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ dispensePrize
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ State
+ false
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ CanRaffleState
+ false
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 277
+ 308
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ NoRaffleState
+ false
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/state/money.cld b/desginPattern/src/com/atguigu/state/money.cld
new file mode 100644
index 0000000..2029088
--- /dev/null
+++ b/desginPattern/src/com/atguigu/state/money.cld
@@ -0,0 +1,975 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 303
+ 241
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ 98
+ 155
+ 471
+ 167
+
+
+
+
+
+
+
+ AbstrateState绫
+鎻愪緵鎺ュ彛鎵鏈夋柟娉曠殑榛樿瀹炵幇
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 208
+ 341
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 278
+ 436
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 357
+ 330
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ 89
+ 133
+ 515
+ 329
+
+
+
+
+
+
+
+ AbstractState 绫荤殑瀛愮被锛屽氨鏄叿浣撶殑鐘舵佺被
+, 鍙互鏍规嵁闇瑕佹湁閫夋嫨鐨勯噸鍐欑埗绫荤殑榛樿瀹炵幇
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 38
+ 120
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 33
+ 254
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Context
+ false
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Client
+ false
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ PublishState
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ StateEnum
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ FeedBackState
+ false
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 468
+ 291
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Class44
+ false
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ AbstrateState
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 298
+ 49
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation1
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation2
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation3
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation4
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation5
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+
+ State
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/state/money/AbstractState.java b/desginPattern/src/com/atguigu/state/money/AbstractState.java
new file mode 100644
index 0000000..4c2568d
--- /dev/null
+++ b/desginPattern/src/com/atguigu/state/money/AbstractState.java
@@ -0,0 +1,49 @@
+package com.atguigu.state.money;
+
+public abstract class AbstractState implements State {
+
+ protected static final RuntimeException EXCEPTION = new RuntimeException("操作流程不允许");
+
+ //抽象类,默认实现了 State 接口的所有方法
+ //该类的所有方法,其子类(具体的状态类),可以有选择的进行重写
+
+ @Override
+ public void checkEvent(Context context) {
+ throw EXCEPTION;
+ }
+
+ @Override
+ public void checkFailEvent(Context context) {
+ throw EXCEPTION;
+ }
+
+ @Override
+ public void makePriceEvent(Context context) {
+ throw EXCEPTION;
+ }
+
+ @Override
+ public void acceptOrderEvent(Context context) {
+ throw EXCEPTION;
+ }
+
+ @Override
+ public void notPeopleAcceptEvent(Context context) {
+ throw EXCEPTION;
+ }
+
+ @Override
+ public void payOrderEvent(Context context) {
+ throw EXCEPTION;
+ }
+
+ @Override
+ public void orderFailureEvent(Context context) {
+ throw EXCEPTION;
+ }
+
+ @Override
+ public void feedBackEvent(Context context) {
+ throw EXCEPTION;
+ }
+}
diff --git a/desginPattern/src/com/atguigu/state/money/AllState.java b/desginPattern/src/com/atguigu/state/money/AllState.java
new file mode 100644
index 0000000..6d02d45
--- /dev/null
+++ b/desginPattern/src/com/atguigu/state/money/AllState.java
@@ -0,0 +1,93 @@
+package com.atguigu.state.money;
+
+//各种具体状态类
+class FeedBackState extends AbstractState {
+
+ @Override
+ public String getCurrentState() {
+ return StateEnum.FEED_BACKED.getValue();
+ }
+}
+
+class GenerateState extends AbstractState {
+
+ @Override
+ public void checkEvent(Context context) {
+ context.setState(new ReviewState());
+ }
+
+ @Override
+ public void checkFailEvent(Context context) {
+ context.setState(new FeedBackState());
+ }
+
+ @Override
+ public String getCurrentState() {
+ return StateEnum.GENERATE.getValue();
+ }
+}
+
+class NotPayState extends AbstractState {
+
+ @Override
+ public void payOrderEvent(Context context) {
+ context.setState(new PaidState());
+ }
+
+ @Override
+ public void feedBackEvent(Context context) {
+ context.setState(new FeedBackState());
+ }
+
+ @Override
+ public String getCurrentState() {
+ return StateEnum.NOT_PAY.getValue();
+ }
+}
+
+class PaidState extends AbstractState {
+
+ @Override
+ public void feedBackEvent(Context context) {
+ context.setState(new FeedBackState());
+ }
+
+ @Override
+ public String getCurrentState() {
+ return StateEnum.PAID.getValue();
+ }
+}
+
+class PublishState extends AbstractState {
+
+ @Override
+ public void acceptOrderEvent(Context context) {
+ //把当前状态设置为 NotPayState。。。
+ //至于应该变成哪个状态,有流程图来决定
+ context.setState(new NotPayState());
+ }
+
+ @Override
+ public void notPeopleAcceptEvent(Context context) {
+ context.setState(new FeedBackState());
+ }
+
+ @Override
+ public String getCurrentState() {
+ return StateEnum.PUBLISHED.getValue();
+ }
+}
+
+class ReviewState extends AbstractState {
+
+ @Override
+ public void makePriceEvent(Context context) {
+ context.setState(new PublishState());
+ }
+
+ @Override
+ public String getCurrentState() {
+ return StateEnum.REVIEWED.getValue();
+ }
+
+}
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/state/money/ClientTest.java b/desginPattern/src/com/atguigu/state/money/ClientTest.java
new file mode 100644
index 0000000..f18f3e5
--- /dev/null
+++ b/desginPattern/src/com/atguigu/state/money/ClientTest.java
@@ -0,0 +1,29 @@
+package com.atguigu.state.money;
+
+/**测试类*/
+public class ClientTest {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ //创建context 对象
+ Context context = new Context();
+ //将当前状态设置为 PublishState
+ context.setState(new PublishState());
+ System.out.println(context.getCurrentState());
+
+// //publish --> not pay
+ context.acceptOrderEvent(context);
+// //not pay --> paid
+ context.payOrderEvent(context);
+// // 失败, 检测失败时,会抛出异常
+// try {
+// context.checkFailEvent(context);
+// System.out.println("流程正常..");
+// } catch (Exception e) {
+// // TODO: handle exception
+// System.out.println(e.getMessage());
+// }
+
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/state/money/Context.java b/desginPattern/src/com/atguigu/state/money/Context.java
new file mode 100644
index 0000000..76c8076
--- /dev/null
+++ b/desginPattern/src/com/atguigu/state/money/Context.java
@@ -0,0 +1,69 @@
+package com.atguigu.state.money;
+
+//环境上下文
+public class Context extends AbstractState{
+ //当前的状态 state, 根据我们的业务流程处理,不停的变化
+ private State state;
+
+ @Override
+ public void checkEvent(Context context) {
+ state.checkEvent(this);
+ getCurrentState();
+ }
+
+ @Override
+ public void checkFailEvent(Context context) {
+ state.checkFailEvent(this);
+ getCurrentState();
+ }
+
+ @Override
+ public void makePriceEvent(Context context) {
+ state.makePriceEvent(this);
+ getCurrentState();
+ }
+
+ @Override
+ public void acceptOrderEvent(Context context) {
+ state.acceptOrderEvent(this);
+ getCurrentState();
+ }
+
+ @Override
+ public void notPeopleAcceptEvent(Context context) {
+ state.notPeopleAcceptEvent(this);
+ getCurrentState();
+ }
+
+ @Override
+ public void payOrderEvent(Context context) {
+ state.payOrderEvent(this);
+ getCurrentState();
+ }
+
+ @Override
+ public void orderFailureEvent(Context context) {
+ state.orderFailureEvent(this);
+ getCurrentState();
+ }
+
+ @Override
+ public void feedBackEvent(Context context) {
+ state.feedBackEvent(this);
+ getCurrentState();
+ }
+
+ public State getState() {
+ return state;
+ }
+
+ public void setState(State state) {
+ this.state = state;
+ }
+
+ @Override
+ public String getCurrentState() {
+ System.out.println("当前状态 : " + state.getCurrentState());
+ return state.getCurrentState();
+ }
+}
diff --git a/desginPattern/src/com/atguigu/state/money/State.java b/desginPattern/src/com/atguigu/state/money/State.java
new file mode 100644
index 0000000..44a9f46
--- /dev/null
+++ b/desginPattern/src/com/atguigu/state/money/State.java
@@ -0,0 +1,52 @@
+package com.atguigu.state.money;
+
+/**
+ * 状态接口
+ * @author Administrator
+ *
+ */
+public interface State {
+
+ /**
+ * 电审
+ */
+ void checkEvent(Context context);
+
+ /**
+ * 电审失败
+ */
+ void checkFailEvent(Context context);
+
+ /**
+ * 定价发布
+ */
+ void makePriceEvent(Context context);
+
+ /**
+ * 接单
+ */
+ void acceptOrderEvent(Context context);
+
+ /**
+ * 无人接单失效
+ */
+ void notPeopleAcceptEvent(Context context);
+
+ /**
+ * 付款
+ */
+ void payOrderEvent(Context context);
+
+ /**
+ * 接单有人支付失效
+ */
+ void orderFailureEvent(Context context);
+
+ /**
+ * 反馈
+ */
+ void feedBackEvent(Context context);
+
+
+ String getCurrentState();
+}
diff --git a/desginPattern/src/com/atguigu/state/money/StateEnum.java b/desginPattern/src/com/atguigu/state/money/StateEnum.java
new file mode 100644
index 0000000..afbf787
--- /dev/null
+++ b/desginPattern/src/com/atguigu/state/money/StateEnum.java
@@ -0,0 +1,37 @@
+package com.atguigu.state.money;
+
+/**
+ * 状态枚举类
+ * @author Administrator
+ *
+ */
+public enum StateEnum {
+
+ //订单生成
+ GENERATE(1, "GENERATE"),
+
+ //已审核
+ REVIEWED(2, "REVIEWED"),
+
+ //已发布
+ PUBLISHED(3, "PUBLISHED"),
+
+ //待付款
+ NOT_PAY(4, "NOT_PAY"),
+
+ //已付款
+ PAID(5, "PAID"),
+
+ //已完结
+ FEED_BACKED(6, "FEED_BACKED");
+
+ private int key;
+ private String value;
+
+ StateEnum(int key, String value) {
+ this.key = key;
+ this.value = value;
+ }
+ public int getKey() {return key;}
+ public String getValue() {return value;}
+}
diff --git a/desginPattern/src/com/atguigu/state/newfile.cld b/desginPattern/src/com/atguigu/state/newfile.cld
new file mode 100644
index 0000000..eea964b
--- /dev/null
+++ b/desginPattern/src/com/atguigu/state/newfile.cld
@@ -0,0 +1,430 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 432
+ 99
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 119
+ 104
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ state
+ State
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ getState
+ State
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Context
+ false
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 316
+ 255
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ ConcreteStateA
+ false
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 516
+ 253
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ ConcreteStateB
+ false
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation1
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation2
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+
+ State
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/strategy/Client.java b/desginPattern/src/com/atguigu/strategy/Client.java
new file mode 100644
index 0000000..c9f08a5
--- /dev/null
+++ b/desginPattern/src/com/atguigu/strategy/Client.java
@@ -0,0 +1,10 @@
+package com.atguigu.strategy;
+
+public class Client {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ //测试
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/strategy/Duck.java b/desginPattern/src/com/atguigu/strategy/Duck.java
new file mode 100644
index 0000000..cfc48af
--- /dev/null
+++ b/desginPattern/src/com/atguigu/strategy/Duck.java
@@ -0,0 +1,26 @@
+package com.atguigu.strategy;
+
+/**
+ * 鸭子抽象类
+ */
+public abstract class Duck {
+
+ public Duck() {
+
+ }
+
+ public abstract void display();//显示鸭子信息
+
+ public void quack() {
+ System.out.println("鸭子嘎嘎叫~~");
+ }
+
+ public void swim() {
+ System.out.println("鸭子会游泳~~");
+ }
+
+ public void fly() {
+ System.out.println("鸭子会飞翔~~~");
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/strategy/PekingDuck.java b/desginPattern/src/com/atguigu/strategy/PekingDuck.java
new file mode 100644
index 0000000..8a21535
--- /dev/null
+++ b/desginPattern/src/com/atguigu/strategy/PekingDuck.java
@@ -0,0 +1,21 @@
+package com.atguigu.strategy;
+
+/**
+ * 北京鸭类
+ */
+public class PekingDuck extends Duck {
+
+ @Override
+ public void display() {
+ // TODO Auto-generated method stub
+ System.out.println("~~北京鸭~~~");
+ }
+
+ //因为北京鸭不能飞翔,因此需要重写fly
+ @Override
+ public void fly() {
+ // TODO Auto-generated method stub
+ System.out.println("北京鸭不能飞翔");
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/strategy/ToyDuck.java b/desginPattern/src/com/atguigu/strategy/ToyDuck.java
new file mode 100644
index 0000000..cc6e1b9
--- /dev/null
+++ b/desginPattern/src/com/atguigu/strategy/ToyDuck.java
@@ -0,0 +1,29 @@
+package com.atguigu.strategy;
+
+/**
+ * 玩具鸭类
+ */
+public class ToyDuck extends Duck {
+
+ @Override
+ public void display() {
+ // TODO Auto-generated method stub
+ System.out.println("玩具鸭");
+ }
+
+ /**
+ * 需要重写父类的所有方法
+ */
+
+ public void quack() {
+ System.out.println("玩具鸭不能叫~~");
+ }
+
+ public void swim() {
+ System.out.println("玩具鸭不会游泳~~");
+ }
+
+ public void fly() {
+ System.out.println("玩具鸭不会飞翔~~~");
+ }
+}
diff --git a/desginPattern/src/com/atguigu/strategy/WildDuck.java b/desginPattern/src/com/atguigu/strategy/WildDuck.java
new file mode 100644
index 0000000..ba8966f
--- /dev/null
+++ b/desginPattern/src/com/atguigu/strategy/WildDuck.java
@@ -0,0 +1,14 @@
+package com.atguigu.strategy;
+
+/**
+ * 野鸭类
+ */
+public class WildDuck extends Duck {
+
+ @Override
+ public void display() {
+ // TODO Auto-generated method stub
+ System.out.println(" 这是野鸭 ");
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/strategy/improve/BadFlyBehavior.java b/desginPattern/src/com/atguigu/strategy/improve/BadFlyBehavior.java
new file mode 100644
index 0000000..e11025e
--- /dev/null
+++ b/desginPattern/src/com/atguigu/strategy/improve/BadFlyBehavior.java
@@ -0,0 +1,11 @@
+package com.atguigu.strategy.improve;
+
+public class BadFlyBehavior implements FlyBehavior {
+
+ @Override
+ public void fly() {
+ // TODO Auto-generated method stub
+ System.out.println(" 飞翔技术一般 ");
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/strategy/improve/Client.java b/desginPattern/src/com/atguigu/strategy/improve/Client.java
new file mode 100644
index 0000000..74ef4ba
--- /dev/null
+++ b/desginPattern/src/com/atguigu/strategy/improve/Client.java
@@ -0,0 +1,20 @@
+package com.atguigu.strategy.improve;
+
+public class Client {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ WildDuck wildDuck = new WildDuck();
+ wildDuck.fly();
+
+ PekingDuck pekingDuck = new PekingDuck();
+ pekingDuck.fly();
+
+ /**
+ * 动态改变某个对象的行为, 北京鸭 不能飞
+ */
+ pekingDuck.setFlyBehavior(new NoFlyBehavior());
+ System.out.println("-----------------------");
+ pekingDuck.fly();
+ }
+}
diff --git a/desginPattern/src/com/atguigu/strategy/improve/Duck.java b/desginPattern/src/com/atguigu/strategy/improve/Duck.java
new file mode 100644
index 0000000..d12074d
--- /dev/null
+++ b/desginPattern/src/com/atguigu/strategy/improve/Duck.java
@@ -0,0 +1,52 @@
+package com.atguigu.strategy.improve;
+
+/**
+ * 鸭子抽象类
+ */
+public abstract class Duck {
+
+ //属性, 策略接口
+ FlyBehavior flyBehavior;
+ //其它属性<->策略接口
+ QuackBehavior quackBehavior;
+
+ public Duck() {
+
+ }
+
+ public abstract void display();//显示鸭子信息
+
+ public void quack() {
+ System.out.println("鸭子嘎嘎叫~~");
+ }
+
+ public void swim() {
+ System.out.println("鸭子会游泳~~");
+ }
+
+ public void fly() {
+ //改进
+ if(flyBehavior != null) {
+ flyBehavior.fly();
+ }
+ }
+
+ /**
+ * 设置 飞翔方法的策略
+ * @param flyBehavior
+ */
+ public void setFlyBehavior(FlyBehavior flyBehavior) {
+ this.flyBehavior = flyBehavior;
+ }
+
+ /**
+ * 设置 鸭子叫方法的策略
+ * @param quackBehavior
+ */
+ public void setQuackBehavior(QuackBehavior quackBehavior) {
+ this.quackBehavior = quackBehavior;
+ }
+
+
+
+}
diff --git a/desginPattern/src/com/atguigu/strategy/improve/FlyBehavior.java b/desginPattern/src/com/atguigu/strategy/improve/FlyBehavior.java
new file mode 100644
index 0000000..3e7881b
--- /dev/null
+++ b/desginPattern/src/com/atguigu/strategy/improve/FlyBehavior.java
@@ -0,0 +1,9 @@
+package com.atguigu.strategy.improve;
+
+/**
+ * 飞翔方法 接口
+ */
+public interface FlyBehavior {
+
+ void fly(); // 子类具体实现
+}
diff --git a/desginPattern/src/com/atguigu/strategy/improve/GoodFlyBehavior.java b/desginPattern/src/com/atguigu/strategy/improve/GoodFlyBehavior.java
new file mode 100644
index 0000000..d6d9408
--- /dev/null
+++ b/desginPattern/src/com/atguigu/strategy/improve/GoodFlyBehavior.java
@@ -0,0 +1,12 @@
+package com.atguigu.strategy.improve;
+
+
+public class GoodFlyBehavior implements FlyBehavior {
+
+ @Override
+ public void fly() {
+ // TODO Auto-generated method stub
+ System.out.println(" 飞翔技术高超 ~~~");
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/strategy/improve/NoFlyBehavior.java b/desginPattern/src/com/atguigu/strategy/improve/NoFlyBehavior.java
new file mode 100644
index 0000000..750995d
--- /dev/null
+++ b/desginPattern/src/com/atguigu/strategy/improve/NoFlyBehavior.java
@@ -0,0 +1,11 @@
+package com.atguigu.strategy.improve;
+
+public class NoFlyBehavior implements FlyBehavior{
+
+ @Override
+ public void fly() {
+ // TODO Auto-generated method stub
+ System.out.println(" 不会飞翔 ");
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/strategy/improve/PekingDuck.java b/desginPattern/src/com/atguigu/strategy/improve/PekingDuck.java
new file mode 100644
index 0000000..5548af8
--- /dev/null
+++ b/desginPattern/src/com/atguigu/strategy/improve/PekingDuck.java
@@ -0,0 +1,19 @@
+package com.atguigu.strategy.improve;
+
+public class PekingDuck extends Duck {
+
+ /**
+ * 通过自定义策略,改变对象属性
+ * 假如北京鸭可以飞翔,但是飞翔技术一般
+ */
+ public PekingDuck() {
+ flyBehavior = new BadFlyBehavior();
+ }
+
+ @Override
+ public void display() {
+ // TODO Auto-generated method stub
+ System.out.println("~~北京鸭~~~");
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/strategy/improve/QuackBehavior.java b/desginPattern/src/com/atguigu/strategy/improve/QuackBehavior.java
new file mode 100644
index 0000000..6a98ab5
--- /dev/null
+++ b/desginPattern/src/com/atguigu/strategy/improve/QuackBehavior.java
@@ -0,0 +1,5 @@
+package com.atguigu.strategy.improve;
+
+public interface QuackBehavior {
+ void quack();//子类实现
+}
diff --git a/desginPattern/src/com/atguigu/strategy/improve/ToyDuck.java b/desginPattern/src/com/atguigu/strategy/improve/ToyDuck.java
new file mode 100644
index 0000000..921f8c3
--- /dev/null
+++ b/desginPattern/src/com/atguigu/strategy/improve/ToyDuck.java
@@ -0,0 +1,28 @@
+package com.atguigu.strategy.improve;
+
+public class ToyDuck extends Duck{
+
+
+ public ToyDuck() {
+ // TODO Auto-generated constructor stub
+ flyBehavior = new NoFlyBehavior();
+ }
+
+ @Override
+ public void display() {
+ // TODO Auto-generated method stub
+ System.out.println("玩具鸭");
+ }
+
+ //需要重写父类的所有方法
+
+ public void quack() {
+ System.out.println("玩具鸭不能叫~~");
+ }
+
+ public void swim() {
+ System.out.println("玩具鸭不会游泳~~");
+ }
+
+
+}
diff --git a/desginPattern/src/com/atguigu/strategy/improve/WildDuck.java b/desginPattern/src/com/atguigu/strategy/improve/WildDuck.java
new file mode 100644
index 0000000..9306dc5
--- /dev/null
+++ b/desginPattern/src/com/atguigu/strategy/improve/WildDuck.java
@@ -0,0 +1,19 @@
+package com.atguigu.strategy.improve;
+
+public class WildDuck extends Duck {
+
+
+ //构造器,传入FlyBehavor 的对象
+ public WildDuck() {
+ // TODO Auto-generated constructor stub
+ flyBehavior = new GoodFlyBehavior();
+ }
+
+
+ @Override
+ public void display() {
+ // TODO Auto-generated method stub
+ System.out.println(" 这是野鸭 ");
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/strategy/improve/duck.cld b/desginPattern/src/com/atguigu/strategy/improve/duck.cld
new file mode 100644
index 0000000..3fb4660
--- /dev/null
+++ b/desginPattern/src/com/atguigu/strategy/improve/duck.cld
@@ -0,0 +1,1177 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 697
+ 172
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ NoFlyBehavior
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 680
+ 17
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ GoodFlyBehavior
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 690
+ 89
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ BadFlyBehavior
+ false
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 463
+ 82
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 13
+ 388
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ PekingDuck(鍖椾含楦被)
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 188
+ 390
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ WildDuck (閲庨腑绫)
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 338
+ 391
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ ToyDuck (鐜╁叿楦)
+ false
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 58
+ 211
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 680
+ 333
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ GeGeQuackBehavior
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 675
+ 249
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ GaGaQuackBehavior
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 686
+ 429
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ NoQuackBehavior
+ false
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 459
+ 310
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ quack
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+
+ QuackBehavor (鍙帴鍙)
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ flyBehavior
+ FlyBehavior (椋炵繑鎺ュ彛)
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ quackBehavior
+ QuackBehavior(鍙帴鍙)
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Duck (楦瓙鎶借薄绫)
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ fly
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+
+ FlyBehavior (椋炵繑鎺ュ彛)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/strategy/newfile.cld b/desginPattern/src/com/atguigu/strategy/newfile.cld
new file mode 100644
index 0000000..d24995b
--- /dev/null
+++ b/desginPattern/src/com/atguigu/strategy/newfile.cld
@@ -0,0 +1,461 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 51
+ 247
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ WildDuck (閲庨腑绫)
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 218
+ 245
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ PekingDuck (鍖椾含楦)
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 415
+ 246
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ ToyDuck (鐜╁叿楦)
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ 30
+ 100
+ 416
+ 88
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 198
+ 69
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ quack
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ swim
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ fly
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Duck (楦瓙鎶借薄绫)
+ false
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/strategy/strategy.cld b/desginPattern/src/com/atguigu/strategy/strategy.cld
new file mode 100644
index 0000000..1c201d0
--- /dev/null
+++ b/desginPattern/src/com/atguigu/strategy/strategy.cld
@@ -0,0 +1,789 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 591
+ 218
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ ConcreteStrategyA (鍏蜂綋绛栫暐绫籄)
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 598
+ 320
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ ConcreteStrategyB (鍏蜂綋绛栫暐绫籅)
+ false
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 394
+ 218
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 382
+ 65
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 621
+ 34
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ ConcreteStrategyC
+ false
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 623
+ 112
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ ConcreteStrategyD
+ false
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation1
+ void
+
+ false
+ false
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation2
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+
+ StrategyB (绛栫暐鎺ュ彛B)
+
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 15
+ 136
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ strategy1
+ Strategy (绛栫暐鎺ュ彛A)
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ strategy2
+ StrategyB (绛栫暐鎺ュ彛B)
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Context
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation1
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation2
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+
+ Strategy (绛栫暐鎺ュ彛A)
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/template/Client.java b/desginPattern/src/com/atguigu/template/Client.java
new file mode 100644
index 0000000..e849351
--- /dev/null
+++ b/desginPattern/src/com/atguigu/template/Client.java
@@ -0,0 +1,18 @@
+package com.atguigu.template;
+
+public class Client {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ //制作红豆豆浆
+
+ System.out.println("----制作红豆豆浆----");
+ SoyaMilk redBeanSoyaMilk = new RedBeanSoyaMilk();
+ redBeanSoyaMilk.make();
+
+ System.out.println("----制作花生豆浆----");
+ SoyaMilk peanutSoyaMilk = new PeanutSoyaMilk();
+ peanutSoyaMilk.make();
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/template/PeanutSoyaMilk.java b/desginPattern/src/com/atguigu/template/PeanutSoyaMilk.java
new file mode 100644
index 0000000..9195bb5
--- /dev/null
+++ b/desginPattern/src/com/atguigu/template/PeanutSoyaMilk.java
@@ -0,0 +1,11 @@
+package com.atguigu.template;
+
+public class PeanutSoyaMilk extends SoyaMilk {
+
+ @Override
+ void addCondiments() {
+ // TODO Auto-generated method stub
+ System.out.println(" 加入上好的花生 ");
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/template/RedBeanSoyaMilk.java b/desginPattern/src/com/atguigu/template/RedBeanSoyaMilk.java
new file mode 100644
index 0000000..a2f4a24
--- /dev/null
+++ b/desginPattern/src/com/atguigu/template/RedBeanSoyaMilk.java
@@ -0,0 +1,11 @@
+package com.atguigu.template;
+
+public class RedBeanSoyaMilk extends SoyaMilk {
+
+ @Override
+ void addCondiments() {
+ // TODO Auto-generated method stub
+ System.out.println(" 加入上好的红豆 ");
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/template/SoyaMilk.java b/desginPattern/src/com/atguigu/template/SoyaMilk.java
new file mode 100644
index 0000000..40695b4
--- /dev/null
+++ b/desginPattern/src/com/atguigu/template/SoyaMilk.java
@@ -0,0 +1,32 @@
+package com.atguigu.template;
+
+//抽象类,表示豆浆
+public abstract class SoyaMilk {
+
+ //模板方法, make , 模板方法可以做成final , 不让子类去覆盖.
+ final void make() {
+
+ select();
+ addCondiments();
+ soak();
+ beat();
+
+ }
+
+ //选材料
+ void select() {
+ System.out.println("第一步:选择好的新鲜黄豆 ");
+ }
+
+ //添加不同的配料, 抽象方法, 子类具体实现
+ abstract void addCondiments();
+
+ //浸泡
+ void soak() {
+ System.out.println("第三步, 黄豆和配料开始浸泡, 需要3小时 ");
+ }
+
+ void beat() {
+ System.out.println("第四步:黄豆和配料放到豆浆机去打碎 ");
+ }
+}
diff --git a/desginPattern/src/com/atguigu/template/improve/Client.java b/desginPattern/src/com/atguigu/template/improve/Client.java
new file mode 100644
index 0000000..f4caed1
--- /dev/null
+++ b/desginPattern/src/com/atguigu/template/improve/Client.java
@@ -0,0 +1,22 @@
+package com.atguigu.template.improve;
+
+public class Client {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ //制作红豆豆浆
+
+ System.out.println("----制作红豆豆浆----");
+ SoyaMilk redBeanSoyaMilk = new RedBeanSoyaMilk();
+ redBeanSoyaMilk.make();
+
+ System.out.println("----制作花生豆浆----");
+ SoyaMilk peanutSoyaMilk = new PeanutSoyaMilk();
+ peanutSoyaMilk.make();
+
+ System.out.println("----制作纯豆浆----");
+ SoyaMilk pureSoyaMilk = new PureSoyaMilk();
+ pureSoyaMilk.make();
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/template/improve/PeanutSoyaMilk.java b/desginPattern/src/com/atguigu/template/improve/PeanutSoyaMilk.java
new file mode 100644
index 0000000..7085246
--- /dev/null
+++ b/desginPattern/src/com/atguigu/template/improve/PeanutSoyaMilk.java
@@ -0,0 +1,11 @@
+package com.atguigu.template.improve;
+
+public class PeanutSoyaMilk extends SoyaMilk {
+
+ @Override
+ void addCondiments() {
+ // TODO Auto-generated method stub
+ System.out.println(" 加入上好的花生 ");
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/template/improve/PureSoyaMilk.java b/desginPattern/src/com/atguigu/template/improve/PureSoyaMilk.java
new file mode 100644
index 0000000..3c1c489
--- /dev/null
+++ b/desginPattern/src/com/atguigu/template/improve/PureSoyaMilk.java
@@ -0,0 +1,17 @@
+package com.atguigu.template.improve;
+
+public class PureSoyaMilk extends SoyaMilk{
+
+ @Override
+ void addCondiments() {
+ // TODO Auto-generated method stub
+ //空实现
+ }
+
+ @Override
+ boolean customerWantCondiments() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/template/improve/RedBeanSoyaMilk.java b/desginPattern/src/com/atguigu/template/improve/RedBeanSoyaMilk.java
new file mode 100644
index 0000000..19d9685
--- /dev/null
+++ b/desginPattern/src/com/atguigu/template/improve/RedBeanSoyaMilk.java
@@ -0,0 +1,11 @@
+package com.atguigu.template.improve;
+
+public class RedBeanSoyaMilk extends SoyaMilk {
+
+ @Override
+ void addCondiments() {
+ // TODO Auto-generated method stub
+ System.out.println(" 加入上好的红豆 ");
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/template/improve/SoyaMilk.java b/desginPattern/src/com/atguigu/template/improve/SoyaMilk.java
new file mode 100644
index 0000000..21b8b01
--- /dev/null
+++ b/desginPattern/src/com/atguigu/template/improve/SoyaMilk.java
@@ -0,0 +1,39 @@
+package com.atguigu.template.improve;
+
+//抽象类,表示豆浆
+public abstract class SoyaMilk {
+
+ //模板方法, make , 模板方法可以做成final , 不让子类去覆盖.
+ final void make() {
+
+ select();
+ if(customerWantCondiments()) {
+ addCondiments();
+ }
+ soak();
+ beat();
+
+ }
+
+ //选材料
+ void select() {
+ System.out.println("第一步:选择好的新鲜黄豆 ");
+ }
+
+ //添加不同的配料, 抽象方法, 子类具体实现
+ abstract void addCondiments();
+
+ //浸泡
+ void soak() {
+ System.out.println("第三步, 黄豆和配料开始浸泡, 需要3小时 ");
+ }
+
+ void beat() {
+ System.out.println("第四步:黄豆和配料放到豆浆机去打碎 ");
+ }
+
+ //钩子方法,决定是否需要添加配料
+ boolean customerWantCondiments() {
+ return true;
+ }
+}
diff --git a/desginPattern/src/com/atguigu/template/newfile.cld b/desginPattern/src/com/atguigu/template/newfile.cld
new file mode 100644
index 0000000..eb5648a
--- /dev/null
+++ b/desginPattern/src/com/atguigu/template/newfile.cld
@@ -0,0 +1,547 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ 238
+ 201
+ 380
+ 31
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ template 妯℃澘鏂规硶
+1. 瑙勫畾浜嗙畻娉曞ぇ鑷寸殑娴佺▼
+template () {
+ operation2()
+ operation4()
+ operation3()
+}
+
+operation2,3,4, 鍙互鏄娊璞℃柟娉
+涔熷彲浠ユ槸瀹炵幇鏂规硶.
+
+濡傛灉鏄娊璞$殑鏂规硶锛屽氨鏀惧埌瀛愮被
+鍘诲疄鐜板嵆鍙
+ template 妯℃澘鏂规硶
+1. 瑙勫畾浜嗙畻娉曞ぇ鑷寸殑娴佺▼
+template () {
+ operation2()
+ operation4()
+ operation3()
+}
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 94
+ 262
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation2
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation3
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation4
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ ConcreteClass (鍏蜂綋瀛愮被)
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 162
+ 456
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Client
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 298
+ 453
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ ConcreteClassB
+ false
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 97
+ 78
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ template
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation2
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation3
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation4
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ AbstractClass (鎶借薄绫)
+ false
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/template/soyamilk.cld b/desginPattern/src/com/atguigu/template/soyamilk.cld
new file mode 100644
index 0000000..6175334
--- /dev/null
+++ b/desginPattern/src/com/atguigu/template/soyamilk.cld
@@ -0,0 +1,546 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ 127
+ 508
+ 251
+ 43
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ make() 鍒朵綔璞嗘祮鏂规硶, 鍏朵腑绗竴,涓,,鍥涙涓哄浐瀹氱殑娴佺▼
+select() 绗竴姝: 閫夋潗
+add() 绗簩姝:娣诲姞閰嶆枡,鍥犱负涓嶅悓鐨勮眴娴嗭紝閰嶆枡涓嶅悓锛屽洜姝ゅ仛鎴愭娊璞℃柟娉,鍏蜂綋璁╁瓙绫诲幓瀹炵幇
+soak() 绗笁姝: 娴告场
+beat() 绗洓姝: 鎵撶(
+
+
+ make() 鍒朵綔璞嗘祮鏂规硶, 鍏朵腑绗竴,涓,,鍥涙涓哄浐瀹氱殑娴佺▼
+select() 绗竴姝: 閫夋潗
+add() 绗簩姝:娣诲姞閰嶆枡,鍥犱负涓嶅悓鐨勮眴娴嗭紝閰嶆枡涓嶅悓锛屽洜姝ゅ仛鎴愭娊璞℃柟娉
+soak() 绗笁姝: 娴告场
+beat() 绗洓姝: 鎵撶(
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 11
+ 287
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ BlackBeanSoyaMilk (榛戣姖楹昏眴娴)
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 271
+ 293
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ pennutSoyaMilk (鑺辩敓璞嗘祮)
+ false
+
+
+
+
+ true
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 44
+ 159
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Client
+ false
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 97
+ 46
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ make
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ select
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ add
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ soak
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ beat
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ SoyaMilk
+ false
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/uml/Person.java b/desginPattern/src/com/atguigu/uml/Person.java
new file mode 100644
index 0000000..69ac923
--- /dev/null
+++ b/desginPattern/src/com/atguigu/uml/Person.java
@@ -0,0 +1,13 @@
+package com.atguigu.uml;
+
+public class Person{ //代码形式->类图
+ private Integer id;
+ private String name;
+ public void setName(String name){
+ this.name=name;
+ }
+ public String getName(){
+ return name;
+ }
+}
+
diff --git a/desginPattern/src/com/atguigu/uml/aggregation/Computer.java b/desginPattern/src/com/atguigu/uml/aggregation/Computer.java
new file mode 100644
index 0000000..51d494f
--- /dev/null
+++ b/desginPattern/src/com/atguigu/uml/aggregation/Computer.java
@@ -0,0 +1,13 @@
+package com.atguigu.uml.aggregation;
+
+public class Computer {
+ private Mouse mouse; //鼠标可以和computer分离
+ private Moniter moniter;//显示器可以和Computer分离
+ public void setMouse(Mouse mouse) {
+ this.mouse = mouse;
+ }
+ public void setMoniter(Moniter moniter) {
+ this.moniter = moniter;
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/uml/aggregation/Moniter.java b/desginPattern/src/com/atguigu/uml/aggregation/Moniter.java
new file mode 100644
index 0000000..3fd57af
--- /dev/null
+++ b/desginPattern/src/com/atguigu/uml/aggregation/Moniter.java
@@ -0,0 +1,5 @@
+package com.atguigu.uml.aggregation;
+
+public class Moniter {
+
+}
diff --git a/desginPattern/src/com/atguigu/uml/aggregation/Mouse.java b/desginPattern/src/com/atguigu/uml/aggregation/Mouse.java
new file mode 100644
index 0000000..8ea16ae
--- /dev/null
+++ b/desginPattern/src/com/atguigu/uml/aggregation/Mouse.java
@@ -0,0 +1,5 @@
+package com.atguigu.uml.aggregation;
+
+public class Mouse {
+
+}
diff --git a/desginPattern/src/com/atguigu/uml/aggregation/newfile.cld b/desginPattern/src/com/atguigu/uml/aggregation/newfile.cld
new file mode 100644
index 0000000..c45c47e
--- /dev/null
+++ b/desginPattern/src/com/atguigu/uml/aggregation/newfile.cld
@@ -0,0 +1,303 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 359
+ 135
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 259
+ 276
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Mouse
+ false
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 481
+ 270
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Moniter
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ mouse
+ Mouse
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ moniter
+ Moniter
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Computer
+ false
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/uml/composition/Computer.java b/desginPattern/src/com/atguigu/uml/composition/Computer.java
new file mode 100644
index 0000000..4c90db4
--- /dev/null
+++ b/desginPattern/src/com/atguigu/uml/composition/Computer.java
@@ -0,0 +1,13 @@
+package com.atguigu.uml.composition;
+
+public class Computer {
+ private Mouse mouse = new Mouse(); //鼠标可以和computer不能分离
+ private Moniter moniter = new Moniter();//显示器可以和Computer不能分离
+ public void setMouse(Mouse mouse) {
+ this.mouse = mouse;
+ }
+ public void setMoniter(Moniter moniter) {
+ this.moniter = moniter;
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/uml/composition/Head.java b/desginPattern/src/com/atguigu/uml/composition/Head.java
new file mode 100644
index 0000000..1b3f64d
--- /dev/null
+++ b/desginPattern/src/com/atguigu/uml/composition/Head.java
@@ -0,0 +1,5 @@
+package com.atguigu.uml.composition;
+
+public class Head {
+
+}
diff --git a/desginPattern/src/com/atguigu/uml/composition/IDCard.java b/desginPattern/src/com/atguigu/uml/composition/IDCard.java
new file mode 100644
index 0000000..8bea2af
--- /dev/null
+++ b/desginPattern/src/com/atguigu/uml/composition/IDCard.java
@@ -0,0 +1,5 @@
+package com.atguigu.uml.composition;
+
+public class IDCard {
+
+}
diff --git a/desginPattern/src/com/atguigu/uml/composition/Moniter.java b/desginPattern/src/com/atguigu/uml/composition/Moniter.java
new file mode 100644
index 0000000..23f7820
--- /dev/null
+++ b/desginPattern/src/com/atguigu/uml/composition/Moniter.java
@@ -0,0 +1,5 @@
+package com.atguigu.uml.composition;
+
+public class Moniter {
+
+}
diff --git a/desginPattern/src/com/atguigu/uml/composition/Mouse.java b/desginPattern/src/com/atguigu/uml/composition/Mouse.java
new file mode 100644
index 0000000..78ed04f
--- /dev/null
+++ b/desginPattern/src/com/atguigu/uml/composition/Mouse.java
@@ -0,0 +1,5 @@
+package com.atguigu.uml.composition;
+
+public class Mouse {
+
+}
diff --git a/desginPattern/src/com/atguigu/uml/composition/Person.java b/desginPattern/src/com/atguigu/uml/composition/Person.java
new file mode 100644
index 0000000..9d7ceac
--- /dev/null
+++ b/desginPattern/src/com/atguigu/uml/composition/Person.java
@@ -0,0 +1,7 @@
+package com.atguigu.uml.composition;
+
+public class Person {
+ private IDCard card; //聚合关系
+ private Head head = new Head(); //组合关系
+
+}
diff --git a/desginPattern/src/com/atguigu/uml/composition/newfile.cld b/desginPattern/src/com/atguigu/uml/composition/newfile.cld
new file mode 100644
index 0000000..ffdbb71
--- /dev/null
+++ b/desginPattern/src/com/atguigu/uml/composition/newfile.cld
@@ -0,0 +1,332 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 259
+ 276
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Mouse
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 481
+ 270
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Moniter
+ false
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 359
+ 135
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ mouse
+ Mouse
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ moniter
+ Moniter
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Computer
+ false
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/uml/composition/newfile2.cld b/desginPattern/src/com/atguigu/uml/composition/newfile2.cld
new file mode 100644
index 0000000..51f5766
--- /dev/null
+++ b/desginPattern/src/com/atguigu/uml/composition/newfile2.cld
@@ -0,0 +1,303 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 281
+ 143
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 202
+ 279
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Head
+ false
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 433
+ 272
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ IDCard
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ idCard
+ IDCard
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ head
+ Head = new Head()
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Person
+ false
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/uml/dependence/Department.java b/desginPattern/src/com/atguigu/uml/dependence/Department.java
new file mode 100644
index 0000000..c2f813f
--- /dev/null
+++ b/desginPattern/src/com/atguigu/uml/dependence/Department.java
@@ -0,0 +1,5 @@
+package com.atguigu.uml.dependence;
+
+public class Department {
+
+}
diff --git a/desginPattern/src/com/atguigu/uml/dependence/IDCard.java b/desginPattern/src/com/atguigu/uml/dependence/IDCard.java
new file mode 100644
index 0000000..758f65f
--- /dev/null
+++ b/desginPattern/src/com/atguigu/uml/dependence/IDCard.java
@@ -0,0 +1,5 @@
+package com.atguigu.uml.dependence;
+
+public class IDCard {
+
+}
diff --git a/desginPattern/src/com/atguigu/uml/dependence/Person.java b/desginPattern/src/com/atguigu/uml/dependence/Person.java
new file mode 100644
index 0000000..ee10532
--- /dev/null
+++ b/desginPattern/src/com/atguigu/uml/dependence/Person.java
@@ -0,0 +1,5 @@
+package com.atguigu.uml.dependence;
+
+public class Person {
+
+}
diff --git a/desginPattern/src/com/atguigu/uml/dependence/PersonDao.java b/desginPattern/src/com/atguigu/uml/dependence/PersonDao.java
new file mode 100644
index 0000000..b3e643f
--- /dev/null
+++ b/desginPattern/src/com/atguigu/uml/dependence/PersonDao.java
@@ -0,0 +1,5 @@
+package com.atguigu.uml.dependence;
+
+public class PersonDao {
+
+}
diff --git a/desginPattern/src/com/atguigu/uml/dependence/PersonServiceBean.java b/desginPattern/src/com/atguigu/uml/dependence/PersonServiceBean.java
new file mode 100644
index 0000000..6ea0099
--- /dev/null
+++ b/desginPattern/src/com/atguigu/uml/dependence/PersonServiceBean.java
@@ -0,0 +1,17 @@
+package com.atguigu.uml.dependence;
+
+public class PersonServiceBean {
+ private PersonDao personDao;// 类
+
+ public void save(Person person) {
+ }
+
+ public IDCard getIDCard(Integer personid) {
+ return null;
+ }
+
+ public void modify() {
+ Department department = new Department();
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/uml/dependence/newfile.cld b/desginPattern/src/com/atguigu/uml/dependence/newfile.cld
new file mode 100644
index 0000000..5208d89
--- /dev/null
+++ b/desginPattern/src/com/atguigu/uml/dependence/newfile.cld
@@ -0,0 +1,550 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 234
+ 257
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 285
+ 48
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 555
+ 254
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Department
+ false
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 376
+ 256
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ PersonDao
+ false
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ personDao
+ PersonDao
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ save
+ void
+
+
+ person
+ Person
+
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ getIDCard
+ IDCard
+
+
+ personid
+ Integer
+
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ modify
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ PersonServiceBean
+ false
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Person
+ false
+
+
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 87
+ 253
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ IDCard
+ false
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/uml/generalization/DaoSupport.java b/desginPattern/src/com/atguigu/uml/generalization/DaoSupport.java
new file mode 100644
index 0000000..e6fba39
--- /dev/null
+++ b/desginPattern/src/com/atguigu/uml/generalization/DaoSupport.java
@@ -0,0 +1,9 @@
+package com.atguigu.uml.generalization;
+
+public abstract class DaoSupport{
+ public void save(Object entity){
+ }
+ public void delete(Object id){
+ }
+}
+
diff --git a/desginPattern/src/com/atguigu/uml/generalization/PersonServiceBean.java b/desginPattern/src/com/atguigu/uml/generalization/PersonServiceBean.java
new file mode 100644
index 0000000..bedd0db
--- /dev/null
+++ b/desginPattern/src/com/atguigu/uml/generalization/PersonServiceBean.java
@@ -0,0 +1,5 @@
+package com.atguigu.uml.generalization;
+
+public class PersonServiceBean extends DaoSupport {
+
+}
diff --git a/desginPattern/src/com/atguigu/uml/generalization/newfile.cld b/desginPattern/src/com/atguigu/uml/generalization/newfile.cld
new file mode 100644
index 0000000..f527792
--- /dev/null
+++ b/desginPattern/src/com/atguigu/uml/generalization/newfile.cld
@@ -0,0 +1,219 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 328
+ 111
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 301
+ 247
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ PersonServiceBean
+ false
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ save
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ delete
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ DaoSupport
+ false
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/uml/implementation/PersonService.java b/desginPattern/src/com/atguigu/uml/implementation/PersonService.java
new file mode 100644
index 0000000..ce691fa
--- /dev/null
+++ b/desginPattern/src/com/atguigu/uml/implementation/PersonService.java
@@ -0,0 +1,6 @@
+package com.atguigu.uml.implementation;
+
+public interface PersonService {
+ public void delete(Integer id);
+
+}
diff --git a/desginPattern/src/com/atguigu/uml/implementation/PersonServiceBean.java b/desginPattern/src/com/atguigu/uml/implementation/PersonServiceBean.java
new file mode 100644
index 0000000..97fa42a
--- /dev/null
+++ b/desginPattern/src/com/atguigu/uml/implementation/PersonServiceBean.java
@@ -0,0 +1,11 @@
+package com.atguigu.uml.implementation;
+
+public class PersonServiceBean implements PersonService{
+
+ @Override
+ public void delete(Integer id) {
+ // TODO Auto-generated method stub
+ System.out.println("delete..");
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/uml/implementation/newfile.cld b/desginPattern/src/com/atguigu/uml/implementation/newfile.cld
new file mode 100644
index 0000000..53c2a65
--- /dev/null
+++ b/desginPattern/src/com/atguigu/uml/implementation/newfile.cld
@@ -0,0 +1,224 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 305
+ 141
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 293
+ 299
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ delete
+ void
+
+
+ id
+ Integer
+
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ com.atguigu.uml.implementation.PersonServiceBean
+ false
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ delete
+ void
+
+
+ id
+ Integer
+
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+
+ com.atguigu.uml.implementation.PersonService
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/uml/newfile.cld b/desginPattern/src/com/atguigu/uml/newfile.cld
new file mode 100644
index 0000000..2fabc27
--- /dev/null
+++ b/desginPattern/src/com/atguigu/uml/newfile.cld
@@ -0,0 +1,295 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 289
+ 176
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 346
+ 375
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Class1
+ false
+
+
+
+ 0.5
+
+ 164
+ 100
+
+
+ 168
+ -63
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ id
+ Integer
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ name
+ String
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ setName
+ void
+
+
+ name
+ String
+
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ getName
+ String
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ com.atguigu.uml.Person
+ false
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/visitor/Action.java b/desginPattern/src/com/atguigu/visitor/Action.java
new file mode 100644
index 0000000..d800e06
--- /dev/null
+++ b/desginPattern/src/com/atguigu/visitor/Action.java
@@ -0,0 +1,10 @@
+package com.atguigu.visitor;
+
+public abstract class Action {
+
+ //得到男性 的测评
+ public abstract void getManResult(Man man);
+
+ //得到女的 测评
+ public abstract void getWomanResult(Woman woman);
+}
diff --git a/desginPattern/src/com/atguigu/visitor/Client.java b/desginPattern/src/com/atguigu/visitor/Client.java
new file mode 100644
index 0000000..065517a
--- /dev/null
+++ b/desginPattern/src/com/atguigu/visitor/Client.java
@@ -0,0 +1,28 @@
+package com.atguigu.visitor;
+
+public class Client {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ //创建ObjectStructure
+ ObjectStructure objectStructure = new ObjectStructure();
+
+ objectStructure.attach(new Man());
+ objectStructure.attach(new Woman());
+
+
+ //成功
+ Success success = new Success();
+ objectStructure.display(success);
+
+ System.out.println("===============");
+ Fail fail = new Fail();
+ objectStructure.display(fail);
+
+ System.out.println("=======给的是待定的测评========");
+
+ Wait wait = new Wait();
+ objectStructure.display(wait);
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/visitor/Fail.java b/desginPattern/src/com/atguigu/visitor/Fail.java
new file mode 100644
index 0000000..f25d191
--- /dev/null
+++ b/desginPattern/src/com/atguigu/visitor/Fail.java
@@ -0,0 +1,17 @@
+package com.atguigu.visitor;
+
+public class Fail extends Action {
+
+ @Override
+ public void getManResult(Man man) {
+ // TODO Auto-generated method stub
+ System.out.println(" 男人给的评价该歌手失败 !");
+ }
+
+ @Override
+ public void getWomanResult(Woman woman) {
+ // TODO Auto-generated method stub
+ System.out.println(" 女人给的评价该歌手失败 !");
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/visitor/Man.java b/desginPattern/src/com/atguigu/visitor/Man.java
new file mode 100644
index 0000000..e550b69
--- /dev/null
+++ b/desginPattern/src/com/atguigu/visitor/Man.java
@@ -0,0 +1,11 @@
+package com.atguigu.visitor;
+
+public class Man extends Person {
+
+ @Override
+ public void accept(Action action) {
+ // TODO Auto-generated method stub
+ action.getManResult(this);
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/visitor/ObjectStructure.java b/desginPattern/src/com/atguigu/visitor/ObjectStructure.java
new file mode 100644
index 0000000..27bba04
--- /dev/null
+++ b/desginPattern/src/com/atguigu/visitor/ObjectStructure.java
@@ -0,0 +1,27 @@
+package com.atguigu.visitor;
+
+import java.util.LinkedList;
+import java.util.List;
+
+//数据结构,管理很多人(Man , Woman)
+public class ObjectStructure {
+
+ //维护了一个集合
+ private List persons = new LinkedList<>();
+
+ //增加到list
+ public void attach(Person p) {
+ persons.add(p);
+ }
+ //移除
+ public void detach(Person p) {
+ persons.remove(p);
+ }
+
+ //显示测评情况
+ public void display(Action action) {
+ for(Person p: persons) {
+ p.accept(action);
+ }
+ }
+}
diff --git a/desginPattern/src/com/atguigu/visitor/Person.java b/desginPattern/src/com/atguigu/visitor/Person.java
new file mode 100644
index 0000000..2813853
--- /dev/null
+++ b/desginPattern/src/com/atguigu/visitor/Person.java
@@ -0,0 +1,7 @@
+package com.atguigu.visitor;
+
+public abstract class Person {
+
+ //提供一个方法,让访问者可以访问
+ public abstract void accept(Action action);
+}
diff --git a/desginPattern/src/com/atguigu/visitor/Success.java b/desginPattern/src/com/atguigu/visitor/Success.java
new file mode 100644
index 0000000..09f0ad2
--- /dev/null
+++ b/desginPattern/src/com/atguigu/visitor/Success.java
@@ -0,0 +1,17 @@
+package com.atguigu.visitor;
+
+public class Success extends Action {
+
+ @Override
+ public void getManResult(Man man) {
+ // TODO Auto-generated method stub
+ System.out.println(" 男人给的评价该歌手很成功 !");
+ }
+
+ @Override
+ public void getWomanResult(Woman woman) {
+ // TODO Auto-generated method stub
+ System.out.println(" 女人给的评价该歌手很成功 !");
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/visitor/Wait.java b/desginPattern/src/com/atguigu/visitor/Wait.java
new file mode 100644
index 0000000..5a5ae79
--- /dev/null
+++ b/desginPattern/src/com/atguigu/visitor/Wait.java
@@ -0,0 +1,17 @@
+package com.atguigu.visitor;
+
+public class Wait extends Action {
+
+ @Override
+ public void getManResult(Man man) {
+ // TODO Auto-generated method stub
+ System.out.println(" 男人给的评价是该歌手待定 ..");
+ }
+
+ @Override
+ public void getWomanResult(Woman woman) {
+ // TODO Auto-generated method stub
+ System.out.println(" 女人给的评价是该歌手待定 ..");
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/visitor/Woman.java b/desginPattern/src/com/atguigu/visitor/Woman.java
new file mode 100644
index 0000000..a3925f6
--- /dev/null
+++ b/desginPattern/src/com/atguigu/visitor/Woman.java
@@ -0,0 +1,15 @@
+package com.atguigu.visitor;
+
+//说明
+//1. 这里我们使用到了双分派, 即首先在客户端程序中,将具体状态作为参数传递Woman中(第一次分派)
+//2. 然后Woman 类调用作为参数的 "具体方法" 中方法getWomanResult, 同时将自己(this)作为参数
+// 传入,完成第二次的分派
+public class Woman extends Person{
+
+ @Override
+ public void accept(Action action) {
+ // TODO Auto-generated method stub
+ action.getWomanResult(this);
+ }
+
+}
diff --git a/desginPattern/src/com/atguigu/visitor/newfile.cld b/desginPattern/src/com/atguigu/visitor/newfile.cld
new file mode 100644
index 0000000..213348a
--- /dev/null
+++ b/desginPattern/src/com/atguigu/visitor/newfile.cld
@@ -0,0 +1,687 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 358
+ 59
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 253
+ 204
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation1
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation2
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ ConcreteVisitor
+ false
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 486
+ 307
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 97
+ 317
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 105
+ 85
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Client
+ false
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ element
+ Element
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ ObjectStruture
+ false
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 396
+ 401
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ accept
+ void
+
+
+ vistor
+ Visitor
+
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ ConcreteElement
+ false
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ accept
+ void
+
+
+ visitor
+ Visitor
+
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Element
+ false
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation1
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation2
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Visitor
+ false
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/desginPattern/src/com/atguigu/visitor/singer.cld b/desginPattern/src/com/atguigu/visitor/singer.cld
new file mode 100644
index 0000000..885606a
--- /dev/null
+++ b/desginPattern/src/com/atguigu/visitor/singer.cld
@@ -0,0 +1,1083 @@
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 206
+
+
+ 0
+ 0
+ 0
+
+ true
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 141
+ 193
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation1
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation2
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Success
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 300
+ 195
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation1
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation2
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Fail
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 490
+ 277
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 93
+ 300
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 34
+ 85
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Client
+ false
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ elements
+ Person
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ ObjectStructure
+ false
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 371
+ 372
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ accept
+ void
+
+
+ action
+ Action
+
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Man
+ false
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 613
+ 370
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ accept
+ void
+
+
+ action
+ Action
+
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Woman
+ false
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ accept
+ void
+
+
+ action
+ Action
+
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Person
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 240
+ 83
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ 2
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ -1
+ -1
+ 509
+ 184
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation1
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation2
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Wait
+ false
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation1
+ void
+
+ false
+ false
+
+
+
+
+ true
+
+
+
+
+
+ 2
+
+
+
+
+
+ operation2
+ void
+
+ false
+ false
+
+
+
+
+
+ _stereo_type
+ Stereo Type
+ false
+
+
+ _simpleEntityName
+ Simple Name
+ false
+
+
+ _entityName
+ Name
+ false
+
+
+ _background
+ Background Color
+ false
+
+
+ _attrs
+ Attributes...
+ false
+
+
+ _operations
+ Operations...
+ false
+
+
+ _abstract
+ abstract
+ false
+
+
+
+ Action
+ false
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file