Subject | Hash | Author | Date (UTC) |
---|---|---|---|
NumericWrapper is to hold a number. Go figure. | 2daf55f2e94126859ed26bdc9cb9e4e3f33541eb | Carroll | 2018-06-24 02:05:19 |
Wrapper is the base class for this package. | 552caf51d2c7e4400dafe788e632972cd860b97e | Carroll | 2018-06-24 02:03:47 |
Uploading metadata | 6ec5ca0bf2000ad865e4f64ddc26e2e64a0d6a99 | Carroll | 2018-06-24 02:02:09 |
File | Lines added | Lines deleted |
---|---|---|
lib/wrappers/NumericWrapper.d.ts | 20 | 0 |
lib/wrappers/NumericWrapper.js | 36 | 0 |
src/wrappers/NumericWrapper.ts | 35 | 0 |
File lib/wrappers/NumericWrapper.d.ts added (mode: 100644) (index 0000000..3ca76ec) | |||
1 | import { Wrapper } from "./Wrapper"; | ||
2 | /** | ||
3 | * Stores numeric information in a wrapper, and provides ways to modify the value | ||
4 | */ | ||
5 | export declare class NumericWrapper extends Wrapper { | ||
6 | /** Numeric value that is saved*/ | ||
7 | value: number; | ||
8 | /** Creates a new instance of wrapper with the given value */ | ||
9 | constructor(value: any); | ||
10 | /** Add the other Wrapper to this one */ | ||
11 | addOther(other: NumericWrapper): void; | ||
12 | /** Subtract the other Wrapper from this one */ | ||
13 | subtractOther(other: NumericWrapper): void; | ||
14 | /** Multiplies this value by the specified amount */ | ||
15 | multiplyBy(value: number): void; | ||
16 | /** Divides this value by the specified amount */ | ||
17 | divideBy(value: number): void; | ||
18 | /** Applies the exponent */ | ||
19 | applyExponent(value: number): void; | ||
20 | } |
File lib/wrappers/NumericWrapper.js added (mode: 100644) (index 0000000..3a3292d) | |||
1 | "use strict"; | ||
2 | Object.defineProperty(exports, "__esModule", { value: true }); | ||
3 | const Wrapper_1 = require("./Wrapper"); | ||
4 | /** | ||
5 | * Stores numeric information in a wrapper, and provides ways to modify the value | ||
6 | */ | ||
7 | class NumericWrapper extends Wrapper_1.Wrapper { | ||
8 | /** Creates a new instance of wrapper with the given value */ | ||
9 | constructor(value) { | ||
10 | super(value); | ||
11 | /** Numeric value that is saved*/ | ||
12 | this.value = 0; | ||
13 | } | ||
14 | /** Add the other Wrapper to this one */ | ||
15 | addOther(other) { | ||
16 | this.value += other.value; | ||
17 | } | ||
18 | /** Subtract the other Wrapper from this one */ | ||
19 | subtractOther(other) { | ||
20 | this.value -= other.value; | ||
21 | } | ||
22 | /** Multiplies this value by the specified amount */ | ||
23 | multiplyBy(value) { | ||
24 | this.value *= value; | ||
25 | } | ||
26 | /** Divides this value by the specified amount */ | ||
27 | divideBy(value) { | ||
28 | this.value /= value; | ||
29 | } | ||
30 | /** Applies the exponent */ | ||
31 | applyExponent(value) { | ||
32 | (_a = this).value = Math.pow(_a.value, value); | ||
33 | var _a; | ||
34 | } | ||
35 | } | ||
36 | exports.NumericWrapper = NumericWrapper; |
File src/wrappers/NumericWrapper.ts added (mode: 100644) (index 0000000..4d6532c) | |||
1 | import { Wrapper } from "./Wrapper" | ||
2 | |||
3 | /** | ||
4 | * Stores numeric information in a wrapper, and provides ways to modify the value | ||
5 | */ | ||
6 | export class NumericWrapper extends Wrapper { | ||
7 | /** Numeric value that is saved*/ | ||
8 | value: number = 0 | ||
9 | |||
10 | /** Creates a new instance of wrapper with the given value */ | ||
11 | constructor(value: any) { | ||
12 | super(value) | ||
13 | } | ||
14 | |||
15 | /** Add the other Wrapper to this one */ | ||
16 | addOther(other: NumericWrapper) { | ||
17 | this.value += other.value | ||
18 | } | ||
19 | /** Subtract the other Wrapper from this one */ | ||
20 | subtractOther(other: NumericWrapper) { | ||
21 | this.value -= other.value | ||
22 | } | ||
23 | /** Multiplies this value by the specified amount */ | ||
24 | multiplyBy(value: number) { | ||
25 | this.value *= value | ||
26 | } | ||
27 | /** Divides this value by the specified amount */ | ||
28 | divideBy(value: number) { | ||
29 | this.value /= value | ||
30 | } | ||
31 | /** Applies the exponent */ | ||
32 | applyExponent(value: number) { | ||
33 | this.value **= value | ||
34 | } | ||
35 | } |