/// <summary>The absolute value of the movement in time between first and second.</summary> public static IDuration Between(ITimePoint first, ITimePoint second) { if (first.IsAfterOrSameInstantAs(second)) { return(FromTimeSpan(first.AsDateTime() - second.AsDateTime())); } return(FromTimeSpan(second.AsDateTime() - first.AsDateTime())); }
/// <summary> /// Removes the given item from the collection /// </summary> /// <returns>True, if the item was removed, otherwise False</returns> /// <param name="item">The item that should be removed</param> public override bool Remove(IModelElement item) { if ((this._parent.ScheduleInterval == item)) { this._parent.ScheduleInterval = null; return(true); } ITimePoint timePointItem = item.As <ITimePoint>(); if (((timePointItem != null) && this._parent.TimePoints.Remove(timePointItem))) { return(true); } return(false); }
/// <summary> /// Adds the given element to the collection /// </summary> /// <param name="item">The item to add</param> public override void Add(IModelElement item) { if ((this._parent.ScheduleInterval == null)) { IDateTimeInterval scheduleIntervalCasted = item.As <IDateTimeInterval>(); if ((scheduleIntervalCasted != null)) { this._parent.ScheduleInterval = scheduleIntervalCasted; return; } } ITimePoint timePointsCasted = item.As <ITimePoint>(); if ((timePointsCasted != null)) { this._parent.TimePoints.Add(timePointsCasted); } }
public SimplePlaneTimePoint(IPlanePoint planePosition, ITimePoint timePosition) : base(planePosition) { _dateTimeValue = timePosition.AsDateTime(); }
public ITimePoint ProjectAt(ITimePoint targetTime) { return(new SimplePlaneTimePoint(PlanePosition, targetTime)); }
/// <summary>Returns the <see cref="ITimePoint"/> resulting from offsetting <paramref name="me"/> by the smallest possible <see cref="ITimeMovement"/> forward in time.</summary> public static ITimePoint NextInstant(this ITimePoint me) { return(me.Offset(Duration.MinValue)); }
public SimpleTimeInterval(ITimePoint timeCoordinate, IDuration duration) { TimePosition = timeCoordinate; TimeSpanValue = duration.AsTimeSpan(); }
/// <summary>True if <see cref="LastInstantBefore"/> is before <paramref name="point"/> and <see cref="FirstInstantAfter"/> is after <paramref name="point"/></summary> public static bool Contains(this ITimeInterval me, ITimePoint point) { return(me.LastInstantBefore().IsBefore(point) && me.FirstInstantAfter().IsAfter(point)); }
private static bool IsSameInstantAs(this ITimePoint me, ITimePoint other) { return(me.AsDateTime() == other.AsDateTime()); }
public ITimePoint ProjectAt(ITimePoint targetTime) { return(new SimpleTimePoint(targetTime.AsDateTime())); }
/// <summary>True if <paramref name="me"/> is placed after or on the same point as <paramref name="other"/> on the timeline.</summary> public static bool IsAfterOrSameInstantAs(this ITimePoint me, ITimePoint other) { return(!me.IsBefore(other)); }
/// <summary>True if <paramref name="me"/> is placed after <paramref name="other"/> on the timeline.</summary> public static bool IsAfter(this ITimePoint me, ITimePoint other) { return(me.AsDateTime() > other.AsDateTime()); }
/// <summary>True if <paramref name="me"/> is placed before <paramref name="other"/> on the timeline.</summary> public static bool IsBefore(this ITimePoint me, ITimePoint other) { return(me.AsDateTime() < other.AsDateTime()); }
public ITimePoint ProjectAt(ITimePoint targetTime) { return new SimplePlaneTimePoint(PlanePosition, targetTime); }
/// <summary>True if <see cref="LastInstantBefore"/> is before <paramref name="point"/> and <see cref="FirstInstantAfter"/> is after <paramref name="point"/></summary> public static bool Contains(this ITimeInterval me, ITimePoint point) { return me.LastInstantBefore().IsBefore(point) && me.FirstInstantAfter().IsAfter(point); }
private static SimpleTimeInterval NewTimeInterval(ITimePoint startingPoint, IDuration duration) { return(new SimpleTimeInterval(startingPoint, duration)); }
private static SimpleTimeInterval NewTimeInterval(ITimePoint startingPoint, IDuration duration) { return new SimpleTimeInterval(startingPoint, duration); }
/// <summary>Returns the <see cref="ITimePoint"/> resulting from offsetting <paramref name="me"/> by the smallest possible <see cref="ITimeMovement"/> backward in time.</summary> public static ITimePoint PreviousInstant(this ITimePoint me) { return(me.Offset(Duration.MinValue.Negate())); }