<commit_before>package seedu.taskman.model.event;

import com.google.common.base.Objects;
import seedu.taskman.commons.exceptions.IllegalValueException;

public class Frequency {
    // TODO: write proper constrain message
    public static final String MESSAGE_FREQUENCY_CONSTRAINTS = "Placeholder for now!";
    public static final String FREQUENCY_VALIDATION_REGEX = "\\d+";

    public final Long seconds;

    public Frequency(String frequency) throws IllegalValueException {
        assert frequency != null;
        frequency = frequency.trim();
        if (!isValidFrequency(frequency)) {
            throw new IllegalValueException(MESSAGE_FREQUENCY_CONSTRAINTS);
        }
        this.seconds = Long.valueOf(frequency);
    }

    public static boolean isValidFrequency(String test) {
        // TODO: write proper validation

        return test.matches(FREQUENCY_VALIDATION_REGEX);
    }

    @Override
    public String toString() {<commit_msg>Add FREQUENCY_VALIDATION_REGEX<commit_after>package seedu.taskman.model.event;

import com.google.common.base.Objects;
import seedu.taskman.commons.exceptions.IllegalValueException;

public class Frequency {
    // TODO: check for overflow of seconds because current validation allows years
    public static final String MESSAGE_FREQUENCY_CONSTRAINTS = "Task frequency should only contain frequency and unit of time in the format: <number><h/d/w/m/y>.";
    public static final String FREQUENCY_VALIDATION_REGEX = "([1-9]|([1-9]+[0-9]*[0-9]))(h|d|w|m|y)";

    public final Long seconds;

    public Frequency(String frequency) throws IllegalValueException {
        assert frequency != null;
        frequency = frequency.trim();
        if (!isValidFrequency(frequency)) {
            throw new IllegalValueException(MESSAGE_FREQUENCY_CONSTRAINTS);
        }
        this.seconds = Long.valueOf(frequency);
    }

    public static boolean isValidFrequency(String test) {
    	// TODO: improve on validation, see above
        return test.matches(FREQUENCY_VALIDATION_REGEX);
    }

    @Override
    public String toString() {
{'fraction_non_alphanumeric': 0.08908045977011494, 'fraction_numerical': 0.0038314176245210726, 'mean_word_length': 3.6216814159292037, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4039655', 'n_tokens_mistral': 603, 'n_tokens_neox': 583, 'n_words': 148}