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

[T2A2][T16-A1] Alwinson Au-yong #307

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

[T2A2][T16-A1] Alwinson Au-yong #307

wants to merge 2 commits into from

Conversation

alwinsonauyong
Copy link

Ready to Review

Copy link

@okkhoy okkhoy left a comment

Choose a reason for hiding this comment

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

good attempt in general. albeit came in a little late.

@@ -54,7 +54,7 @@
/**
* A platform independent line separator.
*/
private static final String LS = System.lineSeparator() + LINE_PREFIX;
private static final String LINE_SEPARATOR = System.lineSeparator() + LINE_PREFIX;
Copy link

Choose a reason for hiding this comment

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

good catch!

final String[] commandTypeAndParams = splitCommandWordAndArgs(userInputString);
final String commandType = commandTypeAndParams[0];
final String commandArgs = commandTypeAndParams[1];
final String commandType = commandTypeAndParams[COMMAND_TYPE_INDEX];
Copy link

Choose a reason for hiding this comment

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

good to see you have removed the magic numbers here!

final boolean changed = ALL_PERSONS.remove(exactPerson);
if (changed) {
final boolean ischanged = ALL_PERSONS.remove(exactPerson);
if (ischanged) {
Copy link

Choose a reason for hiding this comment

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

the idea here is correct, naming the boolean by prefixing is however, you need to follow camel casing. appropriate would be isChanged

&& !splitArgs[0].isEmpty() // non-empty arguments
&& !splitArgs[1].isEmpty()
&& !splitArgs[2].isEmpty();
return splitArgs.length == PERSON_DATA_COUNT // 3 arguments
Copy link

Choose a reason for hiding this comment

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

👍 eliminating magic numbers.

*/
private static String removePrefixSign(String s, String sign) {
return s.replace(sign, "");
private static String removePrefix(String fullString, String prefix) {
Copy link

Choose a reason for hiding this comment

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

the solution to this one is incorrect.
this one is pretty much the same as earlier. you need to change the code so that only prefix is removed.
in the current version all occurrences of prefix in fullString are removed.

@okkhoy
Copy link

okkhoy commented Feb 25, 2017

@alwinsonauyong
Some comments added. Please ack & close the PR after reading comments.

sorry for the delay!
since this PR wasn't submitted on time, I missed it when I processed the others.
checked only now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants