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)); }
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); } }
public UniOperandVariable(UniOperand operand, Variable a) { this.operand = operand; this.a = a; }