/** * this method find the start and the end of the search dates pass it to dateparser and process * * @return */ protected Date[] extractSearchDates() { String[] startEnd = new String[2]; for (Field f : fields) { if (f.getName().equals(FIELD_IDENTIFIERS[START_INDEX])) { startEnd[0] = f.getContent(); } else if (f.getName().equals(FIELD_IDENTIFIERS[END_INDEX])) { startEnd[1] = f.getContent(); } } return DateParser.parseSearchDate(startEnd); }
/** * This method will first indicate which is the start date and the end date. It will then parse * the date to DateParser to get an date object * * @return */ protected Date[] extractDates() { Date[] startEnd = new Date[2]; for (Field f : fields) { if (f.getName().equals(FIELD_IDENTIFIERS[START_INDEX])) { startEnd[0] = DateParser.parseDate(f.getContent()); } else if (f.getName().equals(FIELD_IDENTIFIERS[END_INDEX])) { startEnd[1] = DateParser.parseDate(f.getContent()); } } if (startEnd[0] != null && startEnd[1] != null) { Arrays.sort(startEnd); } return startEnd; }
/** * This method first check the which field is stored in the Field array by comparing with the * FieldIdentifiers, the content will be stored in string fields * * @return */ protected String[] extractStrings() { String[] strFields = new String[MemoriCommand.NUM_STRING_FIELDS]; for (Field f : fields) { if (f.getName().equals(FIELD_IDENTIFIERS[NAME_INDEX])) { strFields[MemoriCommand.NAME_INDEX] = f.getContent(); } else if (f.getName().equals(FIELD_IDENTIFIERS[LOCATION_INDEX])) { strFields[MemoriCommand.LOCATION_INDEX] = f.getContent(); } else if (f.getName().equals(FIELD_IDENTIFIERS[DESCRIPTION_INDEX])) { strFields[MemoriCommand.DESCRIPTION_INDEX] = f.getContent(); } } return strFields; }