├── .idea
└── workspace.xml
├── Adapter Pattern
├── .idea
│ ├── description.html
│ ├── encodings.xml
│ ├── misc.xml
│ ├── modules.xml
│ ├── project-template.xml
│ ├── vcs.xml
│ └── workspace.xml
├── Adapter Pattern.iml
├── out
│ └── production
│ │ └── Adapter Pattern
│ │ └── com
│ │ └── company
│ │ ├── Circle.class
│ │ ├── DrawingTool.class
│ │ ├── IShape.class
│ │ ├── Main.class
│ │ ├── Square.class
│ │ ├── Triangle.class
│ │ └── TriangleAdapter.class
└── src
│ └── com
│ └── company
│ ├── Circle.java
│ ├── DrawingTool.java
│ ├── IShape.java
│ ├── Main.java
│ ├── Square.java
│ ├── Triangle.java
│ └── TriangleAdapter.java
├── Bridge Pattern
├── .idea
│ ├── codeStyles
│ │ ├── Project.xml
│ │ └── codeStyleConfig.xml
│ ├── description.html
│ ├── encodings.xml
│ ├── misc.xml
│ ├── modules.xml
│ ├── project-template.xml
│ ├── vcs.xml
│ └── workspace.xml
├── Bridge Pattern.iml
├── out
│ └── production
│ │ └── Bridge Pattern
│ │ └── com
│ │ └── company
│ │ ├── Album.class
│ │ ├── AlbumResource.class
│ │ ├── Book.class
│ │ ├── BookResource.class
│ │ ├── IResource.class
│ │ ├── InfoView.class
│ │ ├── Main.class
│ │ ├── ShortView.class
│ │ ├── ThumbnailView.class
│ │ └── View.class
└── src
│ └── com
│ └── company
│ ├── Album.java
│ ├── AlbumResource.java
│ ├── Book.java
│ ├── BookResource.java
│ ├── IResource.java
│ ├── InfoView.java
│ ├── Main.java
│ ├── ShortView.java
│ ├── ThumbnailView.java
│ └── View.java
├── Builder Pattern
├── .idea
│ ├── description.html
│ ├── encodings.xml
│ ├── misc.xml
│ ├── modules.xml
│ ├── project-template.xml
│ ├── vcs.xml
│ └── workspace.xml
├── Builder Pattern.iml
├── out
│ └── production
│ │ └── Builder Pattern
│ │ └── com
│ │ └── company
│ │ ├── Computer.class
│ │ ├── ComputerBuilder.class
│ │ └── Main.class
└── src
│ └── com
│ └── company
│ ├── Computer.java
│ ├── ComputerBuilder.java
│ └── Main.java
├── CommandPattern
├── .idea
│ ├── .gitignore
│ ├── description.html
│ ├── encodings.xml
│ ├── misc.xml
│ ├── modules.xml
│ ├── project-template.xml
│ └── vcs.xml
├── CommandPattern.iml
├── out
│ └── production
│ │ └── CommandPattern
│ │ └── com
│ │ └── company
│ │ ├── ICommand.class
│ │ ├── Invoker.class
│ │ ├── Light.class
│ │ ├── LightOffCommand.class
│ │ ├── LightOnCommand.class
│ │ └── Main.class
└── src
│ └── com
│ └── company
│ ├── ICommand.java
│ ├── Invoker.java
│ ├── Light.java
│ ├── LightOffCommand.java
│ ├── LightOnCommand.java
│ └── Main.java
├── Factory Pattern
├── .idea
│ ├── description.html
│ ├── encodings.xml
│ ├── misc.xml
│ ├── modules.xml
│ ├── project-template.xml
│ ├── vcs.xml
│ └── workspace.xml
├── Factory Pattern.iml
├── out
│ └── production
│ │ └── Factory Pattern
│ │ └── com
│ │ └── company
│ │ ├── Circle.class
│ │ ├── IShape.class
│ │ ├── Main.class
│ │ ├── ShapeFactory$1.class
│ │ ├── ShapeFactory.class
│ │ ├── ShapeType.class
│ │ └── Square.class
└── src
│ └── com
│ └── company
│ ├── Circle.java
│ ├── IShape.java
│ ├── Main.java
│ ├── ShapeFactory.java
│ ├── ShapeType.java
│ └── Square.java
├── Pattern Combines
└── Factory-Builder-Adapter
│ ├── .idea
│ ├── description.html
│ ├── encodings.xml
│ ├── misc.xml
│ ├── modules.xml
│ ├── project-template.xml
│ ├── vcs.xml
│ └── workspace.xml
│ ├── Factory-Builder-Adapter.iml
│ ├── out
│ └── production
│ │ └── Factory-Builder-Adapter
│ │ └── com
│ │ └── company
│ │ ├── Circle.class
│ │ ├── CircleBuilder.class
│ │ ├── DrawingTool.class
│ │ ├── IShape.class
│ │ ├── IShapeBuilder.class
│ │ ├── Main.class
│ │ ├── ShapeFactory$1.class
│ │ ├── ShapeFactory.class
│ │ ├── ShapeType.class
│ │ ├── Square.class
│ │ ├── SquareBuilder.class
│ │ ├── TraingleAdapter.class
│ │ └── Triangle.class
│ └── src
│ └── com
│ └── company
│ ├── Circle.java
│ ├── CircleBuilder.java
│ ├── DrawingTool.java
│ ├── IShape.java
│ ├── IShapeBuilder.java
│ ├── Main.java
│ ├── ShapeFactory.java
│ ├── ShapeType.java
│ ├── Square.java
│ ├── SquareBuilder.java
│ ├── TraingleAdapter.java
│ └── Triangle.java
├── ProxyPattern
├── .idea
│ ├── .gitignore
│ ├── description.html
│ ├── encodings.xml
│ ├── misc.xml
│ ├── modules.xml
│ ├── project-template.xml
│ └── vcs.xml
├── ProxyPattern.iml
├── out
│ └── production
│ │ └── ProxyPattern
│ │ ├── com
│ │ └── company
│ │ │ └── Main.class
│ │ └── proxy
│ │ ├── DBHandlerProxy.class
│ │ ├── IDBHandler.class
│ │ └── SQLDbHandler.class
└── src
│ ├── com
│ └── company
│ │ └── Main.java
│ └── proxy
│ ├── DBHandlerProxy.java
│ ├── IDBHandler.java
│ └── SQLDbHandler.java
├── README.md
├── Singleton Pattern
├── .idea
│ ├── description.html
│ ├── encodings.xml
│ ├── misc.xml
│ ├── modules.xml
│ ├── project-template.xml
│ ├── vcs.xml
│ └── workspace.xml
├── Singleton Pattern.iml
├── out
│ └── production
│ │ └── Singleton Pattern
│ │ └── com
│ │ └── company
│ │ ├── Main.class
│ │ └── Singleton.class
└── src
│ └── com
│ └── company
│ ├── Main.java
│ └── Singleton.java
├── VisitorPattern
├── .idea
│ ├── .gitignore
│ ├── description.html
│ ├── encodings.xml
│ ├── misc.xml
│ ├── modules.xml
│ ├── project-template.xml
│ └── vcs.xml
├── VisitorPattern.iml
├── out
│ └── production
│ │ └── VisitorPattern
│ │ ├── com
│ │ └── company
│ │ │ └── Main.class
│ │ ├── creditcard
│ │ ├── CreditCard.class
│ │ ├── MasterCard.class
│ │ └── VisaCard.class
│ │ └── visitor
│ │ ├── AliPayVisitor.class
│ │ ├── GasOfferVisitor.class
│ │ ├── HotelOfferVisitor.class
│ │ ├── OfferVisitor.class
│ │ ├── PayHereVisitor.class
│ │ ├── PaymentVisitor.class
│ │ └── Visitor.class
└── src
│ ├── com
│ └── company
│ │ └── Main.java
│ ├── creditcard
│ ├── CreditCard.java
│ ├── MasterCard.java
│ └── VisaCard.java
│ └── visitor
│ ├── AliPayVisitor.java
│ ├── GasOfferVisitor.java
│ ├── HotelOfferVisitor.java
│ ├── OfferVisitor.java
│ ├── PayHereVisitor.java
│ ├── PaymentVisitor.java
│ └── Visitor.java
└── visitorpattern
└── .idea
└── workspace.xml
/.idea/workspace.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 | 1597334167315
57 |
58 |
59 | 1597334167315
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 | 11
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
--------------------------------------------------------------------------------
/Adapter Pattern/.idea/description.html:
--------------------------------------------------------------------------------
1 | Simple Java application that includes a class with main()
method
--------------------------------------------------------------------------------
/Adapter Pattern/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Adapter Pattern/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Adapter Pattern/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Adapter Pattern/.idea/project-template.xml:
--------------------------------------------------------------------------------
1 |
2 | IJ_BASE_PACKAGE
3 |
--------------------------------------------------------------------------------
/Adapter Pattern/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Adapter Pattern/.idea/workspace.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 | 1597335202929
204 |
205 |
206 | 1597335202929
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
--------------------------------------------------------------------------------
/Adapter Pattern/Adapter Pattern.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Adapter Pattern/out/production/Adapter Pattern/com/company/Circle.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Adapter Pattern/out/production/Adapter Pattern/com/company/Circle.class
--------------------------------------------------------------------------------
/Adapter Pattern/out/production/Adapter Pattern/com/company/DrawingTool.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Adapter Pattern/out/production/Adapter Pattern/com/company/DrawingTool.class
--------------------------------------------------------------------------------
/Adapter Pattern/out/production/Adapter Pattern/com/company/IShape.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Adapter Pattern/out/production/Adapter Pattern/com/company/IShape.class
--------------------------------------------------------------------------------
/Adapter Pattern/out/production/Adapter Pattern/com/company/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Adapter Pattern/out/production/Adapter Pattern/com/company/Main.class
--------------------------------------------------------------------------------
/Adapter Pattern/out/production/Adapter Pattern/com/company/Square.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Adapter Pattern/out/production/Adapter Pattern/com/company/Square.class
--------------------------------------------------------------------------------
/Adapter Pattern/out/production/Adapter Pattern/com/company/Triangle.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Adapter Pattern/out/production/Adapter Pattern/com/company/Triangle.class
--------------------------------------------------------------------------------
/Adapter Pattern/out/production/Adapter Pattern/com/company/TriangleAdapter.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Adapter Pattern/out/production/Adapter Pattern/com/company/TriangleAdapter.class
--------------------------------------------------------------------------------
/Adapter Pattern/src/com/company/Circle.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class Circle implements IShape{
4 |
5 | @Override
6 | public void draw() {
7 | System.out.println("I am a Circle");
8 | }
9 | }
10 |
11 |
--------------------------------------------------------------------------------
/Adapter Pattern/src/com/company/DrawingTool.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class DrawingTool{
4 | public void DrawShape(IShape shape){
5 | shape.draw();
6 | }
7 | }
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Adapter Pattern/src/com/company/IShape.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public interface IShape{
4 | void draw();
5 | }
6 |
7 |
--------------------------------------------------------------------------------
/Adapter Pattern/src/com/company/Main.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class Main {
4 |
5 | public static void main(String[] args) {
6 | Circle circle = new Circle();
7 | Square square = new Square();
8 | Triangle triangle = new Triangle();
9 |
10 | DrawingTool drawingTool = new DrawingTool();
11 |
12 | drawingTool.DrawShape(circle);
13 | drawingTool.DrawShape(square);
14 |
15 | TriangleAdapter triangleAdapter = new TriangleAdapter(triangle);
16 |
17 | drawingTool.DrawShape(triangleAdapter);
18 | }
19 | }
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Adapter Pattern/src/com/company/Square.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class Square implements IShape{
4 |
5 | @Override
6 | public void draw() {
7 | System.out.println("I am a Square");
8 | }
9 | }
10 |
11 |
--------------------------------------------------------------------------------
/Adapter Pattern/src/com/company/Triangle.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class Triangle{
4 | public void drawMe(){
5 | System.out.println("I am a Triangle from Different parent");
6 | }
7 | }
8 |
9 |
--------------------------------------------------------------------------------
/Adapter Pattern/src/com/company/TriangleAdapter.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class TriangleAdapter implements IShape{
4 |
5 | private Triangle triangle;
6 |
7 | public TriangleAdapter(Triangle triangle) {
8 | this.triangle = triangle;
9 | }
10 |
11 | @Override
12 | public void draw() {
13 | this.triangle.drawMe();
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Bridge Pattern/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Bridge Pattern/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Bridge Pattern/.idea/description.html:
--------------------------------------------------------------------------------
1 | Simple Java application that includes a class with main()
method
--------------------------------------------------------------------------------
/Bridge Pattern/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Bridge Pattern/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Bridge Pattern/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Bridge Pattern/.idea/project-template.xml:
--------------------------------------------------------------------------------
1 |
2 | IJ_BASE_PACKAGE
3 |
--------------------------------------------------------------------------------
/Bridge Pattern/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Bridge Pattern/.idea/workspace.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 | 1598254611899
68 |
69 |
70 | 1598254611899
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/Bridge Pattern/Bridge Pattern.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Bridge Pattern/out/production/Bridge Pattern/com/company/Album.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Bridge Pattern/out/production/Bridge Pattern/com/company/Album.class
--------------------------------------------------------------------------------
/Bridge Pattern/out/production/Bridge Pattern/com/company/AlbumResource.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Bridge Pattern/out/production/Bridge Pattern/com/company/AlbumResource.class
--------------------------------------------------------------------------------
/Bridge Pattern/out/production/Bridge Pattern/com/company/Book.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Bridge Pattern/out/production/Bridge Pattern/com/company/Book.class
--------------------------------------------------------------------------------
/Bridge Pattern/out/production/Bridge Pattern/com/company/BookResource.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Bridge Pattern/out/production/Bridge Pattern/com/company/BookResource.class
--------------------------------------------------------------------------------
/Bridge Pattern/out/production/Bridge Pattern/com/company/IResource.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Bridge Pattern/out/production/Bridge Pattern/com/company/IResource.class
--------------------------------------------------------------------------------
/Bridge Pattern/out/production/Bridge Pattern/com/company/InfoView.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Bridge Pattern/out/production/Bridge Pattern/com/company/InfoView.class
--------------------------------------------------------------------------------
/Bridge Pattern/out/production/Bridge Pattern/com/company/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Bridge Pattern/out/production/Bridge Pattern/com/company/Main.class
--------------------------------------------------------------------------------
/Bridge Pattern/out/production/Bridge Pattern/com/company/ShortView.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Bridge Pattern/out/production/Bridge Pattern/com/company/ShortView.class
--------------------------------------------------------------------------------
/Bridge Pattern/out/production/Bridge Pattern/com/company/ThumbnailView.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Bridge Pattern/out/production/Bridge Pattern/com/company/ThumbnailView.class
--------------------------------------------------------------------------------
/Bridge Pattern/out/production/Bridge Pattern/com/company/View.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Bridge Pattern/out/production/Bridge Pattern/com/company/View.class
--------------------------------------------------------------------------------
/Bridge Pattern/src/com/company/Album.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class Album{
4 | public String photo;
5 | public String heading;
6 | public String uri;
7 |
8 | public Album(String photo, String heading, String uri) {
9 | this.photo = photo;
10 | this.heading = heading;
11 | this.uri = uri;
12 | }
13 |
14 | public String getPhoto() {
15 | return photo;
16 | }
17 |
18 | public String getHeading() {
19 | return heading;
20 | }
21 |
22 | public String getUri() {
23 | return uri;
24 | }
25 | }
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Bridge Pattern/src/com/company/AlbumResource.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class AlbumResource implements IResource{
4 |
5 | private Album album;
6 |
7 | public AlbumResource(Album album) {
8 | this.album = album;
9 | }
10 |
11 | @Override
12 | public String getTitle() {
13 | return this.album.getHeading();
14 | }
15 |
16 | @Override
17 | public String getImge() {
18 |
19 | return this.album.getPhoto();
20 | }
21 |
22 | @Override
23 | public String getUrl() {
24 | return this.album.getUri();
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Bridge Pattern/src/com/company/Book.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class Book{
4 | public String topic;
5 | public String picture;
6 | public String link;
7 |
8 | public Book(String topic, String picture, String link) {
9 | this.topic = topic;
10 | this.picture = picture;
11 | this.link = link;
12 | }
13 |
14 | public String getTopic() {
15 | return topic;
16 | }
17 |
18 | public String getPicture() {
19 | return picture;
20 | }
21 |
22 | public String getLink() {
23 | return link;
24 | }
25 | }
26 |
27 |
--------------------------------------------------------------------------------
/Bridge Pattern/src/com/company/BookResource.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class BookResource implements IResource{
4 |
5 | private Book book;
6 |
7 | public BookResource(Book book) {
8 | this.book = book;
9 | }
10 |
11 | @Override
12 | public String getTitle() {
13 | return this.book.getTopic();
14 | }
15 |
16 | @Override
17 | public String getImge() {
18 | return this.book.getPicture();
19 | }
20 |
21 | @Override
22 | public String getUrl() {
23 | return this.book.getLink();
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Bridge Pattern/src/com/company/IResource.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public interface IResource{
4 | String getTitle();
5 |
6 | String getImge();
7 |
8 | String getUrl();
9 | }
10 |
11 |
--------------------------------------------------------------------------------
/Bridge Pattern/src/com/company/InfoView.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class InfoView extends View{
4 |
5 | public InfoView(IResource resource) {
6 | super(resource);
7 | }
8 |
9 | @Override
10 | public void Show() {
11 | System.out.println("=== Info View ===");
12 | System.out.println(
13 | "title - " + this.resource.getTitle() + "\n" +
14 | "image - " + this.resource.getImge() + "\n" +
15 | "url - " + this.resource.getUrl()
16 | );
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Bridge Pattern/src/com/company/Main.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class Main {
4 |
5 | public static void main(String[] args) {
6 | Book book = new Book(
7 | "11 Minutes",
8 | "Pablo Image",
9 | "www.11minutes.com"
10 | );
11 |
12 | Album album = new Album(
13 | "Shakira Photo",
14 | "Waka Waka",
15 | "www.fifa2010.com"
16 | );
17 |
18 | BookResource bookResource = new BookResource(book);
19 | AlbumResource albumResource = new AlbumResource(album);
20 |
21 | View bookView = new InfoView(bookResource);
22 | bookView.Show();
23 |
24 | bookView = new ThumbnailView(bookResource);
25 | bookView.Show();
26 |
27 | bookView = new ShortView(bookResource);
28 | bookView.Show();
29 |
30 | View albumView = new InfoView(albumResource);
31 | albumView.Show();
32 |
33 | albumView = new ThumbnailView(albumResource);
34 | albumView.Show();
35 |
36 | albumView = new ShortView(albumResource);
37 | albumView.Show();
38 | }
39 | }
40 |
41 |
--------------------------------------------------------------------------------
/Bridge Pattern/src/com/company/ShortView.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class ShortView extends View{
4 |
5 | public ShortView(IResource resource) {
6 | super(resource);
7 | }
8 |
9 | @Override
10 | public void Show() {
11 | System.out.println("=== Short View ===");
12 | System.out.println(
13 | "title - " + this.resource.getTitle()
14 | );
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Bridge Pattern/src/com/company/ThumbnailView.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class ThumbnailView extends View{
4 |
5 | public ThumbnailView(IResource resource) {
6 | super(resource);
7 | }
8 |
9 | @Override
10 | public void Show() {
11 | System.out.println("=== Thumbnail View ===");
12 | System.out.println(
13 | "title - " + this.resource.getTitle() + "\n" +
14 | "image - " + this.resource.getImge()
15 | );
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Bridge Pattern/src/com/company/View.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public abstract class View{
4 | public IResource resource;
5 |
6 | public View(IResource resource) {
7 | this.resource = resource;
8 | }
9 |
10 | public abstract void Show();
11 | }
12 |
13 |
--------------------------------------------------------------------------------
/Builder Pattern/.idea/description.html:
--------------------------------------------------------------------------------
1 | Simple Java application that includes a class with main()
method
--------------------------------------------------------------------------------
/Builder Pattern/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Builder Pattern/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Builder Pattern/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Builder Pattern/.idea/project-template.xml:
--------------------------------------------------------------------------------
1 |
2 | IJ_BASE_PACKAGE
3 |
--------------------------------------------------------------------------------
/Builder Pattern/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Builder Pattern/.idea/workspace.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 | 1597334214666
144 |
145 |
146 | 1597334214666
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
--------------------------------------------------------------------------------
/Builder Pattern/Builder Pattern.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Builder Pattern/out/production/Builder Pattern/com/company/Computer.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Builder Pattern/out/production/Builder Pattern/com/company/Computer.class
--------------------------------------------------------------------------------
/Builder Pattern/out/production/Builder Pattern/com/company/ComputerBuilder.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Builder Pattern/out/production/Builder Pattern/com/company/ComputerBuilder.class
--------------------------------------------------------------------------------
/Builder Pattern/out/production/Builder Pattern/com/company/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Builder Pattern/out/production/Builder Pattern/com/company/Main.class
--------------------------------------------------------------------------------
/Builder Pattern/src/com/company/Computer.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class Computer{
4 | public String CPU;
5 | public String RAM;
6 | public String Hd;
7 |
8 | public Computer(String CPU, String RAM, String hd) {
9 | this.CPU = CPU;
10 | this.RAM = RAM;
11 | Hd = hd;
12 | }
13 |
14 | @Override
15 | public String toString() {
16 | return "Computer{" +
17 | "CPU='" + CPU + '\'' +
18 | ", RAM='" + RAM + '\'' +
19 | ", Hd='" + Hd + '\'' +
20 | '}';
21 | }
22 | }
23 |
24 |
--------------------------------------------------------------------------------
/Builder Pattern/src/com/company/ComputerBuilder.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class ComputerBuilder{
4 | public String CPU;
5 | public String RAM;
6 | public String Hd;
7 |
8 | public ComputerBuilder setCPU(String CPU) {
9 | this.CPU = CPU;
10 | return this;
11 | }
12 |
13 | public ComputerBuilder setRAM(String RAM) {
14 | this.RAM = RAM;
15 | return this;
16 | }
17 |
18 | public ComputerBuilder setHd(String hd) {
19 | Hd = hd;
20 | return this;
21 | }
22 |
23 | public Computer Build(){
24 | return new Computer(this.CPU, this.RAM, this.Hd);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Builder Pattern/src/com/company/Main.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class Main {
4 |
5 | public static void main(String[] args) {
6 | ComputerBuilder computerBuilder = new ComputerBuilder();
7 | Computer myLaptop = computerBuilder.setCPU("i7").setHd("2TB").setRAM("4GB").Build();
8 |
9 | System.out.println(myLaptop.toString());
10 | }
11 | }
12 |
13 |
--------------------------------------------------------------------------------
/CommandPattern/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/CommandPattern/.idea/description.html:
--------------------------------------------------------------------------------
1 | Simple Java application that includes a class with main()
method
--------------------------------------------------------------------------------
/CommandPattern/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/CommandPattern/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/CommandPattern/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/CommandPattern/.idea/project-template.xml:
--------------------------------------------------------------------------------
1 |
2 | IJ_BASE_PACKAGE
3 |
--------------------------------------------------------------------------------
/CommandPattern/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/CommandPattern/CommandPattern.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/CommandPattern/out/production/CommandPattern/com/company/ICommand.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/CommandPattern/out/production/CommandPattern/com/company/ICommand.class
--------------------------------------------------------------------------------
/CommandPattern/out/production/CommandPattern/com/company/Invoker.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/CommandPattern/out/production/CommandPattern/com/company/Invoker.class
--------------------------------------------------------------------------------
/CommandPattern/out/production/CommandPattern/com/company/Light.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/CommandPattern/out/production/CommandPattern/com/company/Light.class
--------------------------------------------------------------------------------
/CommandPattern/out/production/CommandPattern/com/company/LightOffCommand.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/CommandPattern/out/production/CommandPattern/com/company/LightOffCommand.class
--------------------------------------------------------------------------------
/CommandPattern/out/production/CommandPattern/com/company/LightOnCommand.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/CommandPattern/out/production/CommandPattern/com/company/LightOnCommand.class
--------------------------------------------------------------------------------
/CommandPattern/out/production/CommandPattern/com/company/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/CommandPattern/out/production/CommandPattern/com/company/Main.class
--------------------------------------------------------------------------------
/CommandPattern/src/com/company/ICommand.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public interface ICommand{
4 | void execute();
5 | void undo();
6 | }
7 |
8 |
--------------------------------------------------------------------------------
/CommandPattern/src/com/company/Invoker.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class Invoker {
4 | public ICommand onButton;
5 | public ICommand offButton;
6 |
7 | public Invoker(ICommand onButton, ICommand offButton) {
8 | this.onButton = onButton;
9 | this.offButton = offButton;
10 | }
11 |
12 | public void PressOn(){
13 | this.onButton.execute();
14 | }
15 |
16 | public void PressUndoOn(){
17 | this.onButton.undo();
18 | }
19 |
20 | public void PressOff(){
21 | this.offButton.execute();
22 | }
23 |
24 | public void PressUndoOff(){
25 | this.offButton.undo();
26 | }
27 | }
28 |
29 |
--------------------------------------------------------------------------------
/CommandPattern/src/com/company/Light.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class Light {
4 | public void lightOn(){
5 | System.out.println("Light On");
6 | }
7 |
8 | public void lightOff(){
9 | System.out.println("Light Off");
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/CommandPattern/src/com/company/LightOffCommand.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class LightOffCommand implements ICommand {
4 |
5 | Light light;
6 |
7 | public LightOffCommand(Light light) {
8 | this.light = light;
9 | }
10 |
11 | @Override
12 | public void execute() {
13 | this.light.lightOff();
14 | }
15 |
16 | @Override
17 | public void undo() {
18 | this.light.lightOn();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/CommandPattern/src/com/company/LightOnCommand.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class LightOnCommand implements ICommand {
4 |
5 | Light light;
6 |
7 | public LightOnCommand(Light light) {
8 | this.light = light;
9 | }
10 |
11 | @Override
12 | public void execute() {
13 | this.light.lightOn();
14 | }
15 |
16 | @Override
17 | public void undo() {
18 | this.light.lightOff();
19 | }
20 | }
21 |
22 |
--------------------------------------------------------------------------------
/CommandPattern/src/com/company/Main.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class Main {
4 |
5 | public static void main(String[] args) {
6 | Light light = new Light();
7 |
8 | LightOnCommand lightOnCommand = new LightOnCommand(light);
9 | LightOffCommand lightOffCommand = new LightOffCommand(light);
10 |
11 | Invoker invoker = new Invoker(
12 | lightOnCommand,
13 | lightOffCommand
14 | );
15 |
16 | invoker.PressOn();
17 | invoker.PressUndoOn();
18 | invoker.PressOff();
19 | invoker.PressUndoOff();
20 | }
21 | }
22 |
23 |
--------------------------------------------------------------------------------
/Factory Pattern/.idea/description.html:
--------------------------------------------------------------------------------
1 | Simple Java application that includes a class with main()
method
--------------------------------------------------------------------------------
/Factory Pattern/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Factory Pattern/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Factory Pattern/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Factory Pattern/.idea/project-template.xml:
--------------------------------------------------------------------------------
1 |
2 | IJ_BASE_PACKAGE
3 |
--------------------------------------------------------------------------------
/Factory Pattern/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Factory Pattern/.idea/workspace.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 | 1597334638522
180 |
181 |
182 | 1597334638522
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
--------------------------------------------------------------------------------
/Factory Pattern/Factory Pattern.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Factory Pattern/out/production/Factory Pattern/com/company/Circle.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Factory Pattern/out/production/Factory Pattern/com/company/Circle.class
--------------------------------------------------------------------------------
/Factory Pattern/out/production/Factory Pattern/com/company/IShape.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Factory Pattern/out/production/Factory Pattern/com/company/IShape.class
--------------------------------------------------------------------------------
/Factory Pattern/out/production/Factory Pattern/com/company/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Factory Pattern/out/production/Factory Pattern/com/company/Main.class
--------------------------------------------------------------------------------
/Factory Pattern/out/production/Factory Pattern/com/company/ShapeFactory$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Factory Pattern/out/production/Factory Pattern/com/company/ShapeFactory$1.class
--------------------------------------------------------------------------------
/Factory Pattern/out/production/Factory Pattern/com/company/ShapeFactory.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Factory Pattern/out/production/Factory Pattern/com/company/ShapeFactory.class
--------------------------------------------------------------------------------
/Factory Pattern/out/production/Factory Pattern/com/company/ShapeType.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Factory Pattern/out/production/Factory Pattern/com/company/ShapeType.class
--------------------------------------------------------------------------------
/Factory Pattern/out/production/Factory Pattern/com/company/Square.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Factory Pattern/out/production/Factory Pattern/com/company/Square.class
--------------------------------------------------------------------------------
/Factory Pattern/src/com/company/Circle.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class Circle implements IShape{
4 |
5 | @Override
6 | public void draw() {
7 | System.out.println("I am a circle");
8 | }
9 | }
10 |
11 |
--------------------------------------------------------------------------------
/Factory Pattern/src/com/company/IShape.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public interface IShape{
4 | void draw();
5 | }
6 |
7 |
--------------------------------------------------------------------------------
/Factory Pattern/src/com/company/Main.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class Main {
4 |
5 | public static void main(String[] args) {
6 | ShapeFactory shapeFactory = new ShapeFactory();
7 |
8 | IShape circle = shapeFactory.GetShapeInstance(ShapeType.CIRCLE);
9 | circle.draw();
10 |
11 | IShape square = shapeFactory.GetShapeInstance(ShapeType.SQUARE);
12 | square.draw();
13 | }
14 | }
15 |
16 |
--------------------------------------------------------------------------------
/Factory Pattern/src/com/company/ShapeFactory.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class ShapeFactory {
4 | public IShape GetShapeInstance(ShapeType type){
5 | switch (type){
6 | case CIRCLE:
7 | return new Circle();
8 | case SQUARE:
9 | return new Square();
10 | default:
11 | return null;
12 | }
13 | }
14 | }
15 |
16 |
--------------------------------------------------------------------------------
/Factory Pattern/src/com/company/ShapeType.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public enum ShapeType{
4 | CIRCLE,
5 | SQUARE
6 | }
7 |
--------------------------------------------------------------------------------
/Factory Pattern/src/com/company/Square.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class Square implements IShape{
4 |
5 | @Override
6 | public void draw() {
7 | System.out.println("I am a square");
8 | }
9 | }
10 |
11 |
--------------------------------------------------------------------------------
/Pattern Combines/Factory-Builder-Adapter/.idea/description.html:
--------------------------------------------------------------------------------
1 | Simple Java application that includes a class with main()
method
--------------------------------------------------------------------------------
/Pattern Combines/Factory-Builder-Adapter/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Pattern Combines/Factory-Builder-Adapter/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Pattern Combines/Factory-Builder-Adapter/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Pattern Combines/Factory-Builder-Adapter/.idea/project-template.xml:
--------------------------------------------------------------------------------
1 |
2 | IJ_BASE_PACKAGE
3 |
--------------------------------------------------------------------------------
/Pattern Combines/Factory-Builder-Adapter/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Pattern Combines/Factory-Builder-Adapter/.idea/workspace.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 | 1597335820089
232 |
233 |
234 | 1597335820089
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
--------------------------------------------------------------------------------
/Pattern Combines/Factory-Builder-Adapter/Factory-Builder-Adapter.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Pattern Combines/Factory-Builder-Adapter/out/production/Factory-Builder-Adapter/com/company/Circle.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Pattern Combines/Factory-Builder-Adapter/out/production/Factory-Builder-Adapter/com/company/Circle.class
--------------------------------------------------------------------------------
/Pattern Combines/Factory-Builder-Adapter/out/production/Factory-Builder-Adapter/com/company/CircleBuilder.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Pattern Combines/Factory-Builder-Adapter/out/production/Factory-Builder-Adapter/com/company/CircleBuilder.class
--------------------------------------------------------------------------------
/Pattern Combines/Factory-Builder-Adapter/out/production/Factory-Builder-Adapter/com/company/DrawingTool.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Pattern Combines/Factory-Builder-Adapter/out/production/Factory-Builder-Adapter/com/company/DrawingTool.class
--------------------------------------------------------------------------------
/Pattern Combines/Factory-Builder-Adapter/out/production/Factory-Builder-Adapter/com/company/IShape.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Pattern Combines/Factory-Builder-Adapter/out/production/Factory-Builder-Adapter/com/company/IShape.class
--------------------------------------------------------------------------------
/Pattern Combines/Factory-Builder-Adapter/out/production/Factory-Builder-Adapter/com/company/IShapeBuilder.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Pattern Combines/Factory-Builder-Adapter/out/production/Factory-Builder-Adapter/com/company/IShapeBuilder.class
--------------------------------------------------------------------------------
/Pattern Combines/Factory-Builder-Adapter/out/production/Factory-Builder-Adapter/com/company/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Pattern Combines/Factory-Builder-Adapter/out/production/Factory-Builder-Adapter/com/company/Main.class
--------------------------------------------------------------------------------
/Pattern Combines/Factory-Builder-Adapter/out/production/Factory-Builder-Adapter/com/company/ShapeFactory$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Pattern Combines/Factory-Builder-Adapter/out/production/Factory-Builder-Adapter/com/company/ShapeFactory$1.class
--------------------------------------------------------------------------------
/Pattern Combines/Factory-Builder-Adapter/out/production/Factory-Builder-Adapter/com/company/ShapeFactory.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Pattern Combines/Factory-Builder-Adapter/out/production/Factory-Builder-Adapter/com/company/ShapeFactory.class
--------------------------------------------------------------------------------
/Pattern Combines/Factory-Builder-Adapter/out/production/Factory-Builder-Adapter/com/company/ShapeType.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Pattern Combines/Factory-Builder-Adapter/out/production/Factory-Builder-Adapter/com/company/ShapeType.class
--------------------------------------------------------------------------------
/Pattern Combines/Factory-Builder-Adapter/out/production/Factory-Builder-Adapter/com/company/Square.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Pattern Combines/Factory-Builder-Adapter/out/production/Factory-Builder-Adapter/com/company/Square.class
--------------------------------------------------------------------------------
/Pattern Combines/Factory-Builder-Adapter/out/production/Factory-Builder-Adapter/com/company/SquareBuilder.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Pattern Combines/Factory-Builder-Adapter/out/production/Factory-Builder-Adapter/com/company/SquareBuilder.class
--------------------------------------------------------------------------------
/Pattern Combines/Factory-Builder-Adapter/out/production/Factory-Builder-Adapter/com/company/TraingleAdapter.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Pattern Combines/Factory-Builder-Adapter/out/production/Factory-Builder-Adapter/com/company/TraingleAdapter.class
--------------------------------------------------------------------------------
/Pattern Combines/Factory-Builder-Adapter/out/production/Factory-Builder-Adapter/com/company/Triangle.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Pattern Combines/Factory-Builder-Adapter/out/production/Factory-Builder-Adapter/com/company/Triangle.class
--------------------------------------------------------------------------------
/Pattern Combines/Factory-Builder-Adapter/src/com/company/Circle.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class Circle implements IShape{
4 |
5 | String Color;
6 |
7 | public Circle(String color) {
8 | this.Color = color;
9 | }
10 |
11 | @Override
12 | public void draw() {
13 | System.out.println("I am a Circle");
14 | }
15 | }
16 |
17 |
--------------------------------------------------------------------------------
/Pattern Combines/Factory-Builder-Adapter/src/com/company/CircleBuilder.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class CircleBuilder implements IShapeBuilder{
4 |
5 | String Color;
6 |
7 | @Override
8 | public IShapeBuilder setColor(String color) {
9 | this.Color = color;
10 | return this;
11 | }
12 |
13 | @Override
14 | public IShape Build() {
15 | return new Circle(this.Color);
16 | }
17 | }
18 |
19 |
--------------------------------------------------------------------------------
/Pattern Combines/Factory-Builder-Adapter/src/com/company/DrawingTool.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class DrawingTool{
4 | public void DrawShape(IShape shape){
5 | shape.draw();
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/Pattern Combines/Factory-Builder-Adapter/src/com/company/IShape.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public interface IShape{
4 | String Color = null;
5 | void draw();
6 | }
7 |
8 |
--------------------------------------------------------------------------------
/Pattern Combines/Factory-Builder-Adapter/src/com/company/IShapeBuilder.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public interface IShapeBuilder{
4 | IShapeBuilder setColor(String color);
5 |
6 | IShape Build();
7 | }
8 |
--------------------------------------------------------------------------------
/Pattern Combines/Factory-Builder-Adapter/src/com/company/Main.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class Main {
4 |
5 | public static void main(String[] args) {
6 | ShapeFactory factory = new ShapeFactory();
7 |
8 | IShape circle = factory.GetShapeInstance(ShapeType.CIRCLE, "Red");
9 | IShape square = factory.GetShapeInstance(ShapeType.SQUARE, "Blue");
10 |
11 | Triangle triangle = new Triangle();
12 |
13 | DrawingTool drawingTool = new DrawingTool();
14 | drawingTool.DrawShape(circle);
15 | drawingTool.DrawShape(square);
16 |
17 | TraingleAdapter traingleAdapter = new TraingleAdapter(triangle);
18 |
19 | traingleAdapter.draw();
20 | }
21 | }
22 |
23 |
--------------------------------------------------------------------------------
/Pattern Combines/Factory-Builder-Adapter/src/com/company/ShapeFactory.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class ShapeFactory{
4 | public IShape GetShapeInstance(ShapeType shapeType, String Color){
5 | switch (shapeType){
6 | case SQUARE:
7 | return GetSquare(Color);
8 | case CIRCLE:
9 | return GetCircle(Color);
10 | default:
11 | return null;
12 | }
13 | }
14 |
15 | private IShape GetSquare(String Color){
16 | SquareBuilder squareBuilder = new SquareBuilder();
17 | IShape square = squareBuilder.setColor(Color).Build();
18 | return square;
19 | }
20 |
21 | private IShape GetCircle(String Color){
22 | IShapeBuilder circleBuilder = new CircleBuilder();
23 | IShape circle = circleBuilder.setColor(Color).Build();
24 | return circle;
25 | }
26 | }
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/Pattern Combines/Factory-Builder-Adapter/src/com/company/ShapeType.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public enum ShapeType{
4 | CIRCLE,
5 | SQUARE
6 | }
7 |
--------------------------------------------------------------------------------
/Pattern Combines/Factory-Builder-Adapter/src/com/company/Square.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class Square implements IShape{
4 |
5 | public String Color;
6 |
7 | public Square(String color) {
8 | Color = color;
9 | }
10 |
11 | @Override
12 | public void draw() {
13 | System.out.println("I am a Square");
14 | }
15 | }
16 |
17 |
--------------------------------------------------------------------------------
/Pattern Combines/Factory-Builder-Adapter/src/com/company/SquareBuilder.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class SquareBuilder implements IShapeBuilder{
4 |
5 | String Color;
6 |
7 | @Override
8 | public IShapeBuilder setColor(String color) {
9 | this.Color = color;
10 | return this;
11 | }
12 |
13 | @Override
14 | public IShape Build() {
15 | return new Square(this.Color);
16 | }
17 | }
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Pattern Combines/Factory-Builder-Adapter/src/com/company/TraingleAdapter.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class TraingleAdapter implements IShape{
4 |
5 | private Triangle triangle;
6 |
7 | public TraingleAdapter(Triangle triangle) {
8 | this.triangle = triangle;
9 | }
10 |
11 | @Override
12 | public void draw() {
13 | this.triangle.drawMe();
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Pattern Combines/Factory-Builder-Adapter/src/com/company/Triangle.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class Triangle{
4 | public void drawMe(){
5 | System.out.println("I am a Triangle");
6 | }
7 | }
8 |
9 |
--------------------------------------------------------------------------------
/ProxyPattern/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/ProxyPattern/.idea/description.html:
--------------------------------------------------------------------------------
1 | Simple Java application that includes a class with main()
method
--------------------------------------------------------------------------------
/ProxyPattern/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ProxyPattern/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ProxyPattern/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ProxyPattern/.idea/project-template.xml:
--------------------------------------------------------------------------------
1 |
2 | IJ_BASE_PACKAGE
3 |
--------------------------------------------------------------------------------
/ProxyPattern/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ProxyPattern/ProxyPattern.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/ProxyPattern/out/production/ProxyPattern/com/company/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/ProxyPattern/out/production/ProxyPattern/com/company/Main.class
--------------------------------------------------------------------------------
/ProxyPattern/out/production/ProxyPattern/proxy/DBHandlerProxy.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/ProxyPattern/out/production/ProxyPattern/proxy/DBHandlerProxy.class
--------------------------------------------------------------------------------
/ProxyPattern/out/production/ProxyPattern/proxy/IDBHandler.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/ProxyPattern/out/production/ProxyPattern/proxy/IDBHandler.class
--------------------------------------------------------------------------------
/ProxyPattern/out/production/ProxyPattern/proxy/SQLDbHandler.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/ProxyPattern/out/production/ProxyPattern/proxy/SQLDbHandler.class
--------------------------------------------------------------------------------
/ProxyPattern/src/com/company/Main.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | import proxy.DBHandlerProxy;
4 |
5 | public class Main {
6 |
7 | public static void main(String[] args) {
8 | DBHandlerProxy proxy = new DBHandlerProxy("admin");
9 | proxy.delete();
10 | proxy.add();
11 | }
12 | }
--------------------------------------------------------------------------------
/ProxyPattern/src/proxy/DBHandlerProxy.java:
--------------------------------------------------------------------------------
1 | package proxy;
2 |
3 | public class DBHandlerProxy implements IDBHandler {
4 |
5 | private SQLDbHandler sqlDbHandler;
6 | private String role;
7 |
8 | public DBHandlerProxy(String role) {
9 | this.role = role;
10 | }
11 |
12 | @Override
13 | public boolean add() {
14 | System.out.println("Item added successfully");
15 | return true;
16 | }
17 |
18 | @Override
19 | public Object get() {
20 | System.out.println("Item return successfully");
21 | return new String("Result");
22 | }
23 |
24 | @Override
25 | public boolean edit() {
26 | if(this.role.equals("admin")){
27 | System.out.println("Edited successfully");
28 | return true;
29 | }else{
30 | System.out.println("Can't edit due to auth");
31 | return false;
32 | }
33 | }
34 |
35 | @Override
36 | public boolean delete() {
37 | if(this.role.equals("admin")){
38 | System.out.println("Item deleted successfully");
39 | return true;
40 | }else{
41 | System.out.println("Can't delete item due to auth");
42 | return false;
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/ProxyPattern/src/proxy/IDBHandler.java:
--------------------------------------------------------------------------------
1 | package proxy;
2 |
3 | public interface IDBHandler {
4 | boolean add();
5 |
6 | Object get();
7 |
8 | boolean edit();
9 |
10 | boolean delete();
11 | }
12 |
13 |
14 |
--------------------------------------------------------------------------------
/ProxyPattern/src/proxy/SQLDbHandler.java:
--------------------------------------------------------------------------------
1 | package proxy;
2 |
3 | public class SQLDbHandler implements IDBHandler {
4 |
5 | @Override
6 | public boolean add() {
7 | return false;
8 | }
9 |
10 | @Override
11 | public Object get() {
12 | return null;
13 | }
14 |
15 | @Override
16 | public boolean edit() {
17 | return false;
18 | }
19 |
20 | @Override
21 | public boolean delete() {
22 | return false;
23 | }
24 | }
25 |
26 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # designpatterns
2 | This repository include the Java implementation of the Design Patterns
3 |
--------------------------------------------------------------------------------
/Singleton Pattern/.idea/description.html:
--------------------------------------------------------------------------------
1 | Simple Java application that includes a class with main()
method
--------------------------------------------------------------------------------
/Singleton Pattern/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Singleton Pattern/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Singleton Pattern/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Singleton Pattern/.idea/project-template.xml:
--------------------------------------------------------------------------------
1 |
2 | IJ_BASE_PACKAGE
3 |
--------------------------------------------------------------------------------
/Singleton Pattern/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Singleton Pattern/.idea/workspace.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 | 1598113092208
108 |
109 |
110 | 1598113092208
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
--------------------------------------------------------------------------------
/Singleton Pattern/Singleton Pattern.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Singleton Pattern/out/production/Singleton Pattern/com/company/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Singleton Pattern/out/production/Singleton Pattern/com/company/Main.class
--------------------------------------------------------------------------------
/Singleton Pattern/out/production/Singleton Pattern/com/company/Singleton.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/Singleton Pattern/out/production/Singleton Pattern/com/company/Singleton.class
--------------------------------------------------------------------------------
/Singleton Pattern/src/com/company/Main.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class Main {
4 |
5 | public static void main(String[] args) {
6 | Singleton singleton = Singleton.getInstance();
7 | singleton.Method();
8 | }
9 | }
10 |
11 |
--------------------------------------------------------------------------------
/Singleton Pattern/src/com/company/Singleton.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | public class Singleton{
4 |
5 | private static Singleton instance;
6 |
7 | private Singleton() {
8 | }
9 |
10 | public static Singleton getInstance(){
11 | if(instance == null){
12 | instance = new Singleton();
13 | }
14 |
15 | return instance;
16 | }
17 |
18 | public void Method(){
19 | System.out.println("I am singleton instance");
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/VisitorPattern/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/VisitorPattern/.idea/description.html:
--------------------------------------------------------------------------------
1 | Simple Java application that includes a class with main()
method
--------------------------------------------------------------------------------
/VisitorPattern/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/VisitorPattern/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/VisitorPattern/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/VisitorPattern/.idea/project-template.xml:
--------------------------------------------------------------------------------
1 |
2 | IJ_BASE_PACKAGE
3 |
--------------------------------------------------------------------------------
/VisitorPattern/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/VisitorPattern/VisitorPattern.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/VisitorPattern/out/production/VisitorPattern/com/company/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/VisitorPattern/out/production/VisitorPattern/com/company/Main.class
--------------------------------------------------------------------------------
/VisitorPattern/out/production/VisitorPattern/creditcard/CreditCard.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/VisitorPattern/out/production/VisitorPattern/creditcard/CreditCard.class
--------------------------------------------------------------------------------
/VisitorPattern/out/production/VisitorPattern/creditcard/MasterCard.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/VisitorPattern/out/production/VisitorPattern/creditcard/MasterCard.class
--------------------------------------------------------------------------------
/VisitorPattern/out/production/VisitorPattern/creditcard/VisaCard.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/VisitorPattern/out/production/VisitorPattern/creditcard/VisaCard.class
--------------------------------------------------------------------------------
/VisitorPattern/out/production/VisitorPattern/visitor/AliPayVisitor.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/VisitorPattern/out/production/VisitorPattern/visitor/AliPayVisitor.class
--------------------------------------------------------------------------------
/VisitorPattern/out/production/VisitorPattern/visitor/GasOfferVisitor.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/VisitorPattern/out/production/VisitorPattern/visitor/GasOfferVisitor.class
--------------------------------------------------------------------------------
/VisitorPattern/out/production/VisitorPattern/visitor/HotelOfferVisitor.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/VisitorPattern/out/production/VisitorPattern/visitor/HotelOfferVisitor.class
--------------------------------------------------------------------------------
/VisitorPattern/out/production/VisitorPattern/visitor/OfferVisitor.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/VisitorPattern/out/production/VisitorPattern/visitor/OfferVisitor.class
--------------------------------------------------------------------------------
/VisitorPattern/out/production/VisitorPattern/visitor/PayHereVisitor.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/VisitorPattern/out/production/VisitorPattern/visitor/PayHereVisitor.class
--------------------------------------------------------------------------------
/VisitorPattern/out/production/VisitorPattern/visitor/PaymentVisitor.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/VisitorPattern/out/production/VisitorPattern/visitor/PaymentVisitor.class
--------------------------------------------------------------------------------
/VisitorPattern/out/production/VisitorPattern/visitor/Visitor.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/buddhikac96/designpatterns/e97ecdc24dccad7fc23889cd64fc47877f274e08/VisitorPattern/out/production/VisitorPattern/visitor/Visitor.class
--------------------------------------------------------------------------------
/VisitorPattern/src/com/company/Main.java:
--------------------------------------------------------------------------------
1 | package com.company;
2 |
3 | import creditcard.MasterCard;
4 | import creditcard.VisaCard;
5 | import visitor.GasOfferVisitor;
6 | import visitor.HotelOfferVisitor;
7 |
8 | public class Main {
9 |
10 | public static void main(String[] args) {
11 | MasterCard masterCard = new MasterCard("buddhika", 10000);
12 | VisaCard visaCard = new VisaCard("chathuranga", 50000);
13 |
14 | HotelOfferVisitor hotelOfferVisitor = new HotelOfferVisitor();
15 |
16 | GasOfferVisitor gasOfferVisitor = new GasOfferVisitor();
17 |
18 | masterCard.accept(hotelOfferVisitor);
19 | visaCard.accept(gasOfferVisitor);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/VisitorPattern/src/creditcard/CreditCard.java:
--------------------------------------------------------------------------------
1 | package creditcard;
2 |
3 | import visitor.Visitor;
4 |
5 | public interface CreditCard {
6 | String getName();
7 | int getBalance();
8 | void accept(Visitor visitor);
9 | }
10 |
11 |
--------------------------------------------------------------------------------
/VisitorPattern/src/creditcard/MasterCard.java:
--------------------------------------------------------------------------------
1 | package creditcard;
2 |
3 | import visitor.Visitor;
4 |
5 | public class MasterCard implements CreditCard {
6 |
7 | public String name;
8 | public int balance;
9 |
10 | public MasterCard(String name, int balance) {
11 | this.name = name;
12 | this.balance = balance;
13 | }
14 |
15 | @Override
16 | public String getName() {
17 | return this.name;
18 | }
19 |
20 | @Override
21 | public int getBalance() {
22 | return this.balance;
23 | }
24 |
25 | @Override
26 | public void accept(Visitor visitor) {
27 | visitor.visitMasterCard(this);
28 | }
29 | }
30 |
31 |
--------------------------------------------------------------------------------
/VisitorPattern/src/creditcard/VisaCard.java:
--------------------------------------------------------------------------------
1 | package creditcard;
2 |
3 | import visitor.Visitor;
4 |
5 | public class VisaCard implements CreditCard {
6 |
7 | public String name;
8 | public int balance;
9 |
10 | public VisaCard(String name, int balance) {
11 | this.name = name;
12 | this.balance = balance;
13 | }
14 |
15 | @Override
16 | public String getName() {
17 | return this.name;
18 | }
19 |
20 | @Override
21 | public int getBalance() {
22 | return this.balance;
23 | }
24 |
25 | @Override
26 | public void accept(Visitor visitor) {
27 | visitor.visitVisaCard(this);
28 | }
29 |
30 | }
--------------------------------------------------------------------------------
/VisitorPattern/src/visitor/AliPayVisitor.java:
--------------------------------------------------------------------------------
1 | package visitor;
2 |
3 | import creditcard.MasterCard;
4 | import creditcard.VisaCard;
5 |
6 | public class AliPayVisitor extends PaymentVisitor{
7 |
8 | @Override
9 | public void visitMasterCard(MasterCard card) {
10 | System.out.println("AliPay use Master card of " + card.getName());
11 | }
12 |
13 | @Override
14 | public void visitVisaCard(VisaCard card) {
15 | System.out.println("AliPay use Visa card of " + card.getName());
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/VisitorPattern/src/visitor/GasOfferVisitor.java:
--------------------------------------------------------------------------------
1 | package visitor;
2 |
3 | import creditcard.MasterCard;
4 | import creditcard.VisaCard;
5 |
6 | public class GasOfferVisitor extends OfferVisitor {
7 |
8 | @Override
9 | public void visitMasterCard(MasterCard card) {
10 | System.out.println("Gas offer from Master card to " + card.getName());
11 | }
12 |
13 | @Override
14 | public void visitVisaCard(VisaCard card) {
15 | System.out.println("Gas offer from Visa card to " + card.getName());
16 | }
17 | }
18 |
19 |
20 |
--------------------------------------------------------------------------------
/VisitorPattern/src/visitor/HotelOfferVisitor.java:
--------------------------------------------------------------------------------
1 | package visitor;
2 |
3 | import creditcard.MasterCard;
4 | import creditcard.VisaCard;
5 |
6 | public class HotelOfferVisitor extends OfferVisitor {
7 |
8 | @Override
9 | public void visitMasterCard(MasterCard card) {
10 | System.out.println("Hotel offer from Master card to " + card.getName());
11 | }
12 |
13 | @Override
14 | public void visitVisaCard(VisaCard card) {
15 | System.out.println("Hotel offer from Visa card to " + card.getName());
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/VisitorPattern/src/visitor/OfferVisitor.java:
--------------------------------------------------------------------------------
1 | package visitor;
2 |
3 | public abstract class OfferVisitor implements Visitor{
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/VisitorPattern/src/visitor/PayHereVisitor.java:
--------------------------------------------------------------------------------
1 | package visitor;
2 |
3 | import creditcard.MasterCard;
4 | import creditcard.VisaCard;
5 |
6 | public class PayHereVisitor extends PaymentVisitor {
7 |
8 | @Override
9 | public void visitMasterCard(MasterCard card) {
10 | System.out.println("PayHere use Master card of " + card.getName());
11 | }
12 |
13 | @Override
14 | public void visitVisaCard(VisaCard card) {
15 | System.out.println("PayHere use Visa card of " + card.getName());
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/VisitorPattern/src/visitor/PaymentVisitor.java:
--------------------------------------------------------------------------------
1 | package visitor;
2 |
3 | public abstract class PaymentVisitor implements Visitor{
4 | }
5 |
--------------------------------------------------------------------------------
/VisitorPattern/src/visitor/Visitor.java:
--------------------------------------------------------------------------------
1 | package visitor;
2 |
3 | import creditcard.MasterCard;
4 | import creditcard.VisaCard;
5 |
6 | public interface Visitor {
7 | void visitMasterCard(MasterCard card);
8 | void visitVisaCard(VisaCard card);
9 | }
10 |
--------------------------------------------------------------------------------
/visitorpattern/.idea/workspace.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | 1604488750326
35 |
36 |
37 | 1604488750326
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------