Example #1
0
    public static TemporalIntervalRelation GetTemporalIntervalRelation(this SmallTimeInterval x, SmallTimeInterval y)
    {
        TemporalIntervalRelation relation;

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

        return(relation);
    }
Example #2
0
 public static bool MetBy(this SmallTimeInterval x, SmallTimeInterval y) => y.Meets(x);