示例#1
0
 /// <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()));
 }
示例#2
0
            /// <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);
            }
示例#3
0
            /// <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();
 }
示例#5
0
 public ITimePoint ProjectAt(ITimePoint targetTime)
 {
     return(new SimplePlaneTimePoint(PlanePosition, targetTime));
 }
示例#6
0
 public SimplePlaneTimePoint(IPlanePoint planePosition, ITimePoint timePosition) : base(planePosition)
 {
     _dateTimeValue = timePosition.AsDateTime();
 }
示例#7
0
 /// <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();
 }
示例#9
0
 /// <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));
 }
示例#10
0
 private static bool IsSameInstantAs(this ITimePoint me, ITimePoint other)
 {
     return(me.AsDateTime() == other.AsDateTime());
 }
示例#11
0
 public ITimePoint ProjectAt(ITimePoint targetTime)
 {
     return(new SimpleTimePoint(targetTime.AsDateTime()));
 }
示例#12
0
 /// <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));
 }
示例#13
0
 /// <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());
 }
示例#14
0
 /// <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);
 }
示例#16
0
 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);
 }
示例#18
0
 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);
 }
示例#20
0
 /// <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()));
 }