protocol IntervalType

An interval over a Comparable type.

Inheritance View Protocol Hierarchy →
Associated Types
Bound : Comparable

The type of the Interval's endpoints

Import import Swift

Instance Variables

var end: Bound Required

The Interval's upper bound. Invariant: start <= end


var end: Bound { get }
var isEmpty: Bool Required

True iff self is empty


var isEmpty: Bool { get }
var start: Bound Required

The Interval's lower bound. Invariant: start <= end


var start: Bound { get }

Instance Methods

func clamp(_:) Required

Return rhs clamped to self. The bounds of the result, even if it is empty, are always within the bounds of self


func clamp(intervalToClamp: Self) -> Self
func contains(_:) Required

Returns true iff the interval contains value


func contains(value: Bound) -> Bool