Example #1
0
 /**
  * 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());
   }
 }
Example #2
0
  /**
   * 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);
  }
Example #3
0
  /**
   * 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;
  }