2020-04-20 20:39:30 +00:00
|
|
|
exports = class Set {
|
2020-04-20 14:00:06 +00:00
|
|
|
constructor(maxReps) {
|
2020-04-23 05:54:08 +00:00
|
|
|
this.completed = false;
|
2020-04-21 18:38:02 +00:00
|
|
|
this.minReps = 0;
|
|
|
|
this.reps = 0;
|
2020-04-23 05:54:08 +00:00
|
|
|
this.maxReps = maxReps;
|
2020-04-20 14:00:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
isCompleted() {
|
2020-04-21 18:38:02 +00:00
|
|
|
return !!this.completed;
|
2020-04-20 14:00:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
setCompleted() {
|
2020-04-21 18:38:02 +00:00
|
|
|
this.completed = true;
|
2020-04-20 14:00:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
incReps() {
|
2020-04-21 18:38:02 +00:00
|
|
|
if (this.completed) return;
|
|
|
|
if (this.reps >= this.maxReps) return;
|
|
|
|
this.reps++;
|
2020-04-20 14:00:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
decReps() {
|
2020-04-21 18:38:02 +00:00
|
|
|
if (this.completed) return;
|
|
|
|
if (this.reps <= this.minReps) return;
|
|
|
|
this.reps--;
|
2020-04-20 14:00:06 +00:00
|
|
|
}
|
|
|
|
}
|