/** * Remove the some day keyword from the description * * @param toEditTask the task to edit * @param someDayKeyWords the keywords for someday */ private void removeSomeDayKeyWord(Task toEditTask, String[] someDayKeyWords) { String matchedWord = StringHandler.getContainsWord(toEditTask.getDescription(), someDayKeyWords); String newDescription = StringHandler.removeFirstMatchedWord(toEditTask.getDescription(), matchedWord); toEditTask.setDescription(newDescription); }
/** * Check if someday is specified * * @param toEditTask the task to edit * @param someDayKeyWords the keywords for someday * @return if someday is specified */ private boolean isSomeDaySpecified(Task toEditTask, String[] someDayKeyWords) { boolean somedaySpecified; if (toEditTask.getDescription() != null) { if (StringHandler.containsWord(toEditTask.getDescription(), someDayKeyWords)) { somedaySpecified = true; } else somedaySpecified = false; } else { somedaySpecified = false; } return somedaySpecified; }
/** * Set description for the task * * @param source from the task that will be edited * @param editedTask the task that contains what to edit */ private void setDescriptionBasedOnSpecified(Task source, Task toEditTask, Task editedTask) { if (toEditTask.getDescription() == null || toEditTask.getDescription().isEmpty()) { editedTask.setDescription(source.getDescription()); } else { editedTask.setDescription(toEditTask.getDescription()); } }
/** * Set priority status for the task * * @param source from the task that will be edited * @param editedTask the task that contains what to edit */ private void setPriorityBasedOnSpecified(Task source, Task toEditTask, Task editedTask) { if (toEditTask.getPriority() == null || toEditTask.getPriority() == Task.PRIORITY_NOT_SET) { editedTask.setPriority(source.getPriority()); } else { editedTask.setPriority(toEditTask.getPriority()); } }
/** * Set the task to someday * * @param editedTask the task to be set to someday */ private void setSomeday(Task editedTask) { editedTask.setEndDate(Task.DATE_NOT_SET); editedTask.setStartDate(Task.DATE_NOT_SET); editedTask.setEndTime(Task.TIME_NOT_SET); editedTask.setStartTime(Task.TIME_NOT_SET); }
/** * Set date for the task * * @param source from the task that will be edited * @param editedTask the task that contains what to edit */ private void setDateTimeBasedOnSpecified(Task source, Task toEditTask, Task editedTask) { if (toEditTask.getEndDate() == null || toEditTask.getEndDate() == Task.DATE_NOT_SET) { editedTask.setEndDate(source.getEndDate()); } else { editedTask.setEndDate(toEditTask.getEndDate()); } if (toEditTask.getStartDate() == null || toEditTask.getStartDate() == Task.DATE_NOT_SET) { editedTask.setStartDate(source.getStartDate()); } else { editedTask.setStartDate(toEditTask.getStartDate()); } if (toEditTask.getStartTime() == null || toEditTask.getStartTime() == Task.TIME_NOT_SET) { editedTask.setStartTime(source.getStartTime()); } else { editedTask.setStartTime(toEditTask.getStartTime()); } if (toEditTask.getEndTime() == null || toEditTask.getEndTime() == Task.TIME_NOT_SET) { editedTask.setEndTime(source.getEndTime()); } else { editedTask.setEndTime(toEditTask.getEndTime()); } }
/** * Set complete status for the task * * @param source from the task that will be edited * @param editedTask the task that contains what to edit */ private void setCompleteStatus(Task source, Task editedTask) { editedTask.setCompleted(source.getCompleted()); }