From d1a785b12301feb09babca3e6e72b79513bd94c1 Mon Sep 17 00:00:00 2001
From: jy <977996067@qq.com>
Date: Thu, 27 Jul 2017 23:27:49 +0800
Subject: [PATCH 1/9] Add Decorator&Composition&Bridge pattern homework

---
 .../coderising/dp/week2/bridge/Circle.java    | 15 ++++++
 .../dp/week2/bridge/DrawClient.java           |  9 ++++
 .../coderising/dp/week2/bridge/Drawing.java   |  8 +++
 .../dp/week2/bridge/DrawingGL1.java           | 14 +++++
 .../dp/week2/bridge/DrawingGL2.java           | 14 +++++
 .../coderising/dp/week2/bridge/Rectangle.java | 15 ++++++
 .../com/coderising/dp/week2/bridge/Shape.java | 16 ++++++
 .../coderising/dp/week2/composition/Line.java |  9 ++++
 .../dp/week2/composition/Picture.java         | 18 +++++++
 .../dp/week2/composition/Rectangle.java       |  9 ++++
 .../dp/week2/composition/Shape.java           |  6 +++
 .../dp/week2/composition/ShapeClient.java     | 17 +++++++
 .../dp/week2/composition/Square.java          |  9 ++++
 .../coderising/dp/week2/composition/Text.java |  9 ++++
 .../coderising/dp/week2/decorator/Email.java  |  6 +++
 .../dp/week2/decorator/EmailDecorator.java    | 51 +++++++++++++++++++
 .../dp/week2/decorator/EmailImpl.java         | 15 ++++++
 .../dp/week2/decorator/EmailType.java         |  6 +++
 18 files changed, 246 insertions(+)
 create mode 100644 students/977996067/src/main/java/com/coderising/dp/week2/bridge/Circle.java
 create mode 100644 students/977996067/src/main/java/com/coderising/dp/week2/bridge/DrawClient.java
 create mode 100644 students/977996067/src/main/java/com/coderising/dp/week2/bridge/Drawing.java
 create mode 100644 students/977996067/src/main/java/com/coderising/dp/week2/bridge/DrawingGL1.java
 create mode 100644 students/977996067/src/main/java/com/coderising/dp/week2/bridge/DrawingGL2.java
 create mode 100644 students/977996067/src/main/java/com/coderising/dp/week2/bridge/Rectangle.java
 create mode 100644 students/977996067/src/main/java/com/coderising/dp/week2/bridge/Shape.java
 create mode 100644 students/977996067/src/main/java/com/coderising/dp/week2/composition/Line.java
 create mode 100644 students/977996067/src/main/java/com/coderising/dp/week2/composition/Picture.java
 create mode 100644 students/977996067/src/main/java/com/coderising/dp/week2/composition/Rectangle.java
 create mode 100644 students/977996067/src/main/java/com/coderising/dp/week2/composition/Shape.java
 create mode 100644 students/977996067/src/main/java/com/coderising/dp/week2/composition/ShapeClient.java
 create mode 100644 students/977996067/src/main/java/com/coderising/dp/week2/composition/Square.java
 create mode 100644 students/977996067/src/main/java/com/coderising/dp/week2/composition/Text.java
 create mode 100644 students/977996067/src/main/java/com/coderising/dp/week2/decorator/Email.java
 create mode 100644 students/977996067/src/main/java/com/coderising/dp/week2/decorator/EmailDecorator.java
 create mode 100644 students/977996067/src/main/java/com/coderising/dp/week2/decorator/EmailImpl.java
 create mode 100644 students/977996067/src/main/java/com/coderising/dp/week2/decorator/EmailType.java

diff --git a/students/977996067/src/main/java/com/coderising/dp/week2/bridge/Circle.java b/students/977996067/src/main/java/com/coderising/dp/week2/bridge/Circle.java
new file mode 100644
index 000000000..c90c1b388
--- /dev/null
+++ b/students/977996067/src/main/java/com/coderising/dp/week2/bridge/Circle.java
@@ -0,0 +1,15 @@
+package com.coderising.dp.week2.bridge;
+
+public class Circle extends Shape {
+
+    public Circle(Drawing drawing) {
+        super(drawing);
+    }
+
+    @Override
+    public void draw() {
+        getDrawing().drawLine();
+        getDrawing().drawCircle();
+        System.out.println("I am drawing a circle ...");
+    }
+}
diff --git a/students/977996067/src/main/java/com/coderising/dp/week2/bridge/DrawClient.java b/students/977996067/src/main/java/com/coderising/dp/week2/bridge/DrawClient.java
new file mode 100644
index 000000000..c59cd7306
--- /dev/null
+++ b/students/977996067/src/main/java/com/coderising/dp/week2/bridge/DrawClient.java
@@ -0,0 +1,9 @@
+package com.coderising.dp.week2.bridge;
+
+public class DrawClient {
+
+    public static void main(String[] args) {
+        Drawing drawing = new DrawingGL1();
+        new Rectangle(drawing).draw();
+    }
+}
diff --git a/students/977996067/src/main/java/com/coderising/dp/week2/bridge/Drawing.java b/students/977996067/src/main/java/com/coderising/dp/week2/bridge/Drawing.java
new file mode 100644
index 000000000..afa394c29
--- /dev/null
+++ b/students/977996067/src/main/java/com/coderising/dp/week2/bridge/Drawing.java
@@ -0,0 +1,8 @@
+package com.coderising.dp.week2.bridge;
+
+public interface Drawing {
+
+    void drawLine();
+
+    void drawCircle();
+}
diff --git a/students/977996067/src/main/java/com/coderising/dp/week2/bridge/DrawingGL1.java b/students/977996067/src/main/java/com/coderising/dp/week2/bridge/DrawingGL1.java
new file mode 100644
index 000000000..1b3f6c09c
--- /dev/null
+++ b/students/977996067/src/main/java/com/coderising/dp/week2/bridge/DrawingGL1.java
@@ -0,0 +1,14 @@
+package com.coderising.dp.week2.bridge;
+
+public class DrawingGL1 implements Drawing {
+
+    @Override
+    public void drawLine() {
+        System.out.println("I am drawing line 1 ...");
+    }
+
+    @Override
+    public void drawCircle() {
+        System.out.println("I am drawing circle 1 ...");
+    }
+}
diff --git a/students/977996067/src/main/java/com/coderising/dp/week2/bridge/DrawingGL2.java b/students/977996067/src/main/java/com/coderising/dp/week2/bridge/DrawingGL2.java
new file mode 100644
index 000000000..23031c012
--- /dev/null
+++ b/students/977996067/src/main/java/com/coderising/dp/week2/bridge/DrawingGL2.java
@@ -0,0 +1,14 @@
+package com.coderising.dp.week2.bridge;
+
+public class DrawingGL2 implements Drawing {
+
+    @Override
+    public void drawLine() {
+        System.out.println("I am drawing line 2 ...");
+    }
+
+    @Override
+    public void drawCircle() {
+        System.out.println("I am drawing circle 2 ...");
+    }
+}
diff --git a/students/977996067/src/main/java/com/coderising/dp/week2/bridge/Rectangle.java b/students/977996067/src/main/java/com/coderising/dp/week2/bridge/Rectangle.java
new file mode 100644
index 000000000..9ebfaa12d
--- /dev/null
+++ b/students/977996067/src/main/java/com/coderising/dp/week2/bridge/Rectangle.java
@@ -0,0 +1,15 @@
+package com.coderising.dp.week2.bridge;
+
+public class Rectangle extends Shape {
+
+    public Rectangle(Drawing drawing) {
+        super(drawing);
+    }
+
+    @Override
+    public void draw() {
+        getDrawing().drawLine();
+        getDrawing().drawCircle();
+        System.out.println("I am drawing a rectangle ...");
+    }
+}
diff --git a/students/977996067/src/main/java/com/coderising/dp/week2/bridge/Shape.java b/students/977996067/src/main/java/com/coderising/dp/week2/bridge/Shape.java
new file mode 100644
index 000000000..28d2d9043
--- /dev/null
+++ b/students/977996067/src/main/java/com/coderising/dp/week2/bridge/Shape.java
@@ -0,0 +1,16 @@
+package com.coderising.dp.week2.bridge;
+
+public abstract class Shape {
+
+    private Drawing drawing;
+
+    public Shape(Drawing drawing) {
+        this.drawing = drawing;
+    }
+
+    public Drawing getDrawing() {
+        return drawing;
+    }
+
+    protected abstract void draw();
+}
diff --git a/students/977996067/src/main/java/com/coderising/dp/week2/composition/Line.java b/students/977996067/src/main/java/com/coderising/dp/week2/composition/Line.java
new file mode 100644
index 000000000..d0d15396f
--- /dev/null
+++ b/students/977996067/src/main/java/com/coderising/dp/week2/composition/Line.java
@@ -0,0 +1,9 @@
+package com.coderising.dp.week2.composition;
+
+public class Line implements Shape {
+
+    @Override
+    public void draw() {
+        System.out.println("I am drawing a line ...");
+    }
+}
diff --git a/students/977996067/src/main/java/com/coderising/dp/week2/composition/Picture.java b/students/977996067/src/main/java/com/coderising/dp/week2/composition/Picture.java
new file mode 100644
index 000000000..8dd13fc67
--- /dev/null
+++ b/students/977996067/src/main/java/com/coderising/dp/week2/composition/Picture.java
@@ -0,0 +1,18 @@
+package com.coderising.dp.week2.composition;
+
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+public class Picture implements Shape {
+
+    private List<Shape> shapes = new CopyOnWriteArrayList<>();
+
+    @Override
+    public void draw() {
+        shapes.forEach(Shape::draw);
+    }
+
+    public void addShape(Shape shape) {
+        shapes.add(shape);
+    }
+}
diff --git a/students/977996067/src/main/java/com/coderising/dp/week2/composition/Rectangle.java b/students/977996067/src/main/java/com/coderising/dp/week2/composition/Rectangle.java
new file mode 100644
index 000000000..00fb136dc
--- /dev/null
+++ b/students/977996067/src/main/java/com/coderising/dp/week2/composition/Rectangle.java
@@ -0,0 +1,9 @@
+package com.coderising.dp.week2.composition;
+
+public class Rectangle implements Shape {
+
+    @Override
+    public void draw() {
+        System.out.println("I am drawing a rectangle ...");
+    }
+}
diff --git a/students/977996067/src/main/java/com/coderising/dp/week2/composition/Shape.java b/students/977996067/src/main/java/com/coderising/dp/week2/composition/Shape.java
new file mode 100644
index 000000000..5ccbf9fa9
--- /dev/null
+++ b/students/977996067/src/main/java/com/coderising/dp/week2/composition/Shape.java
@@ -0,0 +1,6 @@
+package com.coderising.dp.week2.composition;
+
+public interface Shape {
+
+    void draw();
+}
diff --git a/students/977996067/src/main/java/com/coderising/dp/week2/composition/ShapeClient.java b/students/977996067/src/main/java/com/coderising/dp/week2/composition/ShapeClient.java
new file mode 100644
index 000000000..e8a0c2e7f
--- /dev/null
+++ b/students/977996067/src/main/java/com/coderising/dp/week2/composition/ShapeClient.java
@@ -0,0 +1,17 @@
+package com.coderising.dp.week2.composition;
+
+public class ShapeClient {
+
+    public static void main(String[] args) {
+        Picture subPicture = new Picture();
+        Line line = new Line();
+        subPicture.addShape(new Text());
+        subPicture.addShape(line);
+        subPicture.addShape(new Square());
+        Picture parentPicture = new Picture();
+        parentPicture.addShape(subPicture);
+        parentPicture.addShape(line);
+        parentPicture.addShape(new Rectangle());
+        parentPicture.draw();
+    }
+}
diff --git a/students/977996067/src/main/java/com/coderising/dp/week2/composition/Square.java b/students/977996067/src/main/java/com/coderising/dp/week2/composition/Square.java
new file mode 100644
index 000000000..7d21e6ead
--- /dev/null
+++ b/students/977996067/src/main/java/com/coderising/dp/week2/composition/Square.java
@@ -0,0 +1,9 @@
+package com.coderising.dp.week2.composition;
+
+public class Square implements Shape {
+
+    @Override
+    public void draw() {
+        System.out.println("I am drawing a square ...");
+    }
+}
diff --git a/students/977996067/src/main/java/com/coderising/dp/week2/composition/Text.java b/students/977996067/src/main/java/com/coderising/dp/week2/composition/Text.java
new file mode 100644
index 000000000..7c255262f
--- /dev/null
+++ b/students/977996067/src/main/java/com/coderising/dp/week2/composition/Text.java
@@ -0,0 +1,9 @@
+package com.coderising.dp.week2.composition;
+
+public class Text implements Shape {
+
+    @Override
+    public void draw() {
+        System.out.println("I am drawing a text...");
+    }
+}
diff --git a/students/977996067/src/main/java/com/coderising/dp/week2/decorator/Email.java b/students/977996067/src/main/java/com/coderising/dp/week2/decorator/Email.java
new file mode 100644
index 000000000..f530f207e
--- /dev/null
+++ b/students/977996067/src/main/java/com/coderising/dp/week2/decorator/Email.java
@@ -0,0 +1,6 @@
+package com.coderising.dp.week2.decorator;
+
+public interface Email {
+
+    String getContent();
+}
diff --git a/students/977996067/src/main/java/com/coderising/dp/week2/decorator/EmailDecorator.java b/students/977996067/src/main/java/com/coderising/dp/week2/decorator/EmailDecorator.java
new file mode 100644
index 000000000..8faae4222
--- /dev/null
+++ b/students/977996067/src/main/java/com/coderising/dp/week2/decorator/EmailDecorator.java
@@ -0,0 +1,51 @@
+package com.coderising.dp.week2.decorator;
+
+import java.nio.charset.Charset;
+import java.util.Base64;
+
+public class EmailDecorator implements Email {
+
+    private Email email;
+
+    private String rawContent;
+
+    private String handledContent;
+
+    private EmailType emailType;
+
+    public EmailDecorator(Email email) {
+        this(email, EmailType.PRIVATE);
+    }
+
+    public EmailDecorator(Email email, EmailType emailType) {
+        this.email = email;
+        handle(email.getContent(), emailType);
+    }
+
+    @Override
+    public String getContent() {
+        if (isModified()) {
+            handle(this.email.getContent(), this.emailType);
+        }
+        return this.handledContent;
+    }
+
+    private void handle(String rawString, EmailType emailType) {
+        this.rawContent = rawString;
+        this.emailType = emailType;
+        String decodeString = decode(rawString);
+        this.handledContent = emailType == EmailType.PRIVATE ? decodeString : (decodeString + "本邮件仅为个人观点,并不代表公司立场");
+
+    }
+
+    private String decode(String rawString) {
+        return new String(Base64.getEncoder().encode(rawString.getBytes()), Charset.defaultCharset());
+    }
+
+    private boolean isModified() {
+        if (this.rawContent == null) {
+            throw new RuntimeException();
+        }
+        return email != null && rawContent.equals(email.getContent());
+    }
+}
diff --git a/students/977996067/src/main/java/com/coderising/dp/week2/decorator/EmailImpl.java b/students/977996067/src/main/java/com/coderising/dp/week2/decorator/EmailImpl.java
new file mode 100644
index 000000000..fd1a0eb48
--- /dev/null
+++ b/students/977996067/src/main/java/com/coderising/dp/week2/decorator/EmailImpl.java
@@ -0,0 +1,15 @@
+package com.coderising.dp.week2.decorator;
+
+public class EmailImpl implements Email {
+
+    private String content;
+
+    public EmailImpl(String content) {
+        this.content = content;
+    }
+
+    @Override
+    public String getContent() {
+        return this.content;
+    }
+}
diff --git a/students/977996067/src/main/java/com/coderising/dp/week2/decorator/EmailType.java b/students/977996067/src/main/java/com/coderising/dp/week2/decorator/EmailType.java
new file mode 100644
index 000000000..97ed1febe
--- /dev/null
+++ b/students/977996067/src/main/java/com/coderising/dp/week2/decorator/EmailType.java
@@ -0,0 +1,6 @@
+package com.coderising.dp.week2.decorator;
+
+public enum EmailType {
+    PRIVATE,
+    PUBLIC
+}

