IntervalRelation

public enum IntervalRelation : InvertibleEnum

Implementation of Allen’s Interval Algebra.

Background

From Thomas A. Alspaugh:

In 1983 James F. Allen published a paper in which he proposed thirteen basic relations between time intervals that are distinct, exhaustive, and qualitative.

  • Distinct because no pair of definite intervals can be related by more than one of the relationships
  • Exhaustive because any pair of definite intervals are described by one of the relations
  • Qualitative (rather than quantitative) because no numeric time spans are considered

The naming conventions used in this implementation are those of Allen, refined by Krokhin et al..

Cases

  • x precedes y

    x: |---|
    y:       |---|
    

    Declaration

    Swift

    case precedes
  • x meets y

    x: |----|
    y:      |----|
    

    Declaration

    Swift

    case meets
  • x overlaps y

    x: |------|
    y:    |------|
    

    Declaration

    Swift

    case overlaps
  • x is finished by y

    x: |---------|
    y:      |----|
    

    Declaration

    Swift

    case finishedBy
  • x contains y

    x: |----------|
    y:    |----|
    

    Declaration

    Swift

    case contains
  • x starts y

    x: |-----|
    y: |----------|
    

    Declaration

    Swift

    case starts
  • x equals y

    x: |----------|
    y: |----------|
    

    Declaration

    Swift

    case equals
  • x is started by y

    x: |----------|
    y: |-----|
    

    Declaration

    Swift

    case startedBy
  • x is contained by y

    x:    |----|
    y: |----------|
    

    Declaration

    Swift

    case containedBy
  • x finishes y

    x:      |-----|
    y: |----------|
    

    Declaration

    Swift

    case finishes
  • x is overlapped by y

    x:    |------|
    y: |------|
    

    Declaration

    Swift

    case overlappedBy
  • x is met by y

    x:      |----|
    y: |----|
    

    Declaration

    Swift

    case metBy
  • x is preceded by y

    x:       |---|
    y: |---|
    

    Declaration

    Swift

    case precededBy