From 910a6b4f20d944783f20d407b5775cecc773bee8 Mon Sep 17 00:00:00 2001 From: Adithya93 Date: Thu, 14 Jan 2016 17:13:12 -0500 Subject: [PATCH 1/4] Added comment, first commit --- src/Bins.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Bins.java b/src/Bins.java index b313a3d..8263368 100644 --- a/src/Bins.java +++ b/src/Bins.java @@ -11,6 +11,7 @@ */ public class Bins { public static final String DATA_FILE = "example.txt"; + // ADDED COMMENT! /** * Reads list of integer data from the given input. From a106fc6fa18e100debbc9879cd072c6b07816793 Mon Sep 17 00:00:00 2001 From: Adithya93 Date: Thu, 14 Jan 2016 17:47:22 -0500 Subject: [PATCH 2/4] Type checking of input from scanner --- src/Bins.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Bins.java b/src/Bins.java index 8263368..3ef019d 100644 --- a/src/Bins.java +++ b/src/Bins.java @@ -22,7 +22,13 @@ public class Bins { public List readData (Scanner input) { List results = new ArrayList(); while (input.hasNext()) { - results.add(input.nextInt()); + if (input.hasNextInt()) { + results.add(input.nextInt()); + } + else { + break; + } + } return results; } From 89ed7532fe20b7a8009dfb9119a1a4591128ce85 Mon Sep 17 00:00:00 2001 From: Adithya93 Date: Thu, 14 Jan 2016 17:54:12 -0500 Subject: [PATCH 3/4] Refactor equals method to eliminate redundant conditionals --- src/Disk.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Disk.java b/src/Disk.java index e3a3f31..b4e5f09 100644 --- a/src/Disk.java +++ b/src/Disk.java @@ -71,11 +71,7 @@ public String toString () { @Override public boolean equals (Object other) { if (other != null && other instanceof Disk) { - if (myId == ((Disk) other).myId) { - return true; - } else { - return false; - } + return (myId == ((Disk) other).myId); } else { return false; } From bdbc8b2e27cfa18ce602a2d4ac0e364437e8fc2c Mon Sep 17 00:00:00 2001 From: Adithya93 Date: Thu, 14 Jan 2016 18:29:10 -0500 Subject: [PATCH 4/4] Moved written answers to separate README.txt file --- src/README.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/README.txt diff --git a/src/README.txt b/src/README.txt new file mode 100644 index 0000000..930f671 --- /dev/null +++ b/src/README.txt @@ -0,0 +1,18 @@ +netIDs: at200 blz4 myk3 ra102 + +Readability +Bins.java +No commenting for clarification, would be incredibly useful for the sections which are used for producing disks, placing items into disks, and similarly less apparent sections + +Disk.java +Well commented and far easier to understand on simple level + +Testability +Testing with inputs that do not fit the proper input (such as strings) can be input to the scanner is important and ensure the code operates under unexpected conditions. +Break statements and closing input streams is important for making the program flexible while also preventing memory leaks. + +Input to test for working under improper input… “1 2 3 4 xyz” + +Extensibility +The system includes a lot of redundant .print commands and would benefit from these being shortened to single commands with /n +Several functions in Disk.java feature bulky, redundant if/else statements which can be easily simplified \ No newline at end of file