Beispiel #1
0
        public static ITimeNode Intersect(ITimeNode left, ITimeNode right)
        {
            TimeSpan intersectionStart = TimeSpan.FromMilliseconds(Math.Max(left.StartTime.TotalMilliseconds, right.StartTime.TotalMilliseconds));
            TimeSpan intersectionEnd   = TimeSpan.FromMilliseconds(Math.Min(left.EndTime.TotalMilliseconds, right.EndTime.TotalMilliseconds));

            if (intersectionStart < intersectionEnd && intersectionStart > TimeSpan.Zero && intersectionEnd > TimeSpan.Zero)
            {
                return(new TimeNode(intersectionStart, intersectionEnd - intersectionStart));
            }

            return(Empty);
        }
Beispiel #2
0
 public void FractureAt(ITimeNode intentRelativeTime)
 {
 }
Beispiel #3
0
        private IEnumerable <IntentSegmentNode <TypeOfValue> > _GetIntersectingSegments(ITimeNode timeNode)
        {
            int segmentIndex      = _FindSegmentAt(timeNode.StartTime);
            var intentSegmentNode = _GetSegmentAtIndex(segmentIndex);

            while (intentSegmentNode != null && intentSegmentNode.StartTime < timeNode.EndTime)
            {
                yield return(intentSegmentNode);

                // There should be no gaps or overlap in the segments of an intent.
                segmentIndex++;
                intentSegmentNode = _GetSegmentAtIndex(segmentIndex);
            }
        }
Beispiel #4
0
 private bool _FilterQualifies(ISequenceFilterNode sequenceFilterNode, ITimeNode timeNode)
 {
     return(TimeNode.IntersectsExclusively(timeNode, sequenceFilterNode));
 }
Beispiel #5
0
 public IEnumerable <ISequenceFilterNode> GetFiltersForElement(Guid elementId, ITimeNode timeNode)
 {
     return(_GetQualifiedFilters(elementId, x => _FilterQualifies(x, timeNode)));
 }
Beispiel #6
0
 public static bool IntersectsInclusively(ITimeNode timeNode, TimeSpan timeSpan)
 {
     return(timeSpan >= timeNode.StartTime && timeSpan <= timeNode.EndTime);
 }
Beispiel #7
0
 public bool Intersects(ITimeNode timeNode)
 {
     return(IntersectsExclusively(timeNode.StartTime) || IntersectsExclusively(timeNode.EndTime));
 }
Beispiel #8
0
 public static bool IntersectsInclusively(ITimeNode timeNode1, ITimeNode timeNode2)
 {
     return(!(timeNode1.EndTime < timeNode2.StartTime || timeNode1.StartTime > timeNode2.EndTime));
 }
Beispiel #9
0
 public void FractureAt(ITimeNode intentRelativeTime)
 {
     FractureAt(intentRelativeTime.StartTime, intentRelativeTime.EndTime);
 }
 public void FractureAt(ITimeNode intentRelativeTime)
 {
     throw new NotImplementedException();
 }