struct HalfOpenInterval<Bound : Comparable>
Inheritance |
CustomDebugStringConvertible, CustomStringConvertible, Equatable, IntervalType, _Reflectable
View Protocol Hierarchy →
|
---|---|
Import | import Swift |
Initializers
Construct an interval with the given bounds.
Requires: start <= end
.
Declaration
init(_ start: Bound, _ end: Bound)
Instance Variables
A textual representation of self
, suitable for debugging.
Declaration
var debugDescription: String { get }
A textual representation of self
.
Declaration
var description: String { get }
The Interval
's upper bound.
Invariant: start
<= end
.
Declaration
var end: Bound { get }
The Interval
's lower bound.
Invariant: start
<= end
.
Declaration
var start: Bound { get }
Instance Methods
Returns intervalToClamp
clamped to self
.
The bounds of the result, even if it is empty, are always limited to the bounds of
self
.
Declaration
func clamp(intervalToClamp: HalfOpenInterval<Bound>) -> HalfOpenInterval<Bound>
Returns true
iff the Interval
contains x
.
Declaration
func contains(x: Bound) -> Bool
Returns true
if lhs
and rhs
have a non-empty intersection.
Declaration
func overlaps<I : IntervalType where I.Bound == Bound>(other: I) -> Bool
Declared In
IntervalType
A half-open
IntervalType
, which contains itsstart
but not itsend
. Can represent an empty interval.Bound
: The type of the endpoints.