From ef5a65856f94d9adba5ae5bc189fe7b9dcb6c5ea Mon Sep 17 00:00:00 2001
From: Liu Zengzeng <liuzengzeng@cmhi.chinamobile.com>
Date: Fri, 28 Jul 2017 10:12:43 +0800
Subject: [PATCH 2/9] dp homework compoiste bridge and decorator

---
 .../java/com/coderings/dp/bridge/Circle.java  | 35 ++++++++++++++++
 .../com/coderings/dp/bridge/ClientMain.java   | 19 +++++++++
 .../coderings/dp/bridge/GraphicLibrary.java   | 11 +++++
 .../coderings/dp/bridge/GraphicLibrary1.java  | 24 +++++++++++
 .../coderings/dp/bridge/GraphicLibrary2.java  | 23 +++++++++++
 .../java/com/coderings/dp/bridge/Line.java    | 40 +++++++++++++++++++
 .../java/com/coderings/dp/bridge/Shape.java   |  5 +++
 .../coderings/dp/composite/ClientMain.java    | 16 ++++++++
 .../coderings/dp/composite/ComponetShape.java |  9 +++++
 .../dp/composite/CompositeShape.java          | 26 ++++++++++++
 .../java/com/coderings/dp/composite/Line.java | 10 +++++
 .../com/coderings/dp/composite/Rectangle.java | 11 +++++
 .../com/coderings/dp/composite/Shape.java     |  5 +++
 .../com/coderings/dp/composite/Square.java    | 11 +++++
 .../java/com/coderings/dp/composite/Text.java | 11 +++++
 .../com/coderings/dp/decorator/Email.java     |  6 +++
 .../dp/decorator/EmailDecorator.java          | 13 ++++++
 .../com/coderings/dp/decorator/EmailImpl.java | 12 ++++++
 .../com/coderings/dp/decorator/EmailMain.java | 15 +++++++
 .../dp/decorator/EncryptEmailImpl.java        | 20 ++++++++++
 .../dp/decorator/StatementEmailImpl.java      | 17 ++++++++
 21 files changed, 339 insertions(+)
 create mode 100644 students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/bridge/Circle.java
 create mode 100644 students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/bridge/ClientMain.java
 create mode 100644 students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/bridge/GraphicLibrary.java
 create mode 100644 students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/bridge/GraphicLibrary1.java
 create mode 100644 students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/bridge/GraphicLibrary2.java
 create mode 100644 students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/bridge/Line.java
 create mode 100644 students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/bridge/Shape.java
 create mode 100644 students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/composite/ClientMain.java
 create mode 100644 students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/composite/ComponetShape.java
 create mode 100644 students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/composite/CompositeShape.java
 create mode 100644 students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/composite/Line.java
 create mode 100644 students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/composite/Rectangle.java
 create mode 100644 students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/composite/Shape.java
 create mode 100644 students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/composite/Square.java
 create mode 100644 students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/composite/Text.java
 create mode 100644 students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/decorator/Email.java
 create mode 100644 students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/decorator/EmailDecorator.java
 create mode 100644 students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/decorator/EmailImpl.java
 create mode 100644 students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/decorator/EmailMain.java
 create mode 100644 students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/decorator/EncryptEmailImpl.java
 create mode 100644 students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/decorator/StatementEmailImpl.java

diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/bridge/Circle.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/bridge/Circle.java
new file mode 100644
index 000000000..f0395794a
--- /dev/null
+++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/bridge/Circle.java
@@ -0,0 +1,35 @@
+package com.coderings.dp.bridge;
+
+public class Circle implements Shape {
+
+	int x;
+	int y;
+	int r;
+
+	private GraphicLibrary graphicLibrary;
+
+	public Circle(int x, int y, int r, GraphicLibrary graphicLibrary) {
+		this.x = x;
+		this.y = y;
+		this.r = r;
+		this.graphicLibrary = graphicLibrary;
+	}
+
+	public int getX() {
+		return x;
+	}
+
+	public int getY() {
+		return y;
+	}
+
+	public int getR() {
+		return r;
+	}
+
+	@Override
+	public void draw() {
+		graphicLibrary.drawCircle(this);
+	}
+
+}
diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/bridge/ClientMain.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/bridge/ClientMain.java
new file mode 100644
index 000000000..0414dd6df
--- /dev/null
+++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/bridge/ClientMain.java
@@ -0,0 +1,19 @@
+package com.coderings.dp.bridge;
+
+/**
+ * @author nvarchar
+ *         date 2017/7/28
+ */
+public class ClientMain {
+    public static void main(String[] args) {
+        Shape line = new Line(1,2,1,2,new GraphicLibrary1());
+        Shape line2 = new Line(1,2,1,2,new GraphicLibrary2());
+        Shape circle = new Circle(1,2,2,new GraphicLibrary1());
+        Shape circle2 = new Circle(1,2,1,new GraphicLibrary2());
+
+        line.draw();
+        line2.draw();
+        circle.draw();
+        circle2.draw();
+    }
+}
diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/bridge/GraphicLibrary.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/bridge/GraphicLibrary.java
new file mode 100644
index 000000000..d9fcb6ae5
--- /dev/null
+++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/bridge/GraphicLibrary.java
@@ -0,0 +1,11 @@
+package com.coderings.dp.bridge;
+
+/**
+ * @author nvarchar
+ *         date 2017/7/28
+ */
+public interface GraphicLibrary {
+    void drawLine(Shape shape);
+
+    void drawCircle(Shape shape);
+}
diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/bridge/GraphicLibrary1.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/bridge/GraphicLibrary1.java
new file mode 100644
index 000000000..31776b21d
--- /dev/null
+++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/bridge/GraphicLibrary1.java
@@ -0,0 +1,24 @@
+package com.coderings.dp.bridge;
+
+public class GraphicLibrary1 implements GraphicLibrary{
+
+	@Override
+	public void drawLine(Shape shape) {
+		Line line = (Line)shape;
+		draw_a_line(line.getX1(), line.getY1(), line.getX2(), line.getY2());
+	}
+
+	@Override
+	public void drawCircle(Shape shape) {
+		Circle circle = (Circle)shape;
+		draw_a_circle(circle.getX(), circle.getY(), circle.getY());
+	}
+
+	public void draw_a_line(int x1, int y1, int x2, int y2){
+		System.out.println("graphic1 draw a line...");
+	}
+	public void draw_a_circle(int x,int y, int r){
+		System.out.println("graphic1 draw a circle...");
+	}
+
+}
diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/bridge/GraphicLibrary2.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/bridge/GraphicLibrary2.java
new file mode 100644
index 000000000..ee9d7e868
--- /dev/null
+++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/bridge/GraphicLibrary2.java
@@ -0,0 +1,23 @@
+package com.coderings.dp.bridge;
+
+public class GraphicLibrary2  implements GraphicLibrary{
+	@Override
+	public void drawLine(Shape shape) {
+		Line line = (Line)shape;
+		drawLine(line.getX1(), line.getX2(), line.getY1(), line.getY2());
+	}
+
+	@Override
+	public void drawCircle(Shape shape) {
+		Circle circle = (Circle)shape;
+		drawCircle(circle.getX(), circle.getY(), circle.getY());
+	}
+
+	public void drawLine(int x1, int x2, int y1, int y2){
+		System.out.println("graphic2 draw a line...");
+	}
+	public void drawCircle(int x,int y, int r){
+		System.out.println("graphic2 draw a circle...");
+	}
+
+}
diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/bridge/Line.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/bridge/Line.java
new file mode 100644
index 000000000..3d0b7a907
--- /dev/null
+++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/bridge/Line.java
@@ -0,0 +1,40 @@
+package com.coderings.dp.bridge;
+
+public class Line implements Shape {
+    private int x1;
+    private int y1;
+    private int x2;
+    private int y2;
+
+    private GraphicLibrary graphicLibrary;
+
+    public Line(int x1, int y1, int x2, int y2, GraphicLibrary graphicLibrary) {
+        this.x1 = x1;
+        this.y1 = y1;
+        this.x2 = x2;
+        this.y2 = y2;
+        this.graphicLibrary = graphicLibrary;
+    }
+
+    public int getX1() {
+        return x1;
+    }
+
+    public int getY1() {
+        return y1;
+    }
+
+    public int getX2() {
+        return x2;
+    }
+
+    public int getY2() {
+        return y2;
+    }
+
+    @Override
+    public void draw() {
+        graphicLibrary.drawLine(this);
+    }
+
+}
diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/bridge/Shape.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/bridge/Shape.java
new file mode 100644
index 000000000..658219a87
--- /dev/null
+++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/bridge/Shape.java
@@ -0,0 +1,5 @@
+package com.coderings.dp.bridge;
+
+public interface Shape {
+	public void draw();
+}
diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/composite/ClientMain.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/composite/ClientMain.java
new file mode 100644
index 000000000..62b6c44a1
--- /dev/null
+++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/composite/ClientMain.java
@@ -0,0 +1,16 @@
+package com.coderings.dp.composite;
+
+/**
+ * @author nvarchar
+ *         date 2017/7/28
+ */
+public class ClientMain {
+    public static void main(String[] args) {
+        CompositeShape compositeShape = new CompositeShape();
+        compositeShape.add(new Line());
+        compositeShape.add(new Square());
+        compositeShape.add(new Rectangle());
+        compositeShape.add(new Text());
+        compositeShape.draw();
+    }
+}
diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/composite/ComponetShape.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/composite/ComponetShape.java
new file mode 100644
index 000000000..9992c45c2
--- /dev/null
+++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/composite/ComponetShape.java
@@ -0,0 +1,9 @@
+package com.coderings.dp.composite;
+
+/**
+ * @author nvarchar
+ *         date 2017/7/28
+ */
+public abstract class ComponetShape implements Shape {
+    public abstract void add(Shape shape);
+}
diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/composite/CompositeShape.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/composite/CompositeShape.java
new file mode 100644
index 000000000..2fe2e164e
--- /dev/null
+++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/composite/CompositeShape.java
@@ -0,0 +1,26 @@
+package com.coderings.dp.composite;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author nvarchar
+ *         date 2017/7/28
+ */
+public class CompositeShape extends ComponetShape{
+
+    private List<Shape> shapes = new ArrayList<>();
+
+    @Override
+    public void draw() {
+        for(Shape shape : shapes){
+            shape.draw();
+        }
+    }
+
+    @Override
+    public void add(Shape shape) {
+        shapes.add(shape);
+    }
+
+}
diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/composite/Line.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/composite/Line.java
new file mode 100644
index 000000000..cc1f6c858
--- /dev/null
+++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/composite/Line.java
@@ -0,0 +1,10 @@
+package com.coderings.dp.composite;
+
+public class Line implements Shape {
+
+	@Override
+	public void draw() {
+		System.out.println("draw line");
+	}
+
+}
diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/composite/Rectangle.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/composite/Rectangle.java
new file mode 100644
index 000000000..95a91e522
--- /dev/null
+++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/composite/Rectangle.java
@@ -0,0 +1,11 @@
+package com.coderings.dp.composite;
+
+public class Rectangle implements Shape {
+
+	@Override
+	public void draw() {
+		// TODO Auto-generated method stub
+		System.out.println("draw rectangle");
+	}
+
+}
diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/composite/Shape.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/composite/Shape.java
new file mode 100644
index 000000000..ea353dad6
--- /dev/null
+++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/composite/Shape.java
@@ -0,0 +1,5 @@
+package com.coderings.dp.composite;
+
+public interface Shape {
+	public void draw();
+}
diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/composite/Square.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/composite/Square.java
new file mode 100644
index 000000000..2f6b44bda
--- /dev/null
+++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/composite/Square.java
@@ -0,0 +1,11 @@
+package com.coderings.dp.composite;
+
+public class Square implements Shape {
+
+	@Override
+	public void draw() {
+		// TODO Auto-generated method stub
+		System.out.println("draw square");
+	}
+
+}
diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/composite/Text.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/composite/Text.java
new file mode 100644
index 000000000..e44cb3959
--- /dev/null
+++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/composite/Text.java
@@ -0,0 +1,11 @@
+package com.coderings.dp.composite;
+
+public class Text implements Shape {
+
+	@Override
+	public void draw() {
+		// TODO Auto-generated method stub
+		System.out.println("draw text");
+	}
+
+}
diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/decorator/Email.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/decorator/Email.java
new file mode 100644
index 000000000..f06ce0174
--- /dev/null
+++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/decorator/Email.java
@@ -0,0 +1,6 @@
+package com.coderings.dp.decorator;
+
+public interface Email {
+	public String getContent();
+}
+
diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/decorator/EmailDecorator.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/decorator/EmailDecorator.java
new file mode 100644
index 000000000..acb9cb5ec
--- /dev/null
+++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/decorator/EmailDecorator.java
@@ -0,0 +1,13 @@
+package com.coderings.dp.decorator;
+
+public abstract class EmailDecorator implements Email{
+    protected Email email;
+
+    public EmailDecorator(Email email) {
+        this.email = email;
+    }
+
+    public String getContent() {
+        return email.getContent();
+    }
+}
\ No newline at end of file
diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/decorator/EmailImpl.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/decorator/EmailImpl.java
new file mode 100644
index 000000000..2d0abae36
--- /dev/null
+++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/decorator/EmailImpl.java
@@ -0,0 +1,12 @@
+package com.coderings.dp.decorator;
+
+public class EmailImpl implements Email {
+	private String content;
+
+	public EmailImpl(String content) {
+		this.content = content;
+	}
+	public String getContent()   {
+		return content;
+	}
+}
diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/decorator/EmailMain.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/decorator/EmailMain.java
new file mode 100644
index 000000000..e2822ab9d
--- /dev/null
+++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/decorator/EmailMain.java
@@ -0,0 +1,15 @@
+package com.coderings.dp.decorator;
+
+/**
+ * @author nvarchar
+ *         date 2017/7/28
+ */
+public class EmailMain {
+    public static void main(String[] args) {
+        Email stateEmail = new StatementEmailImpl(new EmailImpl("发邮件"));
+        Email encryptEmail = new EncryptEmailImpl(new EmailImpl("发邮件"));
+
+        System.out.println(stateEmail.getContent());
+        System.out.println(encryptEmail.getContent());
+    }
+}
diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/decorator/EncryptEmailImpl.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/decorator/EncryptEmailImpl.java
new file mode 100644
index 000000000..5a63aa84c
--- /dev/null
+++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/decorator/EncryptEmailImpl.java
@@ -0,0 +1,20 @@
+package com.coderings.dp.decorator;
+
+/**
+ * @author nvarchar
+ *         date 2017/7/26
+ */
+public class EncryptEmailImpl extends EmailDecorator {
+
+    public EncryptEmailImpl(Email email) {
+        super(email);
+    }
+
+    private String encrypt(String content) {
+        return "****" + content + "****";
+    }
+
+    public String getContent() {
+        return encrypt(email.getContent());
+    }
+}
diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/decorator/StatementEmailImpl.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/decorator/StatementEmailImpl.java
new file mode 100644
index 000000000..a71b0dd7a
--- /dev/null
+++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderings/dp/decorator/StatementEmailImpl.java
@@ -0,0 +1,17 @@
+package com.coderings.dp.decorator;
+
+/**
+ * @author nvarchar
+ *         date 2017/7/26
+ */
+public class StatementEmailImpl extends EmailDecorator {
+
+    public StatementEmailImpl(Email email) {
+        super(email);
+    }
+
+    public String getContent(){
+        String state = "本邮件仅代表个人立场，不代表公司立场;";
+        return email.getContent() + state;
+    }
+}

