LongoMatch.Core.Store.TimeNode.Intersect C# (CSharp) Method

Intersect() public method

public Intersect ( TimeNode tn ) : TimeNode
tn TimeNode
return TimeNode
        public TimeNode Intersect(TimeNode tn)
        {
            if (tn.Stop == null || tn.Start == null || Start == null || Stop == null)
                return null;
            if (tn.Stop <= Start || tn.Start >= Stop)
                return null;
            else
                return new TimeNode {
                    Start = new Time (Math.Max (Start.MSeconds, tn.Start.MSeconds)),
                    Stop = new Time (Math.Min (Stop.MSeconds, tn.Stop.MSeconds))
                };
        }