diff --git a/src/Bins.java b/src/Bins.java index b313a3d..3ef019d 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. @@ -21,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; } 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; } 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