From f6062be9d17b45778a298f5efe4f53dda9bf8697 Mon Sep 17 00:00:00 2001
From: yangzhm <yangzhm@hualu.com.cn>
Date: Fri, 28 Jul 2017 10:14:23 +0800
Subject: [PATCH 3/9] add homework of bridgepattern,compositepattern and
 decoratorpattern

---
 .../OOD/bridgepattern/DrawCircle.java         | 15 +++++++++++++
 .../495232796/OOD/bridgepattern/DrawLine.java | 16 ++++++++++++++
 .../495232796/OOD/bridgepattern/Drawing.java  |  6 +++++
 .../OOD/bridgepattern/GraphicLibrary1.java    | 10 +++++++++
 .../bridgepattern/GraphicLibrary1Adapter.java | 15 +++++++++++++
 .../OOD/bridgepattern/GraphicLibrary2.java    | 10 +++++++++
 .../495232796/OOD/bridgepattern/Shape.java    | 10 +++++++++
 .../495232796/OOD/compositepattern/Line.java  | 10 +++++++++
 .../OOD/compositepattern/Picture.java         | 19 ++++++++++++++++
 .../OOD/compositepattern/Rectangle.java       | 10 +++++++++
 .../495232796/OOD/compositepattern/Shape.java |  5 +++++
 .../OOD/compositepattern/Square.java          | 10 +++++++++
 .../495232796/OOD/compositepattern/Text.java  | 10 +++++++++
 .../495232796/OOD/decoratorpattern/Email.java |  6 +++++
 .../OOD/decoratorpattern/EmailDecorator.java  | 13 +++++++++++
 .../EmailEncryptionDecorator.java             | 20 +++++++++++++++++
 .../OOD/decoratorpattern/EmailImpl.java       | 12 ++++++++++
 .../EmailStatementDecorator.java              | 22 +++++++++++++++++++
 18 files changed, 219 insertions(+)
 create mode 100644 students/495232796/OOD/bridgepattern/DrawCircle.java
 create mode 100644 students/495232796/OOD/bridgepattern/DrawLine.java
 create mode 100644 students/495232796/OOD/bridgepattern/Drawing.java
 create mode 100644 students/495232796/OOD/bridgepattern/GraphicLibrary1.java
 create mode 100644 students/495232796/OOD/bridgepattern/GraphicLibrary1Adapter.java
 create mode 100644 students/495232796/OOD/bridgepattern/GraphicLibrary2.java
 create mode 100644 students/495232796/OOD/bridgepattern/Shape.java
 create mode 100644 students/495232796/OOD/compositepattern/Line.java
 create mode 100644 students/495232796/OOD/compositepattern/Picture.java
 create mode 100644 students/495232796/OOD/compositepattern/Rectangle.java
 create mode 100644 students/495232796/OOD/compositepattern/Shape.java
 create mode 100644 students/495232796/OOD/compositepattern/Square.java
 create mode 100644 students/495232796/OOD/compositepattern/Text.java
 create mode 100644 students/495232796/OOD/decoratorpattern/Email.java
 create mode 100644 students/495232796/OOD/decoratorpattern/EmailDecorator.java
 create mode 100644 students/495232796/OOD/decoratorpattern/EmailEncryptionDecorator.java
 create mode 100644 students/495232796/OOD/decoratorpattern/EmailImpl.java
 create mode 100644 students/495232796/OOD/decoratorpattern/EmailStatementDecorator.java

