コード例 #1
0
ファイル: ItcEvent.cs プロジェクト: weeble/ohos
 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));
 }