2023-11-13 09:58:43 +08:00
|
|
|
|
abstract class AbstractCalculator {
|
|
|
|
|
/**
|
|
|
|
|
* @descCN 计算两数的和,例如:1 + 2
|
|
|
|
|
* @descEN Calculate the sum of two numbers, e.g. 1 + 2
|
|
|
|
|
*/
|
2023-11-08 14:56:15 +08:00
|
|
|
|
abstract add(num: number | string | AbstractCalculator): this;
|
2023-11-06 10:31:51 +08:00
|
|
|
|
|
2023-11-13 09:58:43 +08:00
|
|
|
|
/**
|
|
|
|
|
* @descCN 计算两数的差,例如:1 - 2
|
|
|
|
|
* @descEN Calculate the difference between two numbers, e.g. 1 - 2
|
|
|
|
|
*/
|
2023-11-08 14:56:15 +08:00
|
|
|
|
abstract sub(num: number | string | AbstractCalculator): this;
|
2023-11-06 10:31:51 +08:00
|
|
|
|
|
2023-11-13 09:58:43 +08:00
|
|
|
|
/**
|
|
|
|
|
* @descCN 计算两数的积,例如:1 * 2
|
|
|
|
|
* @descEN Calculate the product of two numbers, e.g. 1 * 2
|
|
|
|
|
*/
|
2023-11-08 14:56:15 +08:00
|
|
|
|
abstract mul(num: number | string | AbstractCalculator): this;
|
2023-11-06 10:31:51 +08:00
|
|
|
|
|
2023-11-13 09:58:43 +08:00
|
|
|
|
/**
|
|
|
|
|
* @descCN 计算两数的商,例如:1 / 2
|
|
|
|
|
* @descEN Calculate the quotient of two numbers, e.g. 1 / 2
|
|
|
|
|
*/
|
2023-11-08 14:56:15 +08:00
|
|
|
|
abstract div(num: number | string | AbstractCalculator): this;
|
2023-11-06 10:31:51 +08:00
|
|
|
|
|
2023-11-13 09:58:43 +08:00
|
|
|
|
/**
|
|
|
|
|
* @descCN 获取计算结果
|
|
|
|
|
* @descEN Get the calculation result
|
|
|
|
|
*/
|
2023-11-10 14:54:16 +08:00
|
|
|
|
abstract equal(options?: { unit?: boolean }): string | number;
|
2023-11-06 10:31:51 +08:00
|
|
|
|
}
|
2023-11-13 09:58:43 +08:00
|
|
|
|
|
|
|
|
|
export default AbstractCalculator;
|