diff --git a/students/495232796/OOD/bridgepattern/DrawCircle.java b/students/495232796/OOD/bridgepattern/DrawCircle.java
new file mode 100644
index 000000000..a9d515fbb
--- /dev/null
+++ b/students/495232796/OOD/bridgepattern/DrawCircle.java
@@ -0,0 +1,15 @@
+package com.coderising.dp.bridge;
+
+public class DrawCircle extends Shape{
+	public int x, y, r;
+
+	public DrawCircle(Drawing drawing, int x, int y, int r) {
+		super(drawing);
+		this.x =x;
+		this.y = y;
+		this.r = r;
+	}
+	public void draw() {
+		this.drawing.drawCircle(x, y, r);
+	}
+}
diff --git a/students/495232796/OOD/bridgepattern/DrawLine.java b/students/495232796/OOD/bridgepattern/DrawLine.java
new file mode 100644
index 000000000..df0271d16
--- /dev/null
+++ b/students/495232796/OOD/bridgepattern/DrawLine.java
@@ -0,0 +1,16 @@
+package com.coderising.dp.bridge;
+
+public class DrawLine extends Shape{
+	int x1, y1, x2, y2;
+
+	public DrawLine(Drawing drawing, int x1, int y1, int x2, int y2) {
+		super(drawing);
+		this.x1 = x1;
+		this.x2 = x2;
+		this.y1 = y1;
+		this.y2 = y2;
+	}
+	public void draw() {
+		this.drawing.drawLine(x1, y1, x2, y2);
+	}
+}
diff --git a/students/495232796/OOD/bridgepattern/Drawing.java b/students/495232796/OOD/bridgepattern/Drawing.java
new file mode 100644
index 000000000..3149c6882
--- /dev/null
+++ b/students/495232796/OOD/bridgepattern/Drawing.java
@@ -0,0 +1,6 @@
+package com.coderising.dp.bridge;
+
+public interface Drawing {
+	public void drawLine(int x1,int y1,int x2,int y2);
+	public void drawCircle(int x,int y, int r);
+}
diff --git a/students/495232796/OOD/bridgepattern/GraphicLibrary1.java b/students/495232796/OOD/bridgepattern/GraphicLibrary1.java
new file mode 100644
index 000000000..1ecf2f054
--- /dev/null
+++ b/students/495232796/OOD/bridgepattern/GraphicLibrary1.java
@@ -0,0 +1,10 @@
+package com.coderising.dp.bridge;
+
+public class GraphicLibrary1{
+	public void draw_a_line(int x1,int y1,int x2,int y2){
+		System.out.println("Draw a line with using library1.");
+	}
+	public void draw_a_circle(int x,int y, int r){
+		System.out.println("Draw a circle with using library1");
+	}
+}
diff --git a/students/495232796/OOD/bridgepattern/GraphicLibrary1Adapter.java b/students/495232796/OOD/bridgepattern/GraphicLibrary1Adapter.java
new file mode 100644
index 000000000..8e33fd248
--- /dev/null
+++ b/students/495232796/OOD/bridgepattern/GraphicLibrary1Adapter.java
@@ -0,0 +1,15 @@
+package com.coderising.dp.bridge;
+
+public class GraphicLibrary1Adapter implements Drawing{
+	GraphicLibrary1 glib = new GraphicLibrary1();
+	@Override
+	public void drawLine(int x1, int y1, int x2, int y2) {
+		this.glib.draw_a_line(x1, y1, x2, y2);
+	}
+
+	@Override
+	public void drawCircle(int x, int y, int r) {
+		this.glib.draw_a_circle(x, y, r);
+	}
+
+}
diff --git a/students/495232796/OOD/bridgepattern/GraphicLibrary2.java b/students/495232796/OOD/bridgepattern/GraphicLibrary2.java
new file mode 100644
index 000000000..f008fa54d
--- /dev/null
+++ b/students/495232796/OOD/bridgepattern/GraphicLibrary2.java
@@ -0,0 +1,10 @@
+package com.coderising.dp.bridge;
+
+public class GraphicLibrary2 implements Drawing{
+	public void drawLine(int x1,int x2,int y1,int y2){
+		System.out.println("Draw a line with using library2.");
+	}
+	public void drawCircle(int x,int y, int r){
+		System.out.println("Draw a circle with using library2.");
+	}
+}
diff --git a/students/495232796/OOD/bridgepattern/Shape.java b/students/495232796/OOD/bridgepattern/Shape.java
new file mode 100644
index 000000000..34861f43f
--- /dev/null
+++ b/students/495232796/OOD/bridgepattern/Shape.java
@@ -0,0 +1,10 @@
+package com.coderising.dp.bridge;
+
+public abstract class Shape {
+	public Drawing drawing;
+	public Shape(Drawing drawing) {
+		this.drawing = drawing;
+	}
+	public void draw() {
+	}
+}
diff --git a/students/495232796/OOD/compositepattern/Line.java b/students/495232796/OOD/compositepattern/Line.java
new file mode 100644
index 000000000..884e8d922
--- /dev/null
+++ b/students/495232796/OOD/compositepattern/Line.java
@@ -0,0 +1,10 @@
+package com.coderising.dp.composite;
+
+public class Line implements Shape {
+
+	@Override
+	public void draw() {
+		System.out.println("This is a line.");
+	}
+
+}
diff --git a/students/495232796/OOD/compositepattern/Picture.java b/students/495232796/OOD/compositepattern/Picture.java
new file mode 100644
index 000000000..8029dc4aa
--- /dev/null
+++ b/students/495232796/OOD/compositepattern/Picture.java
@@ -0,0 +1,19 @@
+package com.coderising.dp.composite;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Picture implements Shape{
+	List<Shape> shapes = new ArrayList<>();
+
+	@Override
+	public void draw() {
+		for(Shape shape : shapes) {
+			shape.draw();
+		}
+	}
+	
+	public void addShape(Shape shape) {
+		shapes.add(shape);
+	}
+}
diff --git a/students/495232796/OOD/compositepattern/Rectangle.java b/students/495232796/OOD/compositepattern/Rectangle.java
new file mode 100644
index 000000000..d0734b4d6
--- /dev/null
+++ b/students/495232796/OOD/compositepattern/Rectangle.java
@@ -0,0 +1,10 @@
+package com.coderising.dp.composite;
+
+public class Rectangle implements Shape {
+
+	@Override
+	public void draw() {
+		System.out.println("This is a rectangle.");
+	}
+
+}
diff --git a/students/495232796/OOD/compositepattern/Shape.java b/students/495232796/OOD/compositepattern/Shape.java
new file mode 100644
index 000000000..4562f10b1
--- /dev/null
+++ b/students/495232796/OOD/compositepattern/Shape.java
@@ -0,0 +1,5 @@
+package com.coderising.dp.composite;
+
+public interface Shape {
+	public void draw();
+}
diff --git a/students/495232796/OOD/compositepattern/Square.java b/students/495232796/OOD/compositepattern/Square.java
new file mode 100644
index 000000000..30ab0e7b8
--- /dev/null
+++ b/students/495232796/OOD/compositepattern/Square.java
@@ -0,0 +1,10 @@
+package com.coderising.dp.composite;
+
+public class Square implements Shape {
+
+	@Override
+	public void draw() {
+		System.out.println("This is a sqare.");
+	}
+
+}
diff --git a/students/495232796/OOD/compositepattern/Text.java b/students/495232796/OOD/compositepattern/Text.java
new file mode 100644
index 000000000..0f831f62f
--- /dev/null
+++ b/students/495232796/OOD/compositepattern/Text.java
@@ -0,0 +1,10 @@
+package com.coderising.dp.composite;
+
+public class Text implements Shape {
+
+	@Override
+	public void draw() {
+		System.out.println("This is a text.");
+	}
+
+}
diff --git a/students/495232796/OOD/decoratorpattern/Email.java b/students/495232796/OOD/decoratorpattern/Email.java
new file mode 100644
index 000000000..064de1e83
--- /dev/null
+++ b/students/495232796/OOD/decoratorpattern/Email.java
@@ -0,0 +1,6 @@
+package com.coderising.dp.decorator;
+
+public interface Email {
+	public String getContent();
+}
+
diff --git a/students/495232796/OOD/decoratorpattern/EmailDecorator.java b/students/495232796/OOD/decoratorpattern/EmailDecorator.java
new file mode 100644
index 000000000..61ea7c2d2
--- /dev/null
+++ b/students/495232796/OOD/decoratorpattern/EmailDecorator.java
@@ -0,0 +1,13 @@
+package com.coderising.dp.decorator;
+
+public abstract class EmailDecorator implements Email{
+	protected Email email;
+	
+	public EmailDecorator(Email e) {
+		this.email = e;
+	}
+	
+	public String getContent(){
+		return this.email.getContent();
+	}
+}
\ No newline at end of file
diff --git a/students/495232796/OOD/decoratorpattern/EmailEncryptionDecorator.java b/students/495232796/OOD/decoratorpattern/EmailEncryptionDecorator.java
new file mode 100644
index 000000000..65a6e56a2
--- /dev/null
+++ b/students/495232796/OOD/decoratorpattern/EmailEncryptionDecorator.java
@@ -0,0 +1,20 @@
+package com.coderising.dp.decorator;
+
+public class EmailEncryptionDecorator extends EmailDecorator{
+
+	public EmailEncryptionDecorator(Email e) {
+		super(e);
+	}
+	
+	public String encryptContext() {
+		return this.email.getContent();
+	}
+	
+	public String decryptContext() {
+		return this.email.getContent();
+	}
+
+	public String getContent() {
+		return this.encryptContext();
+	}
+}
diff --git a/students/495232796/OOD/decoratorpattern/EmailImpl.java b/students/495232796/OOD/decoratorpattern/EmailImpl.java
new file mode 100644
index 000000000..640aef6da
--- /dev/null
+++ b/students/495232796/OOD/decoratorpattern/EmailImpl.java
@@ -0,0 +1,12 @@
+package com.coderising.dp.decorator;
+
+public class EmailImpl implements Email {
+	private String content;
+
+	public EmailImpl(String content) {
+		this.content = content;
+	}
+	public String getContent()   {
+		return content;
+	}
+}
diff --git a/students/495232796/OOD/decoratorpattern/EmailStatementDecorator.java b/students/495232796/OOD/decoratorpattern/EmailStatementDecorator.java
new file mode 100644
index 000000000..15e14ecab
--- /dev/null
+++ b/students/495232796/OOD/decoratorpattern/EmailStatementDecorator.java
@@ -0,0 +1,22 @@
+package com.coderising.dp.decorator;
+
+public class EmailStatementDecorator extends EmailDecorator{
+	private String statement;
+	
+	public EmailStatementDecorator(Email e) {
+		super(e);
+	}
+
+	public String getStatement() {
+		return statement;
+	}
+
+	public void setStatement(String statement) {
+		this.statement = statement;
+	}
+	
+	public String getContent() {
+		return this.email.getContent() + this.statement;
+	}
+
+}

From 08e5727dd19bd1141e7b1a190f7ead50ff15bb10 Mon Sep 17 00:00:00 2001
From: lorcx <740707954@qq.com>
Date: Sat, 29 Jul 2017 18:57:22 +0800
Subject: [PATCH 4/9] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=8F=90=E4=BA=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../src/main/java/dp/bridge/BridgeTest.java   | 21 ++++++++++
 .../src/main/java/dp/bridge/Circle.java       | 17 ++++++++
 .../src/main/java/dp/bridge/Drawing.java      | 10 +++++
 .../src/main/java/dp/bridge/DrawingGL1.java   | 17 ++++++++
 .../src/main/java/dp/bridge/DrawingGL2.java   | 17 ++++++++
 .../src/main/java/dp/bridge/Retangle.java     | 16 +++++++
 .../src/main/java/dp/bridge/Shape.java        | 18 ++++++++
 .../main/java/dp/{ => builder}/Attribute.java |  2 +-
 .../java/dp/{ => builder}/TagBuilder.java     |  2 +-
 .../java/dp/{ => builder}/TagBuilderTest.java |  2 +-
 .../main/java/dp/{ => builder}/TagNode.java   |  2 +-
 .../main/java/dp/composite/CompositeTest.java | 24 +++++++++++
 .../src/main/java/dp/composite/Line.java      | 12 ++++++
 .../src/main/java/dp/composite/Picture.java   | 42 +++++++++++++++++++
 .../src/main/java/dp/composite/Rectangle.java | 12 ++++++
 .../src/main/java/dp/composite/Shape.java     |  8 ++++
 .../src/main/java/dp/composite/Square.java    | 12 ++++++
 .../src/main/java/dp/composite/Text.java      | 12 ++++++
 .../src/main/java/dp/decorator/Email.java     |  8 ++++
 .../src/main/java/dp/decorator/EmailImpl.java | 17 ++++++++
 .../src/main/java/dp/decorator/EmailTest.java | 15 +++++++
 .../dp/decorator/EncryptionEmailImpl.java     | 22 ++++++++++
 .../main/java/dp/decorator/FilterEmail.java   | 18 ++++++++
 .../java/dp/decorator/OutsideEmailImpl.java   | 22 ++++++++++
 24 files changed, 344 insertions(+), 4 deletions(-)
 create mode 100644 students/740707954/src/main/java/dp/bridge/BridgeTest.java
 create mode 100644 students/740707954/src/main/java/dp/bridge/Circle.java
 create mode 100644 students/740707954/src/main/java/dp/bridge/Drawing.java
 create mode 100644 students/740707954/src/main/java/dp/bridge/DrawingGL1.java
 create mode 100644 students/740707954/src/main/java/dp/bridge/DrawingGL2.java
 create mode 100644 students/740707954/src/main/java/dp/bridge/Retangle.java
 create mode 100644 students/740707954/src/main/java/dp/bridge/Shape.java
 rename students/740707954/src/main/java/dp/{ => builder}/Attribute.java (95%)
 rename students/740707954/src/main/java/dp/{ => builder}/TagBuilder.java (98%)
 rename students/740707954/src/main/java/dp/{ => builder}/TagBuilderTest.java (98%)
 rename students/740707954/src/main/java/dp/{ => builder}/TagNode.java (99%)
 create mode 100644 students/740707954/src/main/java/dp/composite/CompositeTest.java
 create mode 100644 students/740707954/src/main/java/dp/composite/Line.java
 create mode 100644 students/740707954/src/main/java/dp/composite/Picture.java
 create mode 100644 students/740707954/src/main/java/dp/composite/Rectangle.java
 create mode 100644 students/740707954/src/main/java/dp/composite/Shape.java
 create mode 100644 students/740707954/src/main/java/dp/composite/Square.java
 create mode 100644 students/740707954/src/main/java/dp/composite/Text.java
 create mode 100644 students/740707954/src/main/java/dp/decorator/Email.java
 create mode 100644 students/740707954/src/main/java/dp/decorator/EmailImpl.java
 create mode 100644 students/740707954/src/main/java/dp/decorator/EmailTest.java
 create mode 100644 students/740707954/src/main/java/dp/decorator/EncryptionEmailImpl.java
 create mode 100644 students/740707954/src/main/java/dp/decorator/FilterEmail.java
 create mode 100644 students/740707954/src/main/java/dp/decorator/OutsideEmailImpl.java

