From b875483c2eb038b71feca064c25629f459cbef6e Mon Sep 17 00:00:00 2001 From: AndreiChis Date: Tue, 5 Mar 2013 11:12:33 +0100 Subject: [PATCH] adjusted 'before' project of demo video --- DemoVideo/~$Script.rtf | Bin 162 -> 0 bytes DemoVideo/~WRL0005.tmp | 89 ------------------ DemoVideo_before/.classpath | 1 - DemoVideo_before/src/demo/DemoMain.java | 5 +- DemoVideo_before/src/demo/model/Address.java | 18 +++- DemoVideo_before/src/demo/model/Contact.java | 21 +---- .../src/demo/model/Directory.java | 24 +---- .../src/demo/model/PhoneNumber.java | 11 +++ 8 files changed, 30 insertions(+), 139 deletions(-) delete mode 100644 DemoVideo/~$Script.rtf delete mode 100644 DemoVideo/~WRL0005.tmp diff --git a/DemoVideo/~$Script.rtf b/DemoVideo/~$Script.rtf deleted file mode 100644 index be5a19a36deb9c9d3b8a76e73edd86313279f3c0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 162 zcmWe~PE9GwOjZa=%}mZn%}Yv5&R`%6gczI|QW;VhiWo8(k{J{jf`B{_D+5U9F(ff0 sg4qlVj0_A7AlwNw62=w*GUfyM?LhiKEW|Dr=RFn`7lJS>W(A4>0GJmQQ2+n{ diff --git a/DemoVideo/~WRL0005.tmp b/DemoVideo/~WRL0005.tmp deleted file mode 100644 index 7a6cf42..0000000 --- a/DemoVideo/~WRL0005.tmp +++ /dev/null @@ -1,89 +0,0 @@ -{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf340 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fnil\fcharset0 Monaco;} -{\colortbl;\red255\green255\blue255;\red100\green100\blue100;\red127\green0\blue85;\red0\green0\blue192; -\red42\green0\blue255;} -\paperw11900\paperh16840\margl1440\margr1440\vieww25820\viewh15840\viewkind0 -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural - -\f0\fs36 \cf0 Explain application quicky\ - DoodleDebug aims on replacing System.out.println as well as debuggers. Though, it should still be easy to use.\ -\ -toString implementations on Directory and Contact and print directory\ - \ -\ -explain the problems faced with toString\ -\ -implement Doodleable interface with Directory, Contact, Address and PhoneNumber, step by step (order?)\ -Directory:\ -\pard\pardeftab720 - -\f1\fs22 \cf2 @Override\cf0 \ - \cf3 public\cf0 \cf3 void\cf0 doodleOn(DoodleCanvas c) \{\ - \cf3 for\cf0 (Contact contact : \cf4 contacts\cf0 ) \{\ - c.draw(contact);\ - c.newLine();\ - \}\ - \}\ -\ - \cf2 @Override\cf0 \ - \cf3 public\cf0 \cf3 void\cf0 summarizeOn(DoodleCanvas c) \{\ - c.draw(\cf5 "Directory with "\cf0 + numberOfContacts() + \cf5 " contacts"\cf0 );\ - \}\ -\pard\pardeftab720 - -\f0\fs36 \cf0 Contact:\ -\pard\pardeftab720 - -\f1\fs22 \cf2 @Override\cf0 \ - \cf3 public\cf0 \cf3 void\cf0 doodleOn(DoodleCanvas c) \{\ - c.draw(\cf4 picture\cf0 );\ - c.newColumn();\ - c.draw(\cf4 name\cf0 );\ - c.newLine();\ - c.draw(\cf4 phoneNumber\cf0 );\ - c.newColumn();\ - c.draw(\cf4 address\cf0 );\ - \}\ -\ - \cf2 @Override\cf0 \ - \cf3 public\cf0 \cf3 void\cf0 summarizeOn(DoodleCanvas c) \{\ - c.draw(\cf4 name\cf0 );\ - \} -\f0\fs36 \ -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural -\cf0 Address:\ -\pard\pardeftab720 - -\f1\fs22 \cf2 @Override\cf0 \ - \cf3 public\cf0 \cf3 void\cf0 doodleOn(DoodleCanvas c) \{\ - c.draw(\cf4 street\cf0 );\ - c.newLine();\ - c.draw(\cf4 zipCode\cf0 );\ - c.draw(\cf4 city\cf0 );\ - c.newColumn();\ - c.draw(\cf4 country\cf0 );\ - \}\ -\ - \cf2 @Override\cf0 \ - \cf3 public\cf0 \cf3 void\cf0 summarizeOn(DoodleCanvas c) \{\ - c.draw(\cf4 city\cf0 );\ - \} -\f0\fs36 \ -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural -\cf0 PhoneNumber:\ -\pard\pardeftab720 - -\f1\fs22 \cf2 @Override\cf0 \ - \cf3 public\cf0 \cf3 void\cf0 doodleOn(DoodleCanvas c) \{\ - c.draw(\cf4 areaCode\cf0 );\ - c.draw(\cf4 rest\cf0 );\ - \}\ -\ - \cf2 @Override\cf0 \ - \cf3 public\cf0 \cf3 void\cf0 summarizeOn(DoodleCanvas c) \{\ - doodleOn(c);\ - \} -\f0\fs36 \ -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural -\cf0 \ -show inspection features} \ No newline at end of file diff --git a/DemoVideo_before/.classpath b/DemoVideo_before/.classpath index 1bbcd86..fb565a5 100644 --- a/DemoVideo_before/.classpath +++ b/DemoVideo_before/.classpath @@ -2,6 +2,5 @@ - diff --git a/DemoVideo_before/src/demo/DemoMain.java b/DemoVideo_before/src/demo/DemoMain.java index cca9261..e57b771 100644 --- a/DemoVideo_before/src/demo/DemoMain.java +++ b/DemoVideo_before/src/demo/DemoMain.java @@ -2,8 +2,6 @@ import java.io.IOException; -import ch.unibe.scg.doodle.Doo; - import demo.model.Directory; import demo.util.DemoUtil; @@ -22,7 +20,6 @@ public static void main(String[] args) throws IOException { directory.addContact(DemoUtil.randomContact()); } - Doo.dle(directory); - // System.out.println(directory); + System.out.println(directory); } } diff --git a/DemoVideo_before/src/demo/model/Address.java b/DemoVideo_before/src/demo/model/Address.java index e8d6308..fac16d8 100644 --- a/DemoVideo_before/src/demo/model/Address.java +++ b/DemoVideo_before/src/demo/model/Address.java @@ -1,12 +1,11 @@ package demo.model; - public class Address { private String street; private int zipCode; private String city; private String country; - + public Address(String street, int zipCode, String city, String country) { super(); this.street = street; @@ -30,4 +29,19 @@ public String getCity() { public String getCountry() { return country; } + + // @Override + // public void doodleOn(DoodleCanvas c) { + // c.draw(street); + // c.newLine(); + // c.draw(zipCode); + // c.draw(city); + // c.newColumn(); + // c.draw(country); + // } + // + // @Override + // public void summarizeOn(DoodleCanvas c) { + // c.draw(city); + // } } \ No newline at end of file diff --git a/DemoVideo_before/src/demo/model/Contact.java b/DemoVideo_before/src/demo/model/Contact.java index 8ce32fb..c946bcc 100644 --- a/DemoVideo_before/src/demo/model/Contact.java +++ b/DemoVideo_before/src/demo/model/Contact.java @@ -2,10 +2,7 @@ import java.awt.Image; -import ch.unibe.scg.doodle.api.DoodleCanvas; -import ch.unibe.scg.doodle.api.Doodleable; - -public class Contact implements Doodleable { +public class Contact { private String name; private Address address; private PhoneNumber phoneNumber; @@ -40,20 +37,4 @@ public String toString() { return "\n(" + name + ", " + address + ", " + phoneNumber + ")"; } - @Override - public void doodleOn(DoodleCanvas c) { - c.draw(picture); - c.newColumn(); - c.draw(name); - c.newLine(); - c.draw(phoneNumber); - c.newColumn(); - c.draw(address); - } - - @Override - public void summarizeOn(DoodleCanvas c) { - c.draw(name); - } - } diff --git a/DemoVideo_before/src/demo/model/Directory.java b/DemoVideo_before/src/demo/model/Directory.java index 3915e07..e86f024 100644 --- a/DemoVideo_before/src/demo/model/Directory.java +++ b/DemoVideo_before/src/demo/model/Directory.java @@ -3,10 +3,7 @@ import java.util.ArrayList; import java.util.Collection; -import ch.unibe.scg.doodle.api.DoodleCanvas; -import ch.unibe.scg.doodle.api.Doodleable; - -public class Directory implements Doodleable { +public class Directory { private Collection contacts; public Directory() { @@ -23,25 +20,6 @@ public int numberOfContacts() { public String toString() { return contacts.toString(); - // String result = ""; - // result += "Directory: ("; - // for (Contact contact : contacts) { - // result += contact+", "; - // } - // result += ")"; - } - - @Override - public void doodleOn(DoodleCanvas c) { - for (Contact contact : contacts) { - c.draw(contact); - c.newLine(); - } - } - - @Override - public void summarizeOn(DoodleCanvas c) { - c.draw("Directory with " + numberOfContacts() + " contacts"); } } diff --git a/DemoVideo_before/src/demo/model/PhoneNumber.java b/DemoVideo_before/src/demo/model/PhoneNumber.java index cfa564c..c8fd311 100644 --- a/DemoVideo_before/src/demo/model/PhoneNumber.java +++ b/DemoVideo_before/src/demo/model/PhoneNumber.java @@ -18,4 +18,15 @@ public String getRest() { return rest; } + // @Override + // public void doodleOn(DoodleCanvas c) { + // c.draw(areaCode); + // c.draw(rest); + // } + // + // @Override + // public void summarizeOn(DoodleCanvas c) { + // doodleOn(c); + // } + }