{"id":10482,"date":"2020-10-15T21:39:48","date_gmt":"2020-10-15T12:39:48","guid":{"rendered":"http:\/\/www.gisdeveloper.co.kr\/?p=10482"},"modified":"2020-10-25T09:20:13","modified_gmt":"2020-10-25T00:20:13","slug":"prototype-%ed%8c%a8%ed%84%b4","status":"publish","type":"post","link":"http:\/\/www.gisdeveloper.co.kr\/?p=10482","title":{"rendered":"[GoF] Prototype \ud328\ud134"},"content":{"rendered":"<h4>\ud328\ud134\uba85\uce6d<\/h4>\n<p>Prototype<\/p>\n<h4>\ud544\uc694\ud55c \uc0c1\ud669<\/h4>\n<p>\uc5b4\ub5a4 \uac1d\uccb4\uac00 \uc0dd\uc131\ub418\uace0, \uadf8 \uac1d\uccb4\uc758 \uc0c1\ud0dc\uac12\uc774 \ubcc0\uacbd\ub41c \ud6c4 \uadf8 \uac1d\uccb4\uc640 \ub3d9\uc77c\ud55c \uc0c1\ud0dc\uc758 \ub610 \ub2e4\ub978 \ubcf5\uc0ac\ubcf8\uc744 \uc0dd\uc131\ud558\uace0\uc790 \ud560\ub54c \uc0ac\uc6a9\ud560 \uc218 \uc788\ub294 \ud328\ud134\uc774\ub2e4. \ubcf5\uc0ac\ubcf8\uc758 \uc0c1\ud0dc\uc758 \ubcc0\uacbd\uc73c\ub85c\uc778\ud574 \uc6d0\ubcf8\uc758 \uc0c1\ud0dc\ub294 \ubcc0\uacbd\ub418\uc9c0 \uc54a\ub294\ub2e4.<\/p>\n<h4>\uc608\uc81c \ucf54\ub4dc <\/h4>\n<p><img decoding=\"async\" src=\"http:\/\/www.gisdeveloper.co.kr\/wp-content\/uploads\/2020\/10\/prototype.png\" alt=\"\" width=\"800\" class=\"aligncenter size-full wp-image-10483\" \/><\/p>\n<p>Point\uc640 Circle \uadf8\ub9ac\uace0 Line\uc740 Prototype \uc778\ud130\ud398\uc774\uc2a4\ub97c \uad6c\ud604\ud558\ub294 \ud074\ub798\uc2a4\uc774\ub2e4. Prototype\uc744 \uad6c\ud604\ud55c \ud074\ub798\uc2a4\ub294 \uc790\uc2e0\uc758 \uc0c1\ud0dc\uac12\uc744 \uc644\uc804\ud558\uac8c \ubcf5\uc0ac\ud560 \ucc45\uc784\uc744 \uac16\ub294\ub2e4. Prototype\uc758 \ucf54\ub4dc\ub294 \ub2e4\uc74c\uacfc \uac19\ub2e4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\">\r\npackage tstThread;\r\n\r\npublic interface Prototype {\r\n\tPrototype clone();\r\n}\r\n<\/pre>\n<p>Point \ud074\ub798\uc2a4\ub294 \ub2e4\uc74c\uacfc \uac19\ub2e4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\">\r\npackage tstThread;\r\n\r\npublic class Point implements Prototype {\r\n\tprivate int x;\r\n\tprivate int y;\r\n\t\r\n\tpublic Point setX(int x) {\r\n\t\tthis.x = x;\r\n\t\treturn this;\r\n\t}\r\n\t\r\n\tpublic Point setY(int y) {\r\n\t\tthis.y = y;\r\n\t\treturn this;\r\n\t}\r\n\t\r\n\tpublic int getX() {\r\n\t\treturn x;\r\n\t}\r\n\t\r\n\tpublic int getY() {\r\n\t\treturn y;\r\n\t}\r\n\t\r\n\t@Override\r\n\tpublic Prototype clone() {\r\n\t\tPoint newPoint = new Point();\r\n\t\tnewPoint.x = this.x;\r\n\t\tnewPoint.y = this.y;\r\n\t\t\r\n\t\treturn newPoint;\r\n\t}\r\n\t\r\n\t@Override\r\n\tpublic String toString() {\r\n\t\treturn \"POINT(\" + x + \" \" + y + \")\";\r\n\t}\r\n}\r\n<\/pre>\n<p>Circle \ud074\ub798\uc2a4\ub294 \ub2e4\uc74c\uacfc \uac19\ub2e4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\">\r\npackage tstThread;\r\n\r\npublic class Circle implements Prototype {\r\n\tprivate Point center;\r\n\tprivate int radius;\r\n\t\r\n\tpublic Circle setCenter(Point center) {\r\n\t\tthis.center = (Point)center.clone();\r\n\t\treturn this;\r\n\t}\r\n\t\r\n\tpublic Circle setRadius(int radius) {\r\n\t\tthis.radius = radius;\r\n\t\treturn this;\r\n\t}\r\n\t\r\n\tpublic Point getCenter() {\r\n\t\treturn (Point)center.clone();\r\n\t}\r\n\t\r\n\tpublic int getRadius() {\r\n\t\treturn radius;\r\n\t}\r\n\t\r\n\t@Override\r\n\tpublic Prototype clone() {\r\n\t\tCircle newCircle = new Circle();\r\n\t\t\r\n\t\tnewCircle.center = (Point)center.clone();\r\n\t\tnewCircle.radius = this.radius;\r\n\t\t\r\n\t\treturn newCircle;\r\n\t}\r\n\r\n\t@Override\r\n\tpublic String toString() {\r\n\t\treturn \"CIRCLE(center: \" + center + \", radius: \" + radius + \")\";\r\n\t}\r\n}\r\n<\/pre>\n<p>Line \ud074\ub798\uc2a4\ub294 \ub2e4\uc74c\uacfc \uac19\ub2e4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\">\r\npackage tstThread;\r\n\r\npublic class Line implements Prototype {\r\n\tprivate Point startPt;\r\n\tprivate Point endPt;\r\n\t\r\n\tpublic Line setStartPoint(Point pt) {\r\n\t\tthis.startPt = (Point)pt.clone();\r\n\t\treturn this;\r\n\t}\r\n\t\r\n\tpublic Point getStartPoint() {\r\n\t\treturn (Point)startPt.clone();\r\n\t}\r\n\t\r\n\tpublic Line setEndPoint(Point pt) {\r\n\t\tthis.endPt = (Point)pt.clone();\r\n\t\treturn this;\r\n\t}\r\n\t\r\n\tpublic Point getEndPoint() {\r\n\t\treturn (Point)endPt.clone();\r\n\t}\r\n\t\r\n\t@Override\r\n\tpublic Prototype clone() {\r\n\t\tLine newLine = new Line();\r\n\t\t\r\n\t\tnewLine.startPt = (Point)startPt.clone();\r\n\t\tnewLine.endPt = (Point)endPt.clone();\r\n\t\t\r\n\t\treturn newLine;\r\n\t}\r\n\t\r\n\t@Override\r\n\tpublic String toString() {\r\n\t\treturn \"LINE(\" + startPt + \", \" + endPt + \")\";\r\n\t}\r\n}\r\n<\/pre>\n<p>\uc9c0\uae08\uae4c\uc9c0\uc758 \ud074\ub798\uc2a4\ub97c \uc0ac\uc6a9\ud558\ub294 \uc608\uc81c\ub294 \ub2e4\uc74c\uacfc \uac19\ub2e4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\">\r\npackage tstThread;\r\n\r\nimport java.io.UnsupportedEncodingException;\r\n\r\npublic class Main {\r\n\tpublic static void main(String[] args) throws UnsupportedEncodingException {\r\n\t\tPoint center = new Point();\r\n\t\tcenter.setX(100);\r\n\t\tcenter.setY(200);\r\n\t\t\r\n\t\tCircle circle = new Circle();\r\n\t\tcircle.setCenter(center);\r\n\t\tcircle.setRadius(50);\r\n\t\t\r\n\t\tPoint startPt = new Point();\r\n\t\tstartPt.setX(10);\r\n\t\tstartPt.setY(20);\r\n\t\t\r\n\t\tPoint endPt = new Point();\r\n\t\tendPt.setX(40);\r\n\t\tendPt.setY(60);\r\n\t\t\r\n\t\tLine line = new Line();\r\n\t\tline.setStartPoint(startPt);\r\n\t\tline.setEndPoint(endPt);\r\n\t\t\r\n\t\tSystem.out.println(circle);\r\n\t\tSystem.out.println(line);\r\n\t\t\r\n\t\tCircle otherCircle = (Circle)circle.clone();\r\n\t\tLine otherLine = (Line)line.clone();\r\n\t\t\r\n\t\tSystem.out.println(otherCircle);\r\n\t\tSystem.out.println(otherLine);\r\n\t}\r\n}\r\n<\/pre>\n<p>\uc2e4\ud589 \uacb0\uacfc\ub294 \ub2e4\uc74c\uacfc \uac19\ub2e4.<\/p>\n<pre class='code'>\r\nCIRCLE(center: POINT(100 200), radius: 50)\r\nLINE(POINT(10 20), POINT(40 60))\r\nCIRCLE(center: POINT(100 200), radius: 50)\r\nLINE(POINT(10 20), POINT(40 60))\r\n<\/pre>\n<div style='background:#efefef;border-radius:8px;padding:12px 24px'>\uc774 \uae00\uc740 \uc18c\ud504\ud2b8\uc6e8\uc5b4 \uc124\uacc4\uc758 \uae30\ubc18\uc774 \ub418\ub294 GoF\uc758 \ub514\uc790\uc778\ud328\ud134\uc5d0 \ub300\ud55c \uac15\uc758\uc790\ub8cc\uc785\ub2c8\ub2e4. \uc644\uc804\ud55c \uc2e4\uc2b5\uc744 \uc704\ud574 \uc774 \uae00\uc5d0\uc11c \uc18c\uac1c\ud558\ub294 \ud074\ub798\uc2a4 \ub2e4\uc774\uc5b4\uadf8\ub7a8\uacfc \uc608\uc81c \ucf54\ub4dc\ub294 \uc644\uc804\ud558\uac8c \uc2e4\ud589\ub418\ub3c4\ub85d \uc81c\uacf5\ub418\uc9c0\ub9cc, \uc0c1\ub300\uc801\uc73c\ub85c \uc608\uc81c \ucf54\ub4dc\uc640 \uad00\ub828\ub41c \uc124\uba85\uc774 \ud568\ucd95\uc801\uc73c\ub85c \uc81c\uacf5\ub418\uace0 \uc788\uc2b5\ub2c8\ub2e4. \uc774 \uae00\uc5d0 \ub300\ud574 \uad81\uae08\ud55c \uc810\uc774 \uc788\uc73c\uba74 \ub313\uae00\uc744 \ud1b5\ud574 \ub0a8\uaca8\uc8fc\uc2dc\uae30 \ubc14\ub78d\ub2c8\ub2e4.<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\ud328\ud134\uba85\uce6d Prototype \ud544\uc694\ud55c \uc0c1\ud669 \uc5b4\ub5a4 \uac1d\uccb4\uac00 \uc0dd\uc131\ub418\uace0, \uadf8 \uac1d\uccb4\uc758 \uc0c1\ud0dc\uac12\uc774 \ubcc0\uacbd\ub41c \ud6c4 \uadf8 \uac1d\uccb4\uc640 \ub3d9\uc77c\ud55c \uc0c1\ud0dc\uc758 \ub610 \ub2e4\ub978 \ubcf5\uc0ac\ubcf8\uc744 \uc0dd\uc131\ud558\uace0\uc790 \ud560\ub54c \uc0ac\uc6a9\ud560 \uc218 \uc788\ub294 \ud328\ud134\uc774\ub2e4. \ubcf5\uc0ac\ubcf8\uc758 \uc0c1\ud0dc\uc758 \ubcc0\uacbd\uc73c\ub85c\uc778\ud574 \uc6d0\ubcf8\uc758 \uc0c1\ud0dc\ub294 \ubcc0\uacbd\ub418\uc9c0 \uc54a\ub294\ub2e4. \uc608\uc81c \ucf54\ub4dc Point\uc640 Circle \uadf8\ub9ac\uace0 Line\uc740 Prototype \uc778\ud130\ud398\uc774\uc2a4\ub97c \uad6c\ud604\ud558\ub294 \ud074\ub798\uc2a4\uc774\ub2e4. Prototype\uc744 \uad6c\ud604\ud55c \ud074\ub798\uc2a4\ub294 \uc790\uc2e0\uc758 \uc0c1\ud0dc\uac12\uc744 \uc644\uc804\ud558\uac8c \ubcf5\uc0ac\ud560 \ucc45\uc784\uc744 \uac16\ub294\ub2e4. Prototype\uc758 \ucf54\ub4dc\ub294 \ub2e4\uc74c\uacfc \uac19\ub2e4. &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/www.gisdeveloper.co.kr\/?p=10482\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;[GoF] Prototype \ud328\ud134&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-10482","post","type-post","status-publish","format-standard","hentry","category-design"],"_links":{"self":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/10482","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10482"}],"version-history":[{"count":3,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/10482\/revisions"}],"predecessor-version":[{"id":10558,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/10482\/revisions\/10558"}],"wp:attachment":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10482"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10482"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10482"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}