/// <summary> /// Adds the values of the fact fields in the two rows specified /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <returns></returns> public virtual object[] MergeFacts(object[] x, object[] y) { foreach (var f in Schema.Facts) { if (!Adders.ContainsKey(f.Value.ValueType)) { throw new InvalidOperationException(string.Format("Facts of type {0} are not supported", f.Value.ValueType)); } var ix = f.Index; x[ix] = Adders[f.Value.ValueType](x[ix], y[ix]); } return(x); }
public override IAdderService GetAdderService(int number) { return(Adders.FirstOrDefault(a => ((AbstractBaseAdderService)a).NumberToAdd == number) ?? Adders.FirstOrDefault(a => ((AbstractBaseAdderService)a).NumberToAdd == 0) ?? throw new AdditionException("Couldn't find an AdderService for this number!")); }