diff --git a/students/740707954/src/main/java/dp/bridge/BridgeTest.java b/students/740707954/src/main/java/dp/bridge/BridgeTest.java
new file mode 100644
index 000000000..838014f92
--- /dev/null
+++ b/students/740707954/src/main/java/dp/bridge/BridgeTest.java
@@ -0,0 +1,21 @@
+package dp.bridge;
+
+import org.junit.Test;
+
+/**
+ * Created by lx on 2017/7/29.
+ */
+public class BridgeTest {
+
+    @Test
+    public void testBridge() {
+        Shape shape1 = new Circle(new DrawingGL1());
+        Shape shape2 = new Retangle(new DrawingGL1());
+        Shape shape3 = new Circle(new DrawingGL2());
+        Shape shape4 = new Retangle(new DrawingGL2());
+        shape1.shape();
+        shape2.shape();
+        shape3.shape();
+        shape4.shape();
+    }
+}
diff --git a/students/740707954/src/main/java/dp/bridge/Circle.java b/students/740707954/src/main/java/dp/bridge/Circle.java
new file mode 100644
index 000000000..422453581
--- /dev/null
+++ b/students/740707954/src/main/java/dp/bridge/Circle.java
@@ -0,0 +1,17 @@
+package dp.bridge;
+
+/**
+ * Created by lx on 2017/7/29.
+ */
+public class Circle extends Shape {
+    public Circle(Drawing drawing) {
+        setDrawing(drawing);
+    }
+
+    @Override
+    public void shape() {
+        getDrawing().drawCircle();
+    }
+
+
+}
diff --git a/students/740707954/src/main/java/dp/bridge/Drawing.java b/students/740707954/src/main/java/dp/bridge/Drawing.java
new file mode 100644
index 000000000..1faae5781
--- /dev/null
+++ b/students/740707954/src/main/java/dp/bridge/Drawing.java
@@ -0,0 +1,10 @@
+package dp.bridge;
+
+/**
+ * Created by lx on 2017/7/29.
+ */
+public interface Drawing {
+    void drawLine();
+
+    void drawCircle();
+}
diff --git a/students/740707954/src/main/java/dp/bridge/DrawingGL1.java b/students/740707954/src/main/java/dp/bridge/DrawingGL1.java
new file mode 100644
index 000000000..8a2785522
--- /dev/null
+++ b/students/740707954/src/main/java/dp/bridge/DrawingGL1.java
@@ -0,0 +1,17 @@
+package dp.bridge;
+
+/**
+ * 图形库1
+ * Created by lx on 2017/7/29.
+ */
+public class DrawingGL1 implements Drawing{
+    @Override
+    public void drawLine() {
+        System.out.println("图形库1画线");
+    }
+
+    @Override
+    public void drawCircle() {
+        System.out.println("图形库1画圆");
+    }
+}
diff --git a/students/740707954/src/main/java/dp/bridge/DrawingGL2.java b/students/740707954/src/main/java/dp/bridge/DrawingGL2.java
new file mode 100644
index 000000000..419a6853b
--- /dev/null
+++ b/students/740707954/src/main/java/dp/bridge/DrawingGL2.java
@@ -0,0 +1,17 @@
+package dp.bridge;
+
+/**
+ * 图形库2
+ * Created by lx on 2017/7/29.
+ */
+public class DrawingGL2 implements Drawing {
+    @Override
+    public void drawLine() {
+        System.out.println("图形库2画线");
+    }
+
+    @Override
+    public void drawCircle() {
+        System.out.println("图形库2画圆");
+    }
+}
diff --git a/students/740707954/src/main/java/dp/bridge/Retangle.java b/students/740707954/src/main/java/dp/bridge/Retangle.java
new file mode 100644
index 000000000..ea869f1b4
--- /dev/null
+++ b/students/740707954/src/main/java/dp/bridge/Retangle.java
@@ -0,0 +1,16 @@
+package dp.bridge;
+
+/**
+ * Created by lx on 2017/7/29.
+ */
+public class Retangle extends Shape {
+    public Retangle(Drawing drawing) {
+        setDrawing(drawing);
+    }
+
+    @Override
+    public void shape() {
+        getDrawing().drawLine();
+    }
+
+}
diff --git a/students/740707954/src/main/java/dp/bridge/Shape.java b/students/740707954/src/main/java/dp/bridge/Shape.java
new file mode 100644
index 000000000..1ec254c30
--- /dev/null
+++ b/students/740707954/src/main/java/dp/bridge/Shape.java
@@ -0,0 +1,18 @@
+package dp.bridge;
+
+/**
+ * Created by lx on 2017/7/29.
+ */
+public abstract class Shape {
+    private Drawing drawing;
+
+    abstract void shape();
+
+    public void setDrawing(Drawing drawing) {
+        this.drawing = drawing;
+    }
+
+    public Drawing getDrawing() {
+        return drawing;
+    }
+}
diff --git a/students/740707954/src/main/java/dp/Attribute.java b/students/740707954/src/main/java/dp/builder/Attribute.java
similarity index 95%
rename from students/740707954/src/main/java/dp/Attribute.java
rename to students/740707954/src/main/java/dp/builder/Attribute.java
index 3ec9ee6db..a44481c71 100644
--- a/students/740707954/src/main/java/dp/Attribute.java
+++ b/students/740707954/src/main/java/dp/builder/Attribute.java
@@ -1,4 +1,4 @@
-package dp;
+package dp.builder;
 
 /**
  * Created by lx on 2017/7/22.
diff --git a/students/740707954/src/main/java/dp/TagBuilder.java b/students/740707954/src/main/java/dp/builder/TagBuilder.java
similarity index 98%
rename from students/740707954/src/main/java/dp/TagBuilder.java
rename to students/740707954/src/main/java/dp/builder/TagBuilder.java
index ea2c63df4..74615b579 100644
--- a/students/740707954/src/main/java/dp/TagBuilder.java
+++ b/students/740707954/src/main/java/dp/builder/TagBuilder.java
@@ -1,4 +1,4 @@
-package dp;
+package dp.builder;
 
 import java.util.List;
 
diff --git a/students/740707954/src/main/java/dp/TagBuilderTest.java b/students/740707954/src/main/java/dp/builder/TagBuilderTest.java
similarity index 98%
rename from students/740707954/src/main/java/dp/TagBuilderTest.java
rename to students/740707954/src/main/java/dp/builder/TagBuilderTest.java
index be4815e20..450b7fc04 100644
--- a/students/740707954/src/main/java/dp/TagBuilderTest.java
+++ b/students/740707954/src/main/java/dp/builder/TagBuilderTest.java
@@ -1,4 +1,4 @@
-package dp;
+package dp.builder;
 
 import org.junit.After;
 import org.junit.Before;
diff --git a/students/740707954/src/main/java/dp/TagNode.java b/students/740707954/src/main/java/dp/builder/TagNode.java
similarity index 99%
rename from students/740707954/src/main/java/dp/TagNode.java
rename to students/740707954/src/main/java/dp/builder/TagNode.java
index 8bf58f772..bf8caeed0 100644
--- a/students/740707954/src/main/java/dp/TagNode.java
+++ b/students/740707954/src/main/java/dp/builder/TagNode.java
@@ -1,4 +1,4 @@
-package dp;
+package dp.builder;
 
 import java.util.ArrayList;
 import java.util.List;
diff --git a/students/740707954/src/main/java/dp/composite/CompositeTest.java b/students/740707954/src/main/java/dp/composite/CompositeTest.java
new file mode 100644
index 000000000..0b0ea0c60
--- /dev/null
+++ b/students/740707954/src/main/java/dp/composite/CompositeTest.java
@@ -0,0 +1,24 @@
+package dp.composite;
+
+import org.junit.Test;
+
+/**
+ * Created by lx on 2017/7/29.
+ */
+public class CompositeTest {
+
+    @Test
+    public void testComp() {
+        Picture picture1 = new Picture();
+        Picture picture = new Picture();
+        picture1.addShape(new Text());
+        picture1.addShape(new Line());
+        picture1.addShape(new Square());
+        picture.addShape(picture1);
+        picture.addShape(new Line());
+        picture.addShape(new Rectangle());
+
+        picture.draw();
+
+    }
+}
diff --git a/students/740707954/src/main/java/dp/composite/Line.java b/students/740707954/src/main/java/dp/composite/Line.java
new file mode 100644
index 000000000..bc3e9a6c0
--- /dev/null
+++ b/students/740707954/src/main/java/dp/composite/Line.java
@@ -0,0 +1,12 @@
+package dp.composite;
+
+/**
+ * 线
+ * Created by lx on 2017/7/29.
+ */
+public class Line implements Shape {
+    @Override
+    public void draw() {
+        System.out.println("画线");
+    }
+}
diff --git a/students/740707954/src/main/java/dp/composite/Picture.java b/students/740707954/src/main/java/dp/composite/Picture.java
new file mode 100644
index 000000000..4809e7bf6
--- /dev/null
+++ b/students/740707954/src/main/java/dp/composite/Picture.java
@@ -0,0 +1,42 @@
+package dp.composite;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 图片
+ * Created by lx on 2017/7/29.
+ */
+public class Picture implements Shape{
+
+    private List<Shape> shapes = new ArrayList<>();
+
+    @Override
+    public void draw() {
+       shapes.forEach((shape) -> shape.draw());
+    }
+
+    /**
+     * 添加图形
+     * @param shape
+     */
+    public void addShape(Shape shape) {
+        shapes.add(shape);
+    }
+
+    /**
+     * 获取图形
+     * @param i
+     */
+    public void getShape(int i) {
+        shapes.get(i);
+    }
+
+    /**
+     * 删除图形
+     * @param i
+     */
+    public void deleteShape(int i) {
+        shapes.remove(i);
+    }
+}
diff --git a/students/740707954/src/main/java/dp/composite/Rectangle.java b/students/740707954/src/main/java/dp/composite/Rectangle.java
new file mode 100644
index 000000000..a2b83477c
--- /dev/null
+++ b/students/740707954/src/main/java/dp/composite/Rectangle.java
@@ -0,0 +1,12 @@
+package dp.composite;
+
+/**
+ * 矩形
+ * Created by lx on 2017/7/29.
+ */
+public class Rectangle implements Shape{
+    @Override
+    public void draw() {
+        System.out.println("画矩形");
+    }
+}
diff --git a/students/740707954/src/main/java/dp/composite/Shape.java b/students/740707954/src/main/java/dp/composite/Shape.java
new file mode 100644
index 000000000..c7821b1a9
--- /dev/null
+++ b/students/740707954/src/main/java/dp/composite/Shape.java
@@ -0,0 +1,8 @@
+package dp.composite;
+
+/**
+ * Created by lx on 2017/7/29.
+ */
+public interface Shape {
+    void draw();
+}
diff --git a/students/740707954/src/main/java/dp/composite/Square.java b/students/740707954/src/main/java/dp/composite/Square.java
new file mode 100644
index 000000000..3fd223644
--- /dev/null
+++ b/students/740707954/src/main/java/dp/composite/Square.java
@@ -0,0 +1,12 @@
+package dp.composite;
+
+/**
+ * 正方形
+ * Created by lx on 2017/7/29.
+ */
+public class Square implements Shape{
+    @Override
+    public void draw() {
+        System.out.println("画正方形");
+    }
+}
diff --git a/students/740707954/src/main/java/dp/composite/Text.java b/students/740707954/src/main/java/dp/composite/Text.java
new file mode 100644
index 000000000..2a07f699f
--- /dev/null
+++ b/students/740707954/src/main/java/dp/composite/Text.java
@@ -0,0 +1,12 @@
+package dp.composite;
+
+/**
+ * 文本
+ * Created by lx on 2017/7/29.
+ */
+public class Text implements Shape{
+    @Override
+    public void draw() {
+        System.out.println("画文本");
+    }
+}
diff --git a/students/740707954/src/main/java/dp/decorator/Email.java b/students/740707954/src/main/java/dp/decorator/Email.java
new file mode 100644
index 000000000..520475c0a
--- /dev/null
+++ b/students/740707954/src/main/java/dp/decorator/Email.java
@@ -0,0 +1,8 @@
+package dp.decorator;
+
+/**
+ * Created by lx on 2017/7/29.
+ */
+public interface Email {
+    String getContent();
+}
diff --git a/students/740707954/src/main/java/dp/decorator/EmailImpl.java b/students/740707954/src/main/java/dp/decorator/EmailImpl.java
new file mode 100644
index 000000000..58ef0b4d8
--- /dev/null
+++ b/students/740707954/src/main/java/dp/decorator/EmailImpl.java
@@ -0,0 +1,17 @@
+package dp.decorator;
+
+/**
+ * Created by lx on 2017/7/29.
+ */
+public class EmailImpl implements Email {
+    private String content;
+
+    public EmailImpl(String content) {
+        this.content = content;
+    }
+
+    @Override
+    public String getContent() {
+        return content;
+    }
+}
diff --git a/students/740707954/src/main/java/dp/decorator/EmailTest.java b/students/740707954/src/main/java/dp/decorator/EmailTest.java
new file mode 100644
index 000000000..81ba464e1
--- /dev/null
+++ b/students/740707954/src/main/java/dp/decorator/EmailTest.java
@@ -0,0 +1,15 @@
+package dp.decorator;
+
+import org.junit.Test;
+
+/**
+ * Created by lx on 2017/7/29.
+ */
+public class EmailTest {
+    @Test
+    public void testEmail() {
+        Email e = new OutsideEmailImpl(new EncryptionEmailImpl(new EmailImpl("内容\n")));
+        System.out.println(e.getContent());
+    }
+
+}
diff --git a/students/740707954/src/main/java/dp/decorator/EncryptionEmailImpl.java b/students/740707954/src/main/java/dp/decorator/EncryptionEmailImpl.java
new file mode 100644
index 000000000..f3adfce50
--- /dev/null
+++ b/students/740707954/src/main/java/dp/decorator/EncryptionEmailImpl.java
@@ -0,0 +1,22 @@
+package dp.decorator;
+
+/**
+ * 加密邮件
+ * Created by lx on 2017/7/29.
+ */
+public class EncryptionEmailImpl extends FilterEmail{
+
+    public EncryptionEmailImpl(Email email) {
+        super(email);
+    }
+
+    @Override
+    public String getContent() {
+        return encryptionEmail(super.getContent());
+    }
+
+    public String encryptionEmail(String content) {
+        System.out.println("加密邮件。。");
+        return "加密：" + content;
+    }
+}
diff --git a/students/740707954/src/main/java/dp/decorator/FilterEmail.java b/students/740707954/src/main/java/dp/decorator/FilterEmail.java
new file mode 100644
index 000000000..c063b0c3d
--- /dev/null
+++ b/students/740707954/src/main/java/dp/decorator/FilterEmail.java
@@ -0,0 +1,18 @@
+package dp.decorator;
+
+/**
+ * Created by lx on 2017/7/29.
+ */
+public class FilterEmail implements Email {
+
+    private Email email;
+
+    public FilterEmail(Email email) {
+        this.email = email;
+    }
+
+    @Override
+    public String getContent() {
+        return email.getContent();
+    }
+}
diff --git a/students/740707954/src/main/java/dp/decorator/OutsideEmailImpl.java b/students/740707954/src/main/java/dp/decorator/OutsideEmailImpl.java
new file mode 100644
index 000000000..07f53202a
--- /dev/null
+++ b/students/740707954/src/main/java/dp/decorator/OutsideEmailImpl.java
@@ -0,0 +1,22 @@
+package dp.decorator;
+
+/**
+ * 外部邮件
+ * Created by lx on 2017/7/29.
+ */
+public class OutsideEmailImpl extends FilterEmail {
+
+    public OutsideEmailImpl(Email email) {
+        super(email);
+    }
+
+    @Override
+    public String getContent() {
+        return super.getContent() + addSuffix();
+    }
+
+    public String addSuffix() {
+        return "本邮件仅为个人观点，并不代表公司立场";
+    }
+
+}

