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

            if (x.Before(y))
            {
                relation = TemporalIntervalRelation.Before;
            }
            else if (x.Meets(y))
            {
                relation = TemporalIntervalRelation.Meets;
            }
            else if (x.Overlaps(y))
            {
                relation = TemporalIntervalRelation.Overlaps;
            }
            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.Equal(y))
            {
                relation = TemporalIntervalRelation.Equal;
            }
            else if (x.After(y))
            {
                relation = TemporalIntervalRelation.After;
            }
            else if (x.MetBy(y))
            {
                relation = TemporalIntervalRelation.MetBy;
            }
            else if (x.OverlappedBy(y))
            {
                relation = TemporalIntervalRelation.OverlappedBy;
            }
            else if (x.StartedBy(y))
            {
                relation = TemporalIntervalRelation.StartedBy;
            }
            else if (x.Contains(y))
            {
                relation = TemporalIntervalRelation.Contains;
            }
            else if (x.FinishedBy(y))
            {
                relation = TemporalIntervalRelation.FinishedBy;
            }
            else
            {
                throw new InvalidOperationException();
            }

            return(relation);
        }
Exemplo n.º 2
0
 public static bool OverlappedBy(this SmallTimeInterval x, SmallTimeInterval y) => y.Overlaps(x);