-
Notifications
You must be signed in to change notification settings - Fork 1
/
SimpleDerivedUnit.ts
29 lines (26 loc) · 973 Bytes
/
SimpleDerivedUnit.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
* This file is part of Measurement Toolkit
*
* (c) Bas Peeters <bas@peete.rs>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import {IBaseUnit} from "./IBaseUnit";
import {IDerivedUnit} from "./IDerivedUnit";
import {ISimpleUnit} from "./ISimpleUnit";
import {SimpleBaseUnit} from "./SimpleBaseUnit";
import {SimpleUnit} from "./SimpleUnit";
export abstract class SimpleDerivedUnit extends SimpleUnit implements ISimpleUnit, IDerivedUnit {
public abstract baseUnit: SimpleBaseUnit;
protected abstract baseUnitConverter: { [key: string]: () => IBaseUnit };
public getConverters(): { [key: string]: () => ISimpleUnit } {
this.converters = {
...super.getConverters(),
...this.baseUnit.derivedUnits,
...this.baseUnit.getConverters(),
...this.baseUnitConverter,
};
return this.converters;
}
}