Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Massive improvement to source model #69

Merged
merged 5 commits into from
Mar 9, 2019

Conversation

ToonDragon
Copy link

Source model can now be tested with three basic functions:
add - which adds a new source to the database
delete - which deletes a source by index
list - which lists all the sources currently in the database

Database will also load saved sources and automatically save when the exit command is entered

Added a user menu for development purposes

You can now enter an operation mode to select which app to test:
1 - for the standard address book 4
2 - to test the new model

#68

ToonDragon and others added 2 commits March 8, 2019 14:42
Source model can now be tested with three basic functions:
add - which adds a new source to the database
delete - which deletes a source by index
list - which lists all the sources currently in the database

Database will also load saved sources and automatically save when the exit command is entered

Added a user menu for development purposes

You can now enter an operation mode to select which app to test:
1 - for the standard address book 4
2 - to test the new model
@ToonDragon ToonDragon added this to the v1.2 milestone Mar 9, 2019
@ToonDragon
Copy link
Author

The abstraction for the individual items in the source object have been added but was not included in this latest version of the model. As it is, the extra abstraction feels unnecessary since it is just an object with a string inside.

Copy link

@DoItTomorrow DoItTomorrow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adjusts the database model to handle sources with some basic functionality. Somewhat unsure what SourceItem* objects achieve other than add complexity, but code is functional.

@ToonDragon ToonDragon merged commit b56dec8 into CS2103-AY1819S2-W13-3:master Mar 9, 2019

switch (input) {
case "1":
System.out.println("Starting Addressbook 4.");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should extract these strings out as constants and put them at the top of the file

+ "list\n"
+ "exit\n");

boolean loopCondition = true;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe name it more descriptively than loopCondition?

+ "exit\n");

boolean loopCondition = true;
while (loopCondition == true) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also the == true part is unnecessary

@@ -29,6 +33,9 @@ public void deleteSourceAtIndex (int index) {
public void deleteAllSources () {
database.clear();
}
public Source getSourceAtIndex (int index) {
return database.get(index);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're not handling IndexOutOfBoundsException!!!

case "add":
// Check size of array (in case user enters "add" and nothing else)
if (orderSplit.length < 2) {
System.out.println("Invalid command parameters.\n"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor string constants

@case141 case141 removed this from the v1.2 milestone Mar 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants