Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improves the doc #44

Merged
merged 4 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct EmptyDomain <: AbstractDomain end

"""
domain()
Construct an [`EmptyDomain`](@ref).
Construct an `EmptyDomain`.
"""
domain() = EmptyDomain()

Expand Down
14 changes: 0 additions & 14 deletions src/continuous.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ end
domain(a::Tuple{T, Bool}, b::Tuple{T, Bool}) where {T <: Real}
domain(intervals::Vector{Tuple{Tuple{T, Bool},Tuple{T, Bool}}}) where {T <: Real}
Construct a domain of continuous interval(s).
```julia
d1 = domain((0., true), (1., false)) # d1 = [0, 1)
d2 = domain([ # d2 = [0, 1) ∪ (3.5, 42]
(0., true), (1., false),
(3.5, false), (42., true),
])
"""
function domain(intervals::Vector{Interval{T,L,R}}) where {T<:Real,L,R}
return Intervals(map(i -> Interval(i), intervals))
Expand Down Expand Up @@ -102,14 +96,6 @@ Compute the intersections of a domain with an interval and store the results in
- `is::IS`: a collection of intervals.
- `i::I`: an interval.
- `new_itvls::Vector{I}`: a vector to store the results.

## Examples
```julia
is = domain([Interval(0, 1), Interval(3.5, 42)])
i = Interval(0.5, 1.5)
new_itvls = Vector{Interval}()
intersect_domains!(is, i, new_itvls)
```
"""
function intersect_domains!(is::IS, i::I, new_itvls) where {IS<:Intervals,I<:Interval}
for interval in get_domain(is)
Expand Down
4 changes: 2 additions & 2 deletions src/discrete.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ SetDomain(values) = SetDomain(Set(values))

"""
RangeDomain
A discrete domain defined by a `range <: AbstractRange{Real}`. As ranges are immutable in Julia, changes in `RangeDomain` must use [`set_domain!`](@ref).
A discrete domain defined by a `range <: AbstractRange{Real}`. As ranges are immutable in Julia, changes in `RangeDomain` must use `set_domain!`.
"""
struct RangeDomain{T<:Real,R<:AbstractRange{T}} <: DiscreteDomain{T}
domain::R
Expand All @@ -31,7 +31,7 @@ ArbitraryDomain(elements) = ArbitraryDomain(Set(elements))
"""
domain(values)
domain(range::R) where {T <: Real, R <: AbstractRange{T}}
Construct either a [`SetDomain`](@ref) or a [RangeDomain](@ref).
Construct either a `SetDomain` or a `RangeDomain``.
```julia
d1 = domain(1:5)
d2 = domain([53.69, 89.2, 0.12])
Expand Down
Loading