package tars.commons.util;

import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

import tars.commons.exceptions.IllegalValueException;
import tars.logic.parser.Prefix;

/**
 * Container for methods which extract data from string
 */
public class ExtractorUtil {

    /**
     * Extracts the new task's dateTimes from the rsv command's dateTime arguments string. Merges
     * duplicate dateTime strings.
     */
    public static Set<String> getDateTimeStringSetFromArgs(
            String dateTimeArguments, Prefix prefix)
            throws IllegalValueException {
        // no dateTime
        if (StringUtil.EMPTY_STRING.equals(dateTimeArguments)) {
            return Collections.emptySet();
        }
        // replace first delimiter prefix, then split
        final Collection<String> dateTimeStrings =
                Arrays.asList(dateTimeArguments
                        .replaceFirst(
                                prefix.value + StringUtil.STRING_WHITESPACE,
                                StringUtil.EMPTY_STRING)
                        .split(StringUtil.STRING_WHITESPACE + prefix.value
                                + StringUtil.STRING_WHITESPACE));
        return new HashSet<>(dateTimeStrings);
    }

    /**
     * Extracts the new task's recurring args from add command.
     * 
     * @@author A0140022H
     */
    public static String[] getRecurringFromArgs(String recurringArguments,
            Prefix prefix) throws IllegalValueException {
        recurringArguments = recurringArguments
                .replaceFirst(prefix.value, StringUtil.EMPTY_STRING).trim();
        String[] recurringString =
                recurringArguments.split(StringUtil.STRING_WHITESPACE);

        return recurringString;
    }
}

@@ -25,141 +25,8 @@
 l;%0A%0A
-import java.util.Arrays;%0Aimport java.util.Collection;%0Aimport java.util.Collections;%0Aimport java.util.HashSet;%0Aimport java.util.Set;%0A%0A
 impo
@@ -206,976 +206,8 @@
 l %7B%0A
-%0A    /**%0A     * Extracts the new task's dateTimes from the rsv command's dateTime arguments string. Merges%0A     * duplicate dateTime strings.%0A     */%0A    public static Set%3CString%3E getDateTimeStringSetFromArgs(%0A            String dateTimeArguments, Prefix prefix)%0A            throws IllegalValueException %7B%0A        // no dateTime%0A        if (StringUtil.EMPTY_STRING.equals(dateTimeArguments)) %7B%0A            return Collections.emptySet();%0A        %7D%0A        // replace first delimiter prefix, then split%0A        final Collection%3CString%3E dateTimeStrings =%0A                Arrays.asList(dateTimeArguments%0A                        .replaceFirst(%0A                                prefix.value + StringUtil.STRING_WHITESPACE,%0A                                StringUtil.EMPTY_STRING)%0A                        .split(StringUtil.STRING_WHITESPACE + prefix.value%0A                                + StringUtil.STRING_WHITESPACE));%0A        return new HashSet%3C%3E(dateTimeStrings);%0A    %7D%0A%0A
     

Remove unused method