import { RelationalOperator } from './relational-operator';
export class ConditionHelper {
    static isSatisfied(operator, operand, value) {
        // TODO 考虑浮点数比较问题。
        switch (+operator) {
            case RelationalOperator.Equal:
                return value === operand;
            case RelationalOperator.GreaterOrEqual:
                return value >= operand;
            case RelationalOperator.GreaterThan:
                return value > operand;
            case RelationalOperator.LessOrEqual:
                return value <= operand;
            case RelationalOperator.LessThan:
                return value < operand;
            case RelationalOperator.NotEqual:
                return value !== operand;
            default:
                throw new Error(`Unknown RelationalOperator:${operator}.`);
        }
    }
}
