Skip to content

Commit

Permalink
Fix codacy error level problems (#196)
Browse files Browse the repository at this point in the history
* Fix: Avoid reassigning parameters such as 'endDateTime'

* Fix: Avoid reassigning parameters such as 'endTime'

* Fix: Avoid reassigning parameters such as 'args'

* Fix: Use explicit scoping instead of the default package private level

* Fix: Use explicit scoping instead of the default package private level
  • Loading branch information
INCENDE authored and rachx committed Nov 3, 2016
1 parent 46c5cd3 commit a999708
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/main/java/seedu/agendum/logic/commands/AddCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,14 @@ public AddCommand(String name, Optional<LocalDateTime> deadlineDate)
*/
public AddCommand(String name, Optional<LocalDateTime> startDateTime, Optional<LocalDateTime> endDateTime)
throws IllegalValueException {
Optional<LocalDateTime> balancedEndDateTime = endDateTime;
if (startDateTime.isPresent() && endDateTime.isPresent()) {
endDateTime = Optional.of(DateTimeUtils.balanceStartAndEndDateTime(startDateTime.get(), endDateTime.get()));
balancedEndDateTime = Optional.of(DateTimeUtils.balanceStartAndEndDateTime(startDateTime.get(), endDateTime.get()));
}
this.toAdd = new Task(
new Name(name),
startDateTime,
endDateTime
balancedEndDateTime
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ public class ScheduleCommand extends Command {
//@@author A0133367E
public ScheduleCommand(int targetIndex, Optional<LocalDateTime> startTime,
Optional<LocalDateTime> endTime) {
Optional<LocalDateTime> balancedEndTime = endTime;
if (startTime.isPresent() && endTime.isPresent()) {
endTime = Optional.of(DateTimeUtils.balanceStartAndEndDateTime(startTime.get(), endTime.get()));
balancedEndTime = Optional.of(DateTimeUtils.balanceStartAndEndDateTime(startTime.get(), endTime.get()));
}
this.targetIndex = targetIndex;
this.newStartDateTime = startTime;
this.newEndDateTime = endTime;
this.newEndDateTime = balancedEndTime;
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/seedu/agendum/logic/parser/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -392,9 +392,9 @@ private Set<Integer> parseIndexes(String args) {
return taskIds;
}

args = args.replaceAll("[ ]+", ",").replaceAll(",+", ",");
String replacedArgs = args.replaceAll("[ ]+", ",").replaceAll(",+", ",");

String[] taskIdStrings = args.split(",");
String[] taskIdStrings = replacedArgs.split(",");
for (String taskIdString : taskIdStrings) {
if (taskIdString.matches("\\d+")) {
taskIds.add(Integer.parseInt(taskIdString));
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/agendum/ui/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public void handle(KeyEvent evt) {
/**
* Loads the ui elements
*/
void fillInnerParts() {
public void fillInnerParts() {
upcomingTasksPanel = UpcomingTasksPanel.load(primaryStage, getUpcomingTasksPlaceHolder(),
logic.getFilteredTaskList(), new UpcomingTasksPanel());
completedTasksPanel = CompletedTasksPanel.load(primaryStage, getCompletedTasksPlaceHolder(),
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/agendum/ui/UiManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private Image getImage(String imagePath) {
return new Image(MainApp.class.getResourceAsStream(imagePath));
}

void showAlertDialogAndWait(Alert.AlertType type, String title, String headerText, String contentText) {
private void showAlertDialogAndWait(Alert.AlertType type, String title, String headerText, String contentText) {
showAlertDialogAndWait(mainWindow.getPrimaryStage(), type, title, headerText, contentText);
}

Expand Down

0 comments on commit a999708

Please sign in to comment.