2019-05-12 20:25:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
export default class Direction {
|
|
|
|
constructor(isForward) {
|
|
|
|
this._isForward = isForward;
|
|
|
|
}
|
|
|
|
|
|
|
|
get isForward() {
|
|
|
|
return this._isForward;
|
|
|
|
}
|
|
|
|
|
|
|
|
get isBackward() {
|
|
|
|
return !this.isForward;
|
|
|
|
}
|
|
|
|
|
|
|
|
asApiString() {
|
|
|
|
return this.isForward ? "f" : "b";
|
|
|
|
}
|
|
|
|
|
2020-03-28 16:14:48 +01:00
|
|
|
reverse() {
|
|
|
|
return this.isForward ? Direction.Backward : Direction.Forward
|
|
|
|
}
|
|
|
|
|
2019-05-12 20:25:41 +02:00
|
|
|
static get Forward() {
|
|
|
|
return _forward;
|
|
|
|
}
|
|
|
|
|
|
|
|
static get Backward() {
|
|
|
|
return _backward;
|
|
|
|
}
|
|
|
|
}
|
2019-06-02 00:49:47 +02:00
|
|
|
|
|
|
|
const _forward = Object.freeze(new Direction(true));
|
|
|
|
const _backward = Object.freeze(new Direction(false));
|