<commit_before>package edu.oregonstate.mist.tasx

class Task {

    static constraints = {}

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

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

    static mapping = {
        table "TasxTask"
    }

    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()
    }

    /**
     * Test whether the task is scheduled.
     *
     * @return true if the task is scheduled
     */
    public Boolean isScheduled() {
        Boolean thisTaskIsScheduled = !schedule.isNull()
        Boolean aSubTaskIsScheduled = subTasks.find({ it.isScheduled() })

        return thisTaskIsScheduled || aSubTaskIsScheduled
    }

    /**
     * Test whether the task is scheduled during the input Interval.
     *
     * @param when an interval
     * @return     true if the task is scheduled during input Interval
     */
    public Boolean isScheduled(Interval when) {
        Boolean    taskScheduleOverlaps = schedule.overlaps(when)
        Boolean subTaskScheduleOverlaps = subTasks.find({ it.getSchedule().overlaps(when) })

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

    /**
     * Test whether this Task has subTasks.
     *
     * @return true if the set of subTasks is null or empty
     */
    public Boolean hasSubTasks() {
        return subTasks && !subTasks.isEmpty()
    }
}
<commit_msg>remove private modifier from member for gorm compatibility<commit_after>package edu.oregonstate.mist.tasx

class Task {

    static constraints = {}

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

    static mapping = {
        table "TasxTask"
    }

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

    String description
    Interval schedule
    Integer priority
    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()
    }

    /**
     * Test whether the task is scheduled.
     *
     * @return true if the task is scheduled
     */
    public Boolean isScheduled() {
        Boolean thisTaskIsScheduled = !schedule.isNull()
        Boolean aSubTaskIsScheduled = subTasks.find({ it.isScheduled() })

        return thisTaskIsScheduled || aSubTaskIsScheduled
    }

    /**
     * Test whether the task is scheduled during the input Interval.
     *
     * @param when an interval
     * @return     true if the task is scheduled during input Interval
     */
    public Boolean isScheduled(Interval when) {
        Boolean    taskScheduleOverlaps = schedule.overlaps(when)
        Boolean subTaskScheduleOverlaps = subTasks.find({ it.getSchedule().overlaps(when) })

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

    /**
     * Test whether this Task has subTasks.
     *
     * @return true if the set of subTasks is null or empty
     */
    public Boolean hasSubTasks() {
        return subTasks && !subTasks.isEmpty()
    }
}

{'fraction_non_alphanumeric': 0.08765763903245813, 'fraction_numerical': 0.0004134794293983874, 'mean_word_length': 2.5211062590975253, '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': '5827689', 'n_tokens_mistral': 1352, 'n_tokens_neox': 1314, 'n_words': 391}