From eb15c6a24a2665f118551ae680579db538594a77 Mon Sep 17 00:00:00 2001
From: akinaru-lu <akinaru.lu@gmail.com>
Date: Sun, 30 Jul 2017 10:28:08 +0900
Subject: [PATCH 5/9] =?UTF-8?q?7-23=E6=97=A5=E4=BD=9C=E4=B8=9A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../java/com/coderising/dp/bridge/Circle.java | 20 ++++++++++++++
 .../coderising/dp/bridge/GraphicLibrary.java  |  9 +++++++
 .../coderising/dp/bridge/GraphicLibrary1.java | 26 +++++++++++++++++++
 .../coderising/dp/bridge/GraphicLibrary2.java | 21 +++++++++++++++
 .../com/coderising/dp/bridge/Rectangle.java   | 21 +++++++++++++++
 .../java/com/coderising/dp/bridge/Shape.java  |  7 +++++
 .../com/coderising/dp/composite/Line.java     |  9 +++++++
 .../com/coderising/dp/composite/Picture.java  | 17 ++++++++++++
 .../coderising/dp/composite/Rectangle.java    | 11 ++++++++
 .../com/coderising/dp/composite/Shape.java    |  5 ++++
 .../com/coderising/dp/composite/Square.java   | 10 +++++++
 .../com/coderising/dp/composite/Text.java     | 10 +++++++
 .../com/coderising/dp/decorator/Email.java    |  8 ++++++
 .../dp/decorator/EmailDecorator.java          |  4 +++
 .../coderising/dp/decorator/EmailImpl.java    | 14 ++++++++++
 .../dp/decorator/ExternalEmail.java           | 14 ++++++++++
 .../dp/decorator/InternalEmail.java           | 11 ++++++++
 17 files changed, 217 insertions(+)
 create mode 100644 students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/Circle.java
 create mode 100644 students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/GraphicLibrary.java
 create mode 100644 students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/GraphicLibrary1.java
 create mode 100644 students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/GraphicLibrary2.java
 create mode 100644 students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/Rectangle.java
 create mode 100644 students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/Shape.java
 create mode 100644 students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Line.java
 create mode 100644 students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Picture.java
 create mode 100644 students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Rectangle.java
 create mode 100644 students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Shape.java
 create mode 100644 students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Square.java
 create mode 100644 students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Text.java
 create mode 100644 students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/Email.java
 create mode 100644 students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/EmailDecorator.java
 create mode 100644 students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/EmailImpl.java
 create mode 100644 students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/ExternalEmail.java
 create mode 100644 students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/InternalEmail.java

diff --git a/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/Circle.java b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/Circle.java
new file mode 100644
index 000000000..af7b07c91
--- /dev/null
+++ b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/Circle.java
@@ -0,0 +1,20 @@
+package bridge;
+
+public class Circle implements Shape {
+
+    private int x;
+    private int y;
+    private int r;
+
+    public Circle(int x, int y, int r) {
+        this.x = x;
+        this.y = y;
+        this.r = r;
+    }
+
+    @Override
+    public void draw(GraphicLibrary gl) {
+        gl.drawCircle(x, y, r);
+    }
+
+}
diff --git a/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/GraphicLibrary.java b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/GraphicLibrary.java
new file mode 100644
index 000000000..73088a932
--- /dev/null
+++ b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/GraphicLibrary.java
@@ -0,0 +1,9 @@
+package bridge;
+
+public interface GraphicLibrary {
+
+    void drawRectangle(int x1, int y1, int x2, int y2);
+
+    void drawCircle(int x, int y, int r);
+
+}
diff --git a/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/GraphicLibrary1.java b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/GraphicLibrary1.java
new file mode 100644
index 000000000..a53f87750
--- /dev/null
+++ b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/GraphicLibrary1.java
@@ -0,0 +1,26 @@
+package bridge;
+
+public class GraphicLibrary1 implements GraphicLibrary {
+
+    @Override
+    public void drawRectangle(int x1, int y1, int x2, int y2) {
+        draw_a_line(x1, y1, x1, y2);
+        draw_a_line(x1, y2, x2, y2);
+        draw_a_line(x2, y2, x2, y1);
+        draw_a_line(x2, y1, x1, y1);
+    }
+
+    @Override
+    public void drawCircle(int x, int y, int r) {
+        draw_a_circle(x, y, r);
+    }
+
+	private void draw_a_line(int x1, int y1, int x2, int y2) {
+		
+	}
+
+	private void draw_a_circle(int x, int y, int r) {
+		
+	}
+
+}
diff --git a/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/GraphicLibrary2.java b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/GraphicLibrary2.java
new file mode 100644
index 000000000..6ad1bdc5d
--- /dev/null
+++ b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/GraphicLibrary2.java
@@ -0,0 +1,21 @@
+package bridge;
+
+public class GraphicLibrary2 implements GraphicLibrary {
+
+    @Override
+    public void drawRectangle(int x1, int y1, int x2, int y2) {
+        drawLine(x1, x2, y1, y2);
+        drawLine(x1, x2, y2, y2);
+        drawLine(x2, x2, y2, y1);
+        drawLine(x2, x1, y1, y1);
+    }
+
+    @Override
+	public void drawCircle(int x,int y, int r) {
+		
+	}
+
+	private void drawLine(int x1, int x2, int y1, int y2) {
+	}
+
+}
diff --git a/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/Rectangle.java b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/Rectangle.java
new file mode 100644
index 000000000..471c2b94e
--- /dev/null
+++ b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/Rectangle.java
@@ -0,0 +1,21 @@
+package bridge;
+
+public class Rectangle implements Shape {
+
+    private int x1;
+    private int y1;
+    private int x2;
+    private int y2;
+
+    public Rectangle(int x1, int y1, int x2, int y2) {
+        this.x1 = x1;
+        this.y1 = y1;
+        this.x2 = x2;
+        this.y2 = y2;
+    }
+
+    @Override
+    public void draw(GraphicLibrary gl) {
+        gl.drawRectangle(x1, y1, x2, y2);
+    }
+}
diff --git a/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/Shape.java b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/Shape.java
new file mode 100644
index 000000000..1b6e584cd
--- /dev/null
+++ b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/Shape.java
@@ -0,0 +1,7 @@
+package bridge;
+
+public interface Shape {
+
+    void draw(GraphicLibrary gl);
+
+}
diff --git a/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Line.java b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Line.java
new file mode 100644
index 000000000..d15975aaa
--- /dev/null
+++ b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Line.java
@@ -0,0 +1,9 @@
+package composite;
+
+public class Line implements Shape {
+
+	@Override
+	public void draw() {
+	}
+
+}
diff --git a/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Picture.java b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Picture.java
new file mode 100644
index 000000000..80bfa1445
--- /dev/null
+++ b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Picture.java
@@ -0,0 +1,17 @@
+package composite;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Picture implements Shape {
+    private final List<Shape> shapes = new ArrayList<>();
+
+    @Override
+    public void draw() {
+        shapes.forEach(shape -> draw());
+    }
+
+    public void add(Shape shape) {
+        shapes.add(shape);
+    }
+}
diff --git a/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Rectangle.java b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Rectangle.java
new file mode 100644
index 000000000..4902fbcd9
--- /dev/null
+++ b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Rectangle.java
@@ -0,0 +1,11 @@
+package composite;
+
+public class Rectangle implements Shape {
+
+	@Override
+	public void draw() {
+		// TODO Auto-generated method stub
+
+	}
+
+}
diff --git a/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Shape.java b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Shape.java
new file mode 100644
index 000000000..8864087e5
--- /dev/null
+++ b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Shape.java
@@ -0,0 +1,5 @@
+package composite;
+
+public interface Shape {
+	public void draw();
+}
diff --git a/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Square.java b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Square.java
new file mode 100644
index 000000000..9aff729f3
--- /dev/null
+++ b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Square.java
@@ -0,0 +1,10 @@
+package composite;
+
+public class Square implements Shape {
+
+	@Override
+	public void draw() {
+		// TODO Auto-generated method stub
+	}
+
+}
diff --git a/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Text.java b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Text.java
new file mode 100644
index 000000000..15305bb9e
--- /dev/null
+++ b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Text.java
@@ -0,0 +1,10 @@
+package composite;
+
+public class Text implements Shape {
+
+	@Override
+	public void draw() {
+		// TODO Auto-generated method stub
+	}
+
+}
diff --git a/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/Email.java b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/Email.java
new file mode 100644
index 000000000..c36050aa3
--- /dev/null
+++ b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/Email.java
@@ -0,0 +1,8 @@
+package decorator;
+
+public interface Email {
+
+    String getContent();
+
+}
+
diff --git a/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/EmailDecorator.java b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/EmailDecorator.java
new file mode 100644
index 000000000..0cadd6057
--- /dev/null
+++ b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/EmailDecorator.java
@@ -0,0 +1,4 @@
+package decorator;
+
+public abstract class EmailDecorator implements Email {
+}
\ No newline at end of file
diff --git a/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/EmailImpl.java b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/EmailImpl.java
new file mode 100644
index 000000000..7044dc9c4
--- /dev/null
+++ b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/EmailImpl.java
@@ -0,0 +1,14 @@
+package decorator;
+
+public class EmailImpl implements Email {
+
+	private String content;
+
+	public EmailImpl(String content) {
+		this.content = content;
+	}
+
+	public String getContent() {
+		return content;
+	}
+}
diff --git a/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/ExternalEmail.java b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/ExternalEmail.java
new file mode 100644
index 000000000..1dc01a34b
--- /dev/null
+++ b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/ExternalEmail.java
@@ -0,0 +1,14 @@
+package decorator;
+
+public class ExternalEmail extends EmailDecorator {
+
+    private Email email;
+
+    public ExternalEmail(Email email) {
+        this.email = email;
+    }
+
+    public String getContent() {
+        return email.getContent() + "\n\n本邮件仅为个人观点，并不代表公司立场";
+    }
+}
diff --git a/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/InternalEmail.java b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/InternalEmail.java
new file mode 100644
index 000000000..885a7573d
--- /dev/null
+++ b/students/729770920/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/InternalEmail.java
@@ -0,0 +1,11 @@
+package decorator;
+
+public class InternalEmail extends EmailDecorator {
+
+    private Email email;
+
+    public String getContent() {
+        return email.getContent();
+    }
+
+}

From 30d4ab385bd80a442465a6551ffca71ffea0fc72 Mon Sep 17 00:00:00 2001
From: sheng <1158154002@qq.com>
Date: Wed, 2 Aug 2017 08:02:02 +0800
Subject: [PATCH 6/9] dp

---
 .../java/com/coderising/dp/bridge/Circle.java | 12 +++
 .../com/coderising/dp/bridge/Drawing.java     |  6 ++
 .../com/coderising/dp/bridge/DrawingGL1.java  | 15 ++++
 .../com/coderising/dp/bridge/DrawingGL2.java  | 15 ++++
 .../com/coderising/dp/bridge/Rectangle.java   | 11 +++
 .../java/com/coderising/dp/bridge/Shape.java  | 12 +++
 .../java/com/coderising/dp/bridge/Test.java   | 16 ++++
 .../com/coderising/dp/composite/Line.java     | 11 +++
 .../com/coderising/dp/composite/Picture.java  | 33 ++++++++
 .../coderising/dp/composite/Rectangle.java    | 10 +++
 .../com/coderising/dp/composite/Shape.java    |  5 ++
 .../com/coderising/dp/composite/Square.java   | 10 +++
 .../com/coderising/dp/composite/Text.java     | 10 +++
 .../com/coderising/dp/decorator/Email.java    |  5 ++
 .../coderising/dp/decorator/EmailImpl.java    | 14 ++++
 .../coderising/dp/decorator/EmailProxy.java   | 29 +++++++
 .../com/coderising/dp/decorator/Encrypt.java  | 76 +++++++++++++++++++
 17 files changed, 290 insertions(+)
 create mode 100644 students/1158154002/src/main/java/com/coderising/dp/bridge/Circle.java
 create mode 100644 students/1158154002/src/main/java/com/coderising/dp/bridge/Drawing.java
 create mode 100644 students/1158154002/src/main/java/com/coderising/dp/bridge/DrawingGL1.java
 create mode 100644 students/1158154002/src/main/java/com/coderising/dp/bridge/DrawingGL2.java
 create mode 100644 students/1158154002/src/main/java/com/coderising/dp/bridge/Rectangle.java
 create mode 100644 students/1158154002/src/main/java/com/coderising/dp/bridge/Shape.java
 create mode 100644 students/1158154002/src/main/java/com/coderising/dp/bridge/Test.java
 create mode 100644 students/1158154002/src/main/java/com/coderising/dp/composite/Line.java
 create mode 100644 students/1158154002/src/main/java/com/coderising/dp/composite/Picture.java
 create mode 100644 students/1158154002/src/main/java/com/coderising/dp/composite/Rectangle.java
 create mode 100644 students/1158154002/src/main/java/com/coderising/dp/composite/Shape.java
 create mode 100644 students/1158154002/src/main/java/com/coderising/dp/composite/Square.java
 create mode 100644 students/1158154002/src/main/java/com/coderising/dp/composite/Text.java
 create mode 100644 students/1158154002/src/main/java/com/coderising/dp/decorator/Email.java
 create mode 100644 students/1158154002/src/main/java/com/coderising/dp/decorator/EmailImpl.java
 create mode 100644 students/1158154002/src/main/java/com/coderising/dp/decorator/EmailProxy.java
 create mode 100644 students/1158154002/src/main/java/com/coderising/dp/decorator/Encrypt.java

