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");
     }
 }
Exemplo n.º 2
0
 public void RegisterDelegate(OperandType operandType, SingleOperandDelegate func)
 {
     _delegateVector[(int)operandType] = func;
 }
Exemplo n.º 3
0
 public SingleOperandFunctionVector()
 {
     _delegateVector = new SingleOperandDelegate[OperandType.GetNames(typeof(OperandType)).Length];
 }