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); }
public void FractureAt(ITimeNode intentRelativeTime) { }
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); } }
private bool _FilterQualifies(ISequenceFilterNode sequenceFilterNode, ITimeNode timeNode) { return(TimeNode.IntersectsExclusively(timeNode, sequenceFilterNode)); }
public IEnumerable <ISequenceFilterNode> GetFiltersForElement(Guid elementId, ITimeNode timeNode) { return(_GetQualifiedFilters(elementId, x => _FilterQualifies(x, timeNode))); }
public static bool IntersectsInclusively(ITimeNode timeNode, TimeSpan timeSpan) { return(timeSpan >= timeNode.StartTime && timeSpan <= timeNode.EndTime); }
public bool Intersects(ITimeNode timeNode) { return(IntersectsExclusively(timeNode.StartTime) || IntersectsExclusively(timeNode.EndTime)); }
public static bool IntersectsInclusively(ITimeNode timeNode1, ITimeNode timeNode2) { return(!(timeNode1.EndTime < timeNode2.StartTime || timeNode1.StartTime > timeNode2.EndTime)); }
public void FractureAt(ITimeNode intentRelativeTime) { FractureAt(intentRelativeTime.StartTime, intentRelativeTime.EndTime); }
public void FractureAt(ITimeNode intentRelativeTime) { throw new NotImplementedException(); }