コード例 #1
0
 public Primitive PerformOperation(UniOperand type, Primitive a)
 {
     if (!UniOperations.ContainsKey(type) ||
         !UniOperations[type].ContainsKey(a.GetPrimitiveType()))
     {
         throw new Exception("Cannot perform operation: " + type + " on type: " + a.GetPrimitiveType());
     }
     return(UniOperations[type][a.GetPrimitiveType()](a));
 }
コード例 #2
0
 void AddUniOperation <T>(UniOperand type, Func <T, object> resolver)
 {
     if (!UniOperations.ContainsKey(type))
     {
         UniOperations[type] = new Dictionary <Return, UniOperation>();
     }
     foreach (Return a in GetTypes(typeof(T)))
     {
         UniOperations[type][a] = SimpleUniOperand(resolver);
     }
 }
コード例 #3
0
 public UniOperandVariable(UniOperand operand, Variable a)
 {
     this.operand = operand;
     this.a       = a;
 }