Exemple #1
0
 static bool doTimeLinesCollide(TimeLine TimelineA, TimeLine TimelineB)
 {
     return TimelineA.doesTimeLineInterfere(TimelineB) || TimelineB.doesTimeLineInterfere(TimelineA);
 }
Exemple #2
0
        public TimeLine InterferringTimeLine(TimeLine PossibleTimeLine)
        {
            DateTime InterferringStarTime;
            DateTime InterferringEndTime;
            if ((this.Start == PossibleTimeLine.Start) && (this.End == PossibleTimeLine.End))//checks if both "this and "PossibleTimeLine" are within the same range
            {
                return this.CreateCopy();
            }

            if (this.doesTimeLineInterfere(PossibleTimeLine))
            {
                InterferringStarTime = PossibleTimeLine.Start;
                if (this.Start > PossibleTimeLine.Start)
                {
                    InterferringStarTime = this.Start;
                }

                InterferringEndTime = this.End;
                if (this.End > PossibleTimeLine.End)
                {
                    InterferringEndTime = PossibleTimeLine.End;
                }

                return new TimeLine(InterferringStarTime, InterferringEndTime);
            }
            else
            {
                if (PossibleTimeLine.doesTimeLineInterfere(this))
                return PossibleTimeLine.InterferringTimeLine(this);//checks if PossibleTimeLine is the same as or bigger than "this" timeline
            }

            return null;
        }