Skip to content

Commit

Permalink
Document LeftEndpoint and RightEndpoint (#148)
Browse files Browse the repository at this point in the history
Co-authored-by: Curtis Vogt <[email protected]>
  • Loading branch information
nicoleepp and omus authored Feb 22, 2021
1 parent 9e6ce76 commit 8474023
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 1 deletion.
57 changes: 57 additions & 0 deletions src/docstrings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,63 @@ effectively infinite).
"""
:Unbounded

"""
LeftEndpoint <: Endpoint
Represents the lower endpoint of an `AbstractInterval`. Useful for comparing two endpoints
to each other.
### Examples
```jldoctest; setup = :(using Intervals; using Intervals: LeftEndpoint)
julia> LeftEndpoint(Interval(0.0, 1.0))
Intervals.Endpoint{Float64,Intervals.Direction{:Left}(),Closed}(0.0)
julia> LeftEndpoint{Closed}(1.0)
Intervals.Endpoint{Float64,Intervals.Direction{:Left}(),Closed}(1.0)
julia> LeftEndpoint{Closed}(1) < LeftEndpoint{Closed}(2)
true
julia> LeftEndpoint{Closed}(0) < LeftEndpoint{Open}(0)
true
julia> LeftEndpoint{Open}(0) <= LeftEndpoint{Closed}(0)
false
```
See also: [`RightEndpoint`](@ref)
"""
:LeftEndpoint

"""
RightEndpoint <: Endpoint
Represents the upper endpoint of an `AbstractInterval`. Useful for comparing two endpoints
to each other.
### Examples
```jldoctest; setup = :(using Intervals; using Intervals: RightEndpoint)
julia> RightEndpoint(Interval(0.0, 1.0))
Intervals.Endpoint{Float64,Intervals.Direction{:Right}(),Closed}(1.0)
julia> RightEndpoint{Closed}(1.0)
Intervals.Endpoint{Float64,Intervals.Direction{:Right}(),Closed}(1.0)
julia> RightEndpoint{Closed}(1) < RightEndpoint{Closed}(2)
true
julia> RightEndpoint{Open}(0) < RightEndpoint{Closed}(0)
true
julia> RightEndpoint{Closed}(0) <= RightEndpoint{Open}(0)
false
```
See also: [`LeftEndpoint`](@ref)
"""
:RightEndpoint

"""
first(interval::AbstractInterval{T}) -> Union{T,Nothing}
Expand Down
1 change: 0 additions & 1 deletion src/endpoint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ struct Endpoint{T, D, B <: Bound}
end
end


Endpoint{T,D,B}(ep) where {T, D, B <: Bounded} = Endpoint{T,D,B}(convert(T, ep))

const LeftEndpoint{T,B} = Endpoint{T, Left, B} where {T,B <: Bound}
Expand Down

0 comments on commit 8474023

Please sign in to comment.