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)); }
public override ItcEvent Join(ItcEvent aOther) { var otherSingle = aOther as ItcEventSingle; if (otherSingle != null) { if (otherSingle.iValue > iValue) { return otherSingle; } return this; } return aOther.Join(this); }
public override bool Leq(ItcEvent aOther) { return iValue <= aOther.Min; }
public override ItcEvent Join(ItcEvent aOther) { return Tree( 0, Left.Join(aOther.Left), Right.Join(aOther.Right)); }
public override bool Leq(ItcEvent aOther) { return iValue <= aOther.Min && Left.Leq(aOther.Left) && Right.Leq(aOther.Right); }
internal override ItcEvent InternalGrow(ItcEvent.ItcEventTree aEvent, out long aCost) { return aEvent.InternalGrow(iLeft, iRight, out aCost); }
public ItcEventTree(int aValue, ItcEvent aLeft, ItcEvent aRight) : base(aValue) { iLeft = aLeft; iRight = aRight; }
internal override ItcEvent InternalGrow(ItcEvent.ItcEventTree aEvent, out long aCost) { throw new InvalidOperationException("Tried to Grow when Fill would have worked."); }
internal ItcStamp(ItcId aId, ItcEvent aEvent) { iId = aId; iEvent = aEvent; }
internal abstract ItcEvent InternalGrow(ItcEvent.ItcEventTree aEvent, out long aCost);
public override ItcEvent Fill(ItcEvent aEvent) { return ItcEvent.Single(aEvent.Max); }
public abstract ItcEvent Fill(ItcEvent aEvent);
internal override ItcEvent InternalGrow(ItcEvent.ItcEventTree aEvent, out long aCost) { throw new InvalidOperationException("Anonymous clocks cannot Grow."); }
public override ItcEvent Fill(ItcEvent aEvent) { return aEvent; }
public abstract ItcEvent Join(ItcEvent aOther);
public static ItcStamp Anonymous(ItcEvent aEvent) { return new ItcStamp(ItcId.Zero, aEvent); }
public abstract bool Leq(ItcEvent aOther);
public override ItcEvent Fill(ItcEvent aEvent) { return aEvent.Fill(iLeft, iRight); }