Skip to content

Commit

Permalink
Improves the doc (#44)
Browse files Browse the repository at this point in the history
* Improves the doc

* Update doc

* Fix a docstrings
  • Loading branch information
Azzaare authored Mar 26, 2024
1 parent 5d95b0c commit 82c0b25
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 17 deletions.
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

0 comments on commit 82c0b25

Please sign in to comment.