This commit is contained in:
Felix Roos 2022-03-19 19:30:29 +01:00
parent aec5b3bb2b
commit 3c56f24eed
7 changed files with 681 additions and 2169 deletions

View file

@ -23,42 +23,6 @@ export function curry(func, overload) {
}
return fn;
}
Fraction.prototype.sam = function() {
return this.floor();
};
Fraction.prototype.nextSam = function() {
return this.sam().add(1);
};
Fraction.prototype.wholeCycle = function() {
return new TimeSpan(this.sam(), this.nextSam());
};
Fraction.prototype.lt = function(other) {
return this.compare(other) < 0;
};
Fraction.prototype.gt = function(other) {
return this.compare(other) > 0;
};
Fraction.prototype.lte = function(other) {
return this.compare(other) <= 0;
};
Fraction.prototype.gte = function(other) {
return this.compare(other) >= 0;
};
Fraction.prototype.eq = function(other) {
return this.compare(other) == 0;
};
Fraction.prototype.max = function(other) {
return this.gt(other) ? this : other;
};
Fraction.prototype.min = function(other) {
return this.lt(other) ? this : other;
};
Fraction.prototype.show = function() {
return this.s * this.n + "/" + this.d;
};
Fraction.prototype.or = function(other) {
return this.eq(0) ? other : this;
};
class TimeSpan {
constructor(begin, end) {
this.begin = Fraction(begin);