Exemplo n.º 1
0
        public static TemporalIntervalRelation GetTemporalIntervalRelation(this SmallDateInterval x, SmallDateInterval y)
        {
            TemporalIntervalRelation relation;

            if (x.Precedes(y))
            {
                relation = TemporalIntervalRelation.Precedes;
            }
            else if (x.Meets(y))
            {
                relation = TemporalIntervalRelation.Meets;
            }
            else if (x.OverlapsWith(y))
            {
                relation = TemporalIntervalRelation.OverlapsWith;
            }
            else if (x.Starts(y))
            {
                relation = TemporalIntervalRelation.Starts;
            }
            else if (x.During(y))
            {
                relation = TemporalIntervalRelation.During;
            }
            else if (x.Finishes(y))
            {
                relation = TemporalIntervalRelation.Finishes;
            }
            else if (x.IsPrecededBy(y))
            {
                relation = TemporalIntervalRelation.IsPrecededBy;
            }
            else if (x.IsMetBy(y))
            {
                relation = TemporalIntervalRelation.IsMetBy;
            }
            else if (x.IsOverlappedBy(y))
            {
                relation = TemporalIntervalRelation.IsOverlappedBy;
            }
            else if (x.IsStartedBy(y))
            {
                relation = TemporalIntervalRelation.IsStartedBy;
            }
            else if (Contains(x, y))
            {
                relation = TemporalIntervalRelation.Contains;
            }
            else if (x.IsFinishedBy(y))
            {
                relation = TemporalIntervalRelation.IsFinishedBy;
            }
            else if (x.IsEqualTo(y))
            {
                relation = TemporalIntervalRelation.IsEqualTo;
            }
            else
            {
                throw new InvalidOperationException();
            }

            return(relation);
        }