diff --git a/students/1158154002/src/main/java/com/coderising/dp/bridge/Circle.java b/students/1158154002/src/main/java/com/coderising/dp/bridge/Circle.java
new file mode 100644
index 000000000..39483dabb
--- /dev/null
+++ b/students/1158154002/src/main/java/com/coderising/dp/bridge/Circle.java
@@ -0,0 +1,12 @@
+package com.coderising.dp.bridge;
+
+public class Circle extends Shape {
+
+	@Override
+	public void draw() {
+		super.getDrawing().drawCircle();
+		System.out.println("I'm a Line");
+
+	}
+
+}
\ No newline at end of file
diff --git a/students/1158154002/src/main/java/com/coderising/dp/bridge/Drawing.java b/students/1158154002/src/main/java/com/coderising/dp/bridge/Drawing.java
new file mode 100644
index 000000000..97ad4b237
--- /dev/null
+++ b/students/1158154002/src/main/java/com/coderising/dp/bridge/Drawing.java
@@ -0,0 +1,6 @@
+package com.coderising.dp.bridge;
+
+public interface Drawing {
+void drawLine();
+void drawCircle();
+}
diff --git a/students/1158154002/src/main/java/com/coderising/dp/bridge/DrawingGL1.java b/students/1158154002/src/main/java/com/coderising/dp/bridge/DrawingGL1.java
new file mode 100644
index 000000000..c1addd265
--- /dev/null
+++ b/students/1158154002/src/main/java/com/coderising/dp/bridge/DrawingGL1.java
@@ -0,0 +1,15 @@
+package com.coderising.dp.bridge;
+
+public class DrawingGL1 implements Drawing{
+
+	@Override
+	public void drawLine() {
+		System.out.println("DrawingGL1.drawLine");
+	}
+
+	@Override
+	public void drawCircle() {
+		System.out.println("DrawingGL1.drawCircle");
+	}
+
+}
diff --git a/students/1158154002/src/main/java/com/coderising/dp/bridge/DrawingGL2.java b/students/1158154002/src/main/java/com/coderising/dp/bridge/DrawingGL2.java
new file mode 100644
index 000000000..b30a86d05
--- /dev/null
+++ b/students/1158154002/src/main/java/com/coderising/dp/bridge/DrawingGL2.java
@@ -0,0 +1,15 @@
+package com.coderising.dp.bridge;
+
+public class DrawingGL2 implements Drawing{
+
+	@Override
+	public void drawLine() {
+		System.out.println("DrawingGL2.drawLine");
+	}
+
+	@Override
+	public void drawCircle() {
+		System.out.println("DrawingGL2.drawCircle");
+	}
+
+}
diff --git a/students/1158154002/src/main/java/com/coderising/dp/bridge/Rectangle.java b/students/1158154002/src/main/java/com/coderising/dp/bridge/Rectangle.java
new file mode 100644
index 000000000..ab4f171f9
--- /dev/null
+++ b/students/1158154002/src/main/java/com/coderising/dp/bridge/Rectangle.java
@@ -0,0 +1,11 @@
+package com.coderising.dp.bridge;
+
+public class Rectangle extends Shape {
+
+	@Override
+	public void draw() {
+		super.getDrawing().drawLine();
+		System.out.println("I'm a Rectangle");
+	}
+
+}
\ No newline at end of file
diff --git a/students/1158154002/src/main/java/com/coderising/dp/bridge/Shape.java b/students/1158154002/src/main/java/com/coderising/dp/bridge/Shape.java
new file mode 100644
index 000000000..f317e344d
--- /dev/null
+++ b/students/1158154002/src/main/java/com/coderising/dp/bridge/Shape.java
@@ -0,0 +1,12 @@
+package com.coderising.dp.bridge;
+
+public abstract class Shape {
+	public Drawing drawing;
+	public Drawing getDrawing() {
+		return drawing;
+	}
+	public void setDrawing(Drawing drawing) {
+		this.drawing = drawing;
+	}
+	public abstract void draw();
+}
diff --git a/students/1158154002/src/main/java/com/coderising/dp/bridge/Test.java b/students/1158154002/src/main/java/com/coderising/dp/bridge/Test.java
new file mode 100644
index 000000000..3aceb7fe8
--- /dev/null
+++ b/students/1158154002/src/main/java/com/coderising/dp/bridge/Test.java
@@ -0,0 +1,16 @@
+package com.coderising.dp.bridge;
+
+public class Test {
+
+	public static void main(String[] args) {
+		Shape rectangel=new Rectangle();
+		rectangel.setDrawing(new DrawingGL1());
+		rectangel.draw();
+		
+
+		Shape circle=new Circle();
+		circle.setDrawing(new DrawingGL2());
+		circle.draw();
+	}
+
+}
diff --git a/students/1158154002/src/main/java/com/coderising/dp/composite/Line.java b/students/1158154002/src/main/java/com/coderising/dp/composite/Line.java
new file mode 100644
index 000000000..411eb8087
--- /dev/null
+++ b/students/1158154002/src/main/java/com/coderising/dp/composite/Line.java
@@ -0,0 +1,11 @@
+package com.coderising.dp.composite;
+
+public class Line implements Shape {
+
+	@Override
+	public void draw() {
+		System.out.println("I'm a Line");
+
+	}
+
+}
\ No newline at end of file
diff --git a/students/1158154002/src/main/java/com/coderising/dp/composite/Picture.java b/students/1158154002/src/main/java/com/coderising/dp/composite/Picture.java
new file mode 100644
index 000000000..b52ac69ae
--- /dev/null
+++ b/students/1158154002/src/main/java/com/coderising/dp/composite/Picture.java
@@ -0,0 +1,33 @@
+package com.coderising.dp.composite;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Picture implements Shape{
+	private List<Shape> shapes=new ArrayList<>();
+	@Override
+	public void draw() {
+		for (Shape shape : shapes) {
+			shape.draw();
+		}
+	}
+	
+	public void add(Shape shape){
+		shapes.add(shape);
+	}
+	
+	public static void main(String[] args) {
+		Picture aPicture=new Picture();
+		aPicture.add(new Line());
+		aPicture.add(new Rectangle());
+		
+		Picture a=new Picture();
+		a.add(new Text());
+		a.add(new Line());
+		a.add(new Square());
+		aPicture.add(a);
+		
+		aPicture.draw();
+	}
+
+}
diff --git a/students/1158154002/src/main/java/com/coderising/dp/composite/Rectangle.java b/students/1158154002/src/main/java/com/coderising/dp/composite/Rectangle.java
new file mode 100644
index 000000000..9547cd7aa
--- /dev/null
+++ b/students/1158154002/src/main/java/com/coderising/dp/composite/Rectangle.java
@@ -0,0 +1,10 @@
+package com.coderising.dp.composite;
+
+public class Rectangle implements Shape {
+
+	@Override
+	public void draw() {
+		System.out.println("I'm a Rectangle");
+	}
+
+}
\ No newline at end of file
diff --git a/students/1158154002/src/main/java/com/coderising/dp/composite/Shape.java b/students/1158154002/src/main/java/com/coderising/dp/composite/Shape.java
new file mode 100644
index 000000000..45c428c6b
--- /dev/null
+++ b/students/1158154002/src/main/java/com/coderising/dp/composite/Shape.java
@@ -0,0 +1,5 @@
+package com.coderising.dp.composite;
+
+public interface Shape {
+	public void draw();
+}
diff --git a/students/1158154002/src/main/java/com/coderising/dp/composite/Square.java b/students/1158154002/src/main/java/com/coderising/dp/composite/Square.java
new file mode 100644
index 000000000..50b94ca09
--- /dev/null
+++ b/students/1158154002/src/main/java/com/coderising/dp/composite/Square.java
@@ -0,0 +1,10 @@
+package com.coderising.dp.composite;
+
+public class Square implements Shape {
+
+	@Override
+	public void draw() {
+		System.out.println("I'm a Square");
+	}
+
+}
diff --git a/students/1158154002/src/main/java/com/coderising/dp/composite/Text.java b/students/1158154002/src/main/java/com/coderising/dp/composite/Text.java
new file mode 100644
index 000000000..db0268f18
--- /dev/null
+++ b/students/1158154002/src/main/java/com/coderising/dp/composite/Text.java
@@ -0,0 +1,10 @@
+package com.coderising.dp.composite;
+
+public class Text implements Shape {
+
+	@Override
+	public void draw() {
+		System.out.println("I'm a Text");
+	}
+
+}
\ No newline at end of file
diff --git a/students/1158154002/src/main/java/com/coderising/dp/decorator/Email.java b/students/1158154002/src/main/java/com/coderising/dp/decorator/Email.java
new file mode 100644
index 000000000..50ce11677
--- /dev/null
+++ b/students/1158154002/src/main/java/com/coderising/dp/decorator/Email.java
@@ -0,0 +1,5 @@
+package com.coderising.dp.decorator;
+
+public interface Email {
+	public String getContent();
+}
diff --git a/students/1158154002/src/main/java/com/coderising/dp/decorator/EmailImpl.java b/students/1158154002/src/main/java/com/coderising/dp/decorator/EmailImpl.java
new file mode 100644
index 000000000..7ce815ca3
--- /dev/null
+++ b/students/1158154002/src/main/java/com/coderising/dp/decorator/EmailImpl.java
@@ -0,0 +1,14 @@
+package com.coderising.dp.decorator;
+
+public class EmailImpl implements Email{
+	private String content;
+
+	public EmailImpl(String content) {
+		this.content = content;
+	}
+	
+	@Override
+	public String getContent() {
+		return content;
+	}
+}
diff --git a/students/1158154002/src/main/java/com/coderising/dp/decorator/EmailProxy.java b/students/1158154002/src/main/java/com/coderising/dp/decorator/EmailProxy.java
new file mode 100644
index 000000000..344459a35
--- /dev/null
+++ b/students/1158154002/src/main/java/com/coderising/dp/decorator/EmailProxy.java
@@ -0,0 +1,29 @@
+package com.coderising.dp.decorator;
+
+public class EmailProxy implements Email{
+	Email email;
+	
+	@Override
+	public String getContent() {
+		String content=email.getContent()+"\n本邮件仅为个人观点，并不代表公司立场";
+		System.out.println(content);
+		content=Encrypt.SHA256(content);
+		System.out.println(content);
+		return content;
+	}
+	
+	public void setEmail(Email email) {
+		this.email = email;
+	}
+
+	public static void main(String[] args) {
+		EmailImpl email=new EmailImpl("hello world!");
+		EmailProxy proxy=new EmailProxy();
+		EmailProxy proxy1=new EmailProxy();
+		proxy.setEmail(email);
+	//	proxy.getContent();
+		proxy1.setEmail(proxy);
+		proxy1.getContent();
+	}
+
+}
diff --git a/students/1158154002/src/main/java/com/coderising/dp/decorator/Encrypt.java b/students/1158154002/src/main/java/com/coderising/dp/decorator/Encrypt.java
new file mode 100644
index 000000000..79f2a4a4d
--- /dev/null
+++ b/students/1158154002/src/main/java/com/coderising/dp/decorator/Encrypt.java
@@ -0,0 +1,76 @@
+package com.coderising.dp.decorator;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+public class Encrypt {
+	 /** 
+	   * 传入文本内容，返回 SHA-256 串 
+	   *  
+	   * @param strText 
+	   * @return 
+	   */  
+	  public static String SHA256(final String strText)  
+	  {  
+	    return SHA(strText, "SHA-256");  
+	  }  
+	  
+	  /** 
+	   * 传入文本内容，返回 SHA-512 串 
+	   *  
+	   * @param strText 
+	   * @return 
+	   */  
+	  public static String SHA512(final String strText)  
+	  {  
+	    return SHA(strText, "SHA-512");  
+	  }  
+	  
+	  /** 
+	   * 字符串 SHA 加密 
+	   *  
+	   * @param strSourceText 
+	   * @return 
+	   */  
+	  private static String SHA(final String strText, final String strType)  
+	  {  
+	    // 返回值  
+	    String strResult = null;  
+	  
+	    // 是否是有效字符串  
+	    if (strText != null && strText.length() > 0)  
+	    {  
+	      try  
+	      {  
+	        // SHA 加密开始  
+	        // 创建加密对象 并傳入加密類型  
+	        MessageDigest messageDigest = MessageDigest.getInstance(strType);  
+	        // 传入要加密的字符串  
+	        messageDigest.update(strText.getBytes());  
+	        // 得到 byte 類型结果  
+	        byte byteBuffer[] = messageDigest.digest();  
+	  
+	        // 將 byte 轉換爲 string  
+	        StringBuffer strHexString = new StringBuffer();  
+	        // 遍歷 byte buffer  
+	        for (int i = 0; i < byteBuffer.length; i++)  
+	        {  
+	          String hex = Integer.toHexString(0xff & byteBuffer[i]);  
+	          if (hex.length() == 1)  
+	          {  
+	            strHexString.append('0');  
+	          }  
+	          strHexString.append(hex);  
+	        }  
+	        // 得到返回結果  
+	        strResult = strHexString.toString();  
+	      }  
+	      catch (NoSuchAlgorithmException e)  
+	      {  
+	        e.printStackTrace();  
+	      }  
+	    }  
+	  
+	    return strResult;  
+	  }  
+}

From 2bc90bae989a979f278865ef53c1ff09517cc2f8 Mon Sep 17 00:00:00 2001
From: bendell02 <1203029076@qq.com>
Date: Thu, 3 Aug 2017 01:31:23 +0800
Subject: [PATCH 7/9] =?UTF-8?q?=E4=BD=9C=E4=B8=9A3=EF=BC=9A=E5=AE=9E?=
 =?UTF-8?q?=E7=8E=B0=E8=A3=85=E9=A5=B0=E8=80=85?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../com/coderising/dp/decorator/Email.java    |  6 ++++++
 .../dp/decorator/EmailDecorator.java          | 15 +++++++++++++++
 .../coderising/dp/decorator/EmailImpl.java    | 12 ++++++++++++
 .../coderising/dp/decorator/EncryptEmail.java | 19 +++++++++++++++++++
 .../coderising/dp/decorator/SendOutEmail.java | 14 ++++++++++++++
 5 files changed, 66 insertions(+)
 create mode 100644 students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/Email.java
 create mode 100644 students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/EmailDecorator.java
 create mode 100644 students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/EmailImpl.java
 create mode 100644 students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/EncryptEmail.java
 create mode 100644 students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/SendOutEmail.java

