public void RegisterOverload(string operatorName, OperandType type, SingleOperandDelegate func) { if (Operators.TryGetValue(operatorName, out IOperator op)) { if (op.Type == OperatorType.UnaryOperator) { OperatorVectors[op].RegisterDelegate(type, func); } else { throw new ExpressionParserException(-1, ExpressionParserException.ExceptionCause.UnaryOperatorNotFound, "'" + operatorName + "' is not a unary operator"); } } else { throw new ExpressionParserException(-1, ExpressionParserException.ExceptionCause.UnaryOperatorNotFound, "'" + operatorName + "' is not a registered operator"); } }
public void RegisterDelegate(OperandType operandType, SingleOperandDelegate func) { _delegateVector[(int)operandType] = func; }
public SingleOperandFunctionVector() { _delegateVector = new SingleOperandDelegate[OperandType.GetNames(typeof(OperandType)).Length]; }