Task
Entities Definition
This file defines the task structure within the Roll Claw domain model.
Implementation
Task Definition
File: domain/entities/task.pseudo
// Task Entities
class Task {
// Identity
string id
string description
// Properties
TaskType type
TaskPriority priority
TaskStatus status
Date dueDate
Date completedDate
Person assignedTo
Equipment relatedEquipment // optional
Cat relatedCat // optional
boolean isRecurring
string frequency // if recurring
string notes
// Methods
function markInProgress(Date date, Person by)
function markCompleted(Date date, Person by)
function reschedule(Date newDueDate)
function cancel(string reason)
function isDue(Date currentDate)
function generateNextTask() // for recurring tasks
}
// Specialized Task subclasses
class WaterCheck extends Task {
// Properties
WaterSource waterSource
float levelFound // percentage full
boolean wasRefilled
// Constructor
constructor(WaterSource source) {
super("Check water level", "daily", source, false, null, true)
this.waterSource = source
}
// Methods
function markCompleted(Date completionDate, float level, boolean refilled)
}
class FoodCheck extends Task {
// Properties
FoodSource foodSource
float levelFound // cups or percentage full
boolean wasRefilled
float amountAddedCups
FoodSource.FoodType foodTypeAdded
// Constructor
constructor(FoodSource source) {
string frequency = source.feedingMode == FoodSource.FeedingMode.AUTOMATIC ?
"every few days" : "daily"
super("Check food level", frequency, source, false, null, true)
this.foodSource = source
}
// Methods
function markCompleted(Date completionDate, float level, boolean refilled,
float amountAdded, FoodSource.FoodType typeAdded)
}
class LitterBoxCheck extends Task {
// Properties
LitterBox litterBox
boolean wasScooped
boolean wasEmptied
boolean wasDeepCleaned
boolean wasLitterChanged
LitterBox.LitterType newLitterType
// Constructor
constructor(LitterBox box) {
super("Check litter box", "daily", box, false, null, true)
this.litterBox = box
}
// Methods
function markCompleted(Date completionDate, boolean scooped, boolean emptied,
boolean deepCleaned, boolean litterChanged,
LitterBox.LitterType newType)
}
class LitterBoxDeepClean extends Task {
// Properties
LitterBox litterBox
// Constructor
constructor(LitterBox box) {
super("Deep clean litter box", "every 8 weeks", box, false, null, false)
this.litterBox = box
}
}
Related Components
- See the Domain Model Overview for more information on how this component fits into the overall domain model.