<commit_before>package edu.oregonstate.mist

class Task {

    static constraints = {}

    static hasMany = [subTasks: Task]
    static belongsTo = [user: User]

    private static enum Status { TODO, DONE, CANCELLED, DELETED }

    String description
    Interval schedule
    Integer priority
    private Status status

    public Task() {
        this("")
    }

    public Task(String description) {
        this.description = description
        this.schedule = new Interval()
        priority = 0
        this.setStatusIncomplete()
    }

    public void incrementPriority() {
        ++priority
    }

    public void decrementPriority() {
        --priority
    }

    public void setStatusIncomplete() {
        status = Status.TODO
    }

    public void setStatusCompleted() {
        status = Status.DONE
    }

    public void setStatusCancelled() {
        status = Status.CANCELLED
    }

    public void setStatusDeleted() {
        status = Status.DELETED
    }

    public Boolean isIncomplete() {
        return status == Status.TODO
    }

    public Boolean isComplete() {
        return status == Status.DONE
    }

    public Boolean isCancelled() {
        return status == Status.CANCELLED
    }

    public Boolean isDeleted() {
        return status == Status.DELETED
    }

    public void setUnscheduled() {
        schedule.setNull()
    }

    public Boolean isScheduled() {
        Boolean thisTaskIsScheduled = !schedule.isNull()
        Boolean aSubTaskIsScheduled = subTasks.find({ it.isScheduled() })

        return thisTaskIsScheduled || aSubTaskIsScheduled
    }

    public Boolean isScheduled(Interval when) {
        Boolean    taskScheduleOverlaps = schedule.overlaps(when)
        Boolean subTaskScheduleOverlaps = subTasks.find({ it.getSchedule().overlaps(when) })

        return isScheduled() && (taskScheduleOverlaps || subTaskScheduleOverlaps)
    }
    public Boolean hasSubTasks() {
        return subTasks && !subTasks.isEmpty()<commit_msg>add subtasks<commit_after>package edu.oregonstate.mist

class Task {

    static constraints = {}

    static hasMany = [subTasks: Task]
    static belongsTo = [user: User]

    private static enum Status { TODO, DONE, CANCELLED, DELETED }

    String description
    Interval schedule
    Integer priority
    private Status status

    public Task() {
        this("")
    }

    public Task(String description) {
        this.description = description
        this.schedule = new Interval()
        priority = 0
        this.setStatusIncomplete()
    }

    public void incrementPriority() {
        ++priority
    }

    public void decrementPriority() {
        --priority
    }

    public void setStatusIncomplete() {
        status = Status.TODO
    }

    public void setStatusCompleted() {
        status = Status.DONE
    }

    public void setStatusCancelled() {
        status = Status.CANCELLED
    }

    public void setStatusDeleted() {
        status = Status.DELETED
    }

    public Boolean isIncomplete() {
        return status == Status.TODO
    }

    public Boolean isComplete() {
        return status == Status.DONE
    }

    public Boolean isCancelled() {
        return status == Status.CANCELLED
    }

    public Boolean isDeleted() {
        return status == Status.DELETED
    }

    public void setUnscheduled() {
        schedule.setNull()
    }

    public Boolean isScheduled() {
        Boolean thisTaskIsScheduled = !schedule.isNull()
        Boolean aSubTaskIsScheduled = subTasks.find({ it.isScheduled() })

        return thisTaskIsScheduled || aSubTaskIsScheduled
    }

    public Boolean isScheduled(Interval when) {
        Boolean    taskScheduleOverlaps = schedule.overlaps(when)
        Boolean subTaskScheduleOverlaps = subTasks.find({ it.getSchedule().overlaps(when) })

        return isScheduled() && (taskScheduleOverlaps || subTaskScheduleOverlaps)
    }

    public void addSubTask(Task subTask) {
        if (subTasks == null) {
            subTasks = []
        }

        subTasks.add(subTask)
    }

    public Boolean hasSubTasks() {
        return subTasks && !subTasks.isEmpty()
{'fraction_non_alphanumeric': 0.08706166868198308, 'fraction_numerical': 0.0004836759371221282, 'mean_word_length': 2.3626016260162603, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '365827', 'n_tokens_mistral': 1171, 'n_tokens_neox': 1123, 'n_words': 279}