public static ItcEvent Tree(int aValue, ItcEvent aLeft, ItcEvent aRight) { var leftSingle = aLeft as ItcEventSingle; var rightSingle = aRight as ItcEventSingle; if (leftSingle != null && rightSingle != null && leftSingle.Min == rightSingle.Min) { return new ItcEventSingle(aValue + leftSingle.Min); } int sinkAmount = Math.Min(aLeft.Min, aRight.Min); return new ItcEventTree(aValue + sinkAmount, aLeft.Sink(sinkAmount), aRight.Sink(sinkAmount)); }