diff --git a/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/Email.java b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/Email.java
new file mode 100644
index 000000000..064de1e83
--- /dev/null
+++ b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/Email.java
@@ -0,0 +1,6 @@
+package com.coderising.dp.decorator;
+
+public interface Email {
+	public String getContent();
+}
+
diff --git a/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/EmailDecorator.java b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/EmailDecorator.java
new file mode 100644
index 000000000..093d9d92c
--- /dev/null
+++ b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/EmailDecorator.java
@@ -0,0 +1,15 @@
+package com.coderising.dp.decorator;
+
+public abstract class EmailDecorator implements Email{
+	protected Email email;
+	
+	public EmailDecorator(Email email) {
+		// TODO Auto-generated constructor stub
+		this.email = email;
+	}
+	
+	public String getContent() {
+		// TODO Auto-generated method stub
+		return email.getContent();
+	}
+}
\ No newline at end of file
diff --git a/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/EmailImpl.java b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/EmailImpl.java
new file mode 100644
index 000000000..640aef6da
--- /dev/null
+++ b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/EmailImpl.java
@@ -0,0 +1,12 @@
+package com.coderising.dp.decorator;
+
+public class EmailImpl implements Email {
+	private String content;
+
+	public EmailImpl(String content) {
+		this.content = content;
+	}
+	public String getContent()   {
+		return content;
+	}
+}
diff --git a/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/EncryptEmail.java b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/EncryptEmail.java
new file mode 100644
index 000000000..5715936bd
--- /dev/null
+++ b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/EncryptEmail.java
@@ -0,0 +1,19 @@
+package com.coderising.dp.decorator;
+
+public class EncryptEmail extends EmailDecorator {
+	public EncryptEmail(Email email) {
+		// TODO Auto-generated constructor stub
+		super(email);
+	}
+	
+	@Override
+	public String getContent() {
+		// TODO Auto-generated method stub
+		return encrypt(super.getContent());
+	}
+	
+	private String encrypt(String content) {
+		// concrete encrypt algorithm
+		return content+"encrypt";
+	}
+}
diff --git a/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/SendOutEmail.java b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/SendOutEmail.java
new file mode 100644
index 000000000..cd756c3ca
--- /dev/null
+++ b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/SendOutEmail.java
@@ -0,0 +1,14 @@
+package com.coderising.dp.decorator;
+
+public class SendOutEmail extends EmailDecorator{
+	public SendOutEmail(Email email) {
+		// TODO Auto-generated constructor stub
+		super(email);
+	}
+	
+	@Override
+	public String getContent() {
+		// TODO Auto-generated method stub
+		return super.getContent()+"\n���ʼ���Ϊ���˹۵㣬����������˾����";
+	}
+}

From 2d33ec72ed7eb047da9186c5d1f1da7d07ca40f0 Mon Sep 17 00:00:00 2001
From: bendell02 <1203029076@qq.com>
Date: Thu, 3 Aug 2017 01:32:20 +0800
Subject: [PATCH 8/9] =?UTF-8?q?=E4=BD=9C=E4=B8=9A4=EF=BC=9A=E5=AE=9E?=
 =?UTF-8?q?=E7=8E=B0Composite?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../com/coderising/dp/composite/Line.java     | 10 ++++++
 .../com/coderising/dp/composite/Picture.java  | 35 +++++++++++++++++++
 .../coderising/dp/composite/Rectangle.java    | 11 ++++++
 .../com/coderising/dp/composite/Shape.java    |  5 +++
 .../com/coderising/dp/composite/Square.java   | 11 ++++++
 .../com/coderising/dp/composite/Text.java     | 11 ++++++
 6 files changed, 83 insertions(+)
 create mode 100644 students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Line.java
 create mode 100644 students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Picture.java
 create mode 100644 students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Rectangle.java
 create mode 100644 students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Shape.java
 create mode 100644 students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Square.java
 create mode 100644 students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Text.java

diff --git a/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Line.java b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Line.java
new file mode 100644
index 000000000..e6ab14c61
--- /dev/null
+++ b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Line.java
@@ -0,0 +1,10 @@
+package com.coderising.dp.composite;
+
+public class Line implements Shape {
+
+	@Override
+	public void draw() {
+		System.out.println("I'm a line");
+	}
+
+}
diff --git a/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Picture.java b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Picture.java
new file mode 100644
index 000000000..6775f730a
--- /dev/null
+++ b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Picture.java
@@ -0,0 +1,35 @@
+package com.coderising.dp.composite;
+
+import java.util.ArrayList;
+
+public class Picture implements Shape {
+	ArrayList<Shape> shapes = new ArrayList<>();
+	
+	@Override
+	public void draw() {
+		// TODO Auto-generated method stub
+		for(Shape shape:shapes) {
+			shape.draw();
+		}
+	}
+	
+	public void add(Shape shape) {
+		shapes.add(shape);
+	}
+	
+	public static void main(String[] args) {
+		Picture aPicture = new Picture();
+		
+		Picture p = new Picture();
+		p.add(new Text());
+		p.add(new Line());
+		p.add(new Rectangle());
+		
+		aPicture.add(p);
+		
+		aPicture.add(new Line());
+		aPicture.add(new Rectangle());
+		
+		aPicture.draw();		
+	}
+}
diff --git a/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Rectangle.java b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Rectangle.java
new file mode 100644
index 000000000..7db5bb1c2
--- /dev/null
+++ b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Rectangle.java
@@ -0,0 +1,11 @@
+package com.coderising.dp.composite;
+
+public class Rectangle implements Shape {
+
+	@Override
+	public void draw() {
+		// TODO Auto-generated method stub
+		System.out.println("I'm a rectangle");
+	}
+
+}
diff --git a/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Shape.java b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Shape.java
new file mode 100644
index 000000000..4562f10b1
--- /dev/null
+++ b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Shape.java
@@ -0,0 +1,5 @@
+package com.coderising.dp.composite;
+
+public interface Shape {
+	public void draw();
+}
diff --git a/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Square.java b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Square.java
new file mode 100644
index 000000000..fd17ae305
--- /dev/null
+++ b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Square.java
@@ -0,0 +1,11 @@
+package com.coderising.dp.composite;
+
+public class Square implements Shape {
+
+	@Override
+	public void draw() {
+		// TODO Auto-generated method stub
+		System.out.println("I'm a Square");
+	}
+
+}
diff --git a/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Text.java b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Text.java
new file mode 100644
index 000000000..c3c9ebf60
--- /dev/null
+++ b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/composite/Text.java
@@ -0,0 +1,11 @@
+package com.coderising.dp.composite;
+
+public class Text implements Shape {
+
+	@Override
+	public void draw() {
+		// TODO Auto-generated method stub
+		System.out.println("I'm a Text");
+	}
+
+}

From dce082aa15af182f40b276535db89918120e5ffc Mon Sep 17 00:00:00 2001
From: bendell02 <1203029076@qq.com>
Date: Thu, 3 Aug 2017 01:33:32 +0800
Subject: [PATCH 9/9] =?UTF-8?q?=E4=BD=9C=E4=B8=9A5=EF=BC=9A=E5=AE=9E?=
 =?UTF-8?q?=E7=8E=B0Bridge?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../java/com/coderising/dp/bridge/Circle.java | 19 +++++++++++++++
 .../com/coderising/dp/bridge/Drawing.java     |  6 +++++
 .../com/coderising/dp/bridge/DrawingGL1.java  | 18 ++++++++++++++
 .../com/coderising/dp/bridge/DrawingGL2.java  | 18 ++++++++++++++
 .../coderising/dp/bridge/GraphicLibrary1.java | 11 +++++++++
 .../coderising/dp/bridge/GraphicLibrary2.java | 11 +++++++++
 .../com/coderising/dp/bridge/Rectangle.java   | 24 +++++++++++++++++++
 .../java/com/coderising/dp/bridge/Shape.java  | 11 +++++++++
 8 files changed, 118 insertions(+)
 create mode 100644 students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/Circle.java
 create mode 100644 students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/Drawing.java
 create mode 100644 students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/DrawingGL1.java
 create mode 100644 students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/DrawingGL2.java
 create mode 100644 students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/GraphicLibrary1.java
 create mode 100644 students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/GraphicLibrary2.java
 create mode 100644 students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/Rectangle.java
 create mode 100644 students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/Shape.java

diff --git a/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/Circle.java b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/Circle.java
new file mode 100644
index 000000000..9762bd591
--- /dev/null
+++ b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/Circle.java
@@ -0,0 +1,19 @@
+package com.coderising.dp.bridge;
+
+public class Circle extends Shape {
+	private int x, y, r;
+
+	public Circle(Drawing drawing, int x, int y, int r) {
+		super(drawing);
+		this.x = x;
+		this.y = y;
+		this.r = r;
+	}
+
+	@Override
+	public void draw() {
+		// TODO Auto-generated method stub
+		drawing.drawCircle(x, y, r);
+	}
+
+}
diff --git a/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/Drawing.java b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/Drawing.java
new file mode 100644
index 000000000..d81f4709b
--- /dev/null
+++ b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/Drawing.java
@@ -0,0 +1,6 @@
+package com.coderising.dp.bridge;
+
+public interface Drawing {
+	public void drawLine(int x1, int y1, int x2, int y2);
+	public void drawCircle(int x, int y, int r);
+}
diff --git a/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/DrawingGL1.java b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/DrawingGL1.java
new file mode 100644
index 000000000..94410c065
--- /dev/null
+++ b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/DrawingGL1.java
@@ -0,0 +1,18 @@
+package com.coderising.dp.bridge;
+
+public class DrawingGL1 implements Drawing {
+	private GraphicLibrary1 graphicLibray1;
+
+	@Override
+	public void drawLine(int x1, int y1, int x2, int y2) {
+		// TODO Auto-generated method stub
+		graphicLibray1.draw_a_line(x1, y1, x2, y2);
+	}
+
+	@Override
+	public void drawCircle(int x, int y, int r) {
+		// TODO Auto-generated method stub
+		graphicLibray1.draw_a_circle(x, y, r);
+	}
+
+}
diff --git a/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/DrawingGL2.java b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/DrawingGL2.java
new file mode 100644
index 000000000..757cc2c4b
--- /dev/null
+++ b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/DrawingGL2.java
@@ -0,0 +1,18 @@
+package com.coderising.dp.bridge;
+
+public class DrawingGL2 implements Drawing {
+	private GraphicLibrary2 graphicLibrary2;
+
+	@Override
+	public void drawLine(int x1, int y1, int x2, int y2) {
+		// TODO Auto-generated method stub
+		graphicLibrary2.drawLine(x1, x2, y1, y2);
+	}
+
+	@Override
+	public void drawCircle(int x, int y, int r) {
+		// TODO Auto-generated method stub
+		graphicLibrary2.drawCircle(x, y, r);
+	}
+
+}
diff --git a/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/GraphicLibrary1.java b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/GraphicLibrary1.java
new file mode 100644
index 000000000..798cfbc7f
--- /dev/null
+++ b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/GraphicLibrary1.java
@@ -0,0 +1,11 @@
+package com.coderising.dp.bridge;
+
+public class GraphicLibrary1 {
+	public void draw_a_line(int x1,int y1,int x2,int y2){
+		
+	}
+	public void draw_a_circle(int x,int y, int r){
+		
+	}
+
+}
diff --git a/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/GraphicLibrary2.java b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/GraphicLibrary2.java
new file mode 100644
index 000000000..2e67a1220
--- /dev/null
+++ b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/GraphicLibrary2.java
@@ -0,0 +1,11 @@
+package com.coderising.dp.bridge;
+
+public class GraphicLibrary2 {
+	public void drawLine(int x1,int x2,int y1,int y2){
+		
+	}
+	public void drawCircle(int x,int y, int r){
+		
+	}
+
+}
diff --git a/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/Rectangle.java b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/Rectangle.java
new file mode 100644
index 000000000..b297769c9
--- /dev/null
+++ b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/Rectangle.java
@@ -0,0 +1,24 @@
+package com.coderising.dp.bridge;
+
+public class Rectangle extends Shape {
+	private int x1, y1, x2, y2;
+
+	public Rectangle(Drawing drawing, int x1, int y1, int x2, int y2) {
+		// TODO Auto-generated constructor stub
+		super(drawing);
+		this.x1 = x1;
+		this.y1 = y1;
+		this.x2 = x2;
+		this.y2 = y2;
+	}
+	
+	@Override
+	public void draw() {
+		// TODO Auto-generated method stub
+		drawing.drawLine(x1, y1, x1, y2);
+		drawing.drawLine(x1, y2, x2, y2);
+		drawing.drawLine(x2, y2, x2, y1);
+		drawing.drawLine(x2, y1, x1, y1);
+	}
+
+}
diff --git a/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/Shape.java b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/Shape.java
new file mode 100644
index 000000000..d90938201
--- /dev/null
+++ b/students/1203029076/ood/ood-assignment/src/main/java/com/coderising/dp/bridge/Shape.java
@@ -0,0 +1,11 @@
+package com.coderising.dp.bridge;
+
+public abstract class Shape {
+	protected Drawing drawing;
+	public Shape(Drawing drawing) {
+		// TODO Auto-generated constructor stub
+		this.drawing = drawing;
+	}
+	
+	public abstract void draw();
+}
