/// <summary> /// /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <returns></returns> public static IQuantity Max(IQuantity x, IQuantity y) { if (x == null && y != null) { return((IQuantity)y.Clone()); } if (y == null && x != null) { return((IQuantity)x.Clone()); } if (x == null) { return(null); } if ((Quantity)x < y) { return((IQuantity)y.Clone()); } if ((Quantity)x > y) { return((IQuantity)x.Clone()); } return((IQuantity)x.Clone()); }
/// <summary> /// Internal Constructor /// </summary> /// <param name="request"></param> /// <param name="elapsedQty"></param> /// <param name="currentQty"></param> /// <param name="startingQty"></param> /// <param name="remainingQty"></param> internal TimerElapsedEventArgs(TimerRequest request, IQuantity elapsedQty, IQuantity currentQty, IQuantity startingQty, IQuantity remainingQty) : base(request, elapsedQty, currentQty) { StartingQty = (IQuantity)startingQty.Clone(); RemainingQty = (IQuantity)remainingQty.Clone(); }
/// <summary> /// Internal Constructor /// </summary> /// <param name="request"></param> /// <param name="elapsedQty"></param> /// <param name="currentQty"></param> protected ElapsedEventArgsBase(TRequest request, IQuantity elapsedQty, IQuantity currentQty) { Request = request; ElapsedQty = (IQuantity)elapsedQty.Clone(); CurrentQty = (IQuantity)currentQty.Clone(); }
/// <summary> /// /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <returns></returns> public static IQuantity Min(IQuantity x, IQuantity y) { if (x == null && y != null) return (IQuantity) y.Clone(); if (y == null && x != null) return (IQuantity) x.Clone(); if (x == null) return null; if ((Quantity) x > y) return (IQuantity) y.Clone(); if ((Quantity) x < y) return (IQuantity) x.Clone(); return (IQuantity) x.Clone(); }
/* TODO: TBD: increment/decrement? Direction? continuous/latching? or leave the previous state alone? * "Next" almost needs to include Direction + steps and that's it. Some of which is internal state, * or instantaneous, as necessary. */ /// <summary> /// Increments the timer clock by one <see cref="RequestType.Instantaneous"/> step. /// </summary> public void Increment() { Increment(1, (IQuantity)_timePerStepQty.Clone(), RequestType.Instantaneous); }