Skip to content

Commit

Permalink
improve Part domains
Browse files Browse the repository at this point in the history
  • Loading branch information
joshday committed Mar 16, 2020
1 parent fdfa2f5 commit 573ba8a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "OnlineStatsBase"
uuid = "925886fa-5bf2-5e8e-b522-a9147a512338"
version = "1.2.0"
version = "1.2.1"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand Down
5 changes: 3 additions & 2 deletions src/part.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#-----------------------------------------------------------------------------# Part
struct Part{D, O} <: OnlineStat{TwoThings}
struct Part{D, O<:OnlineStat} <: OnlineStat{TwoThings}
stat::O
domain::D
end
Expand Down Expand Up @@ -53,11 +53,12 @@ end
mutable struct ClosedInterval{T}
first::T
last::T
ClosedInterval(a::T, b::T) where {T} = a < b ? new{T}(a,b) : error("Arguments must be ordered")
end
Base.show(io::IO, b::ClosedInterval) = print(io, "ClosedInterval: [$(b.first), $(b.last)]")
Base.in(x, bucket::ClosedInterval) = bucket.first x bucket.last
Base.isless(a::ClosedInterval, b::ClosedInterval) = isless(a.first, b.first)
function Base.merge!(a::ClosedInterval, b::ClosedInterval)
function Base.merge!(a::ClosedInterval, b::ClosedInterval, astat, bstat)
a.first = min(a.first, b.first)
a.last = max(a.last, b.last)
a
Expand Down

2 comments on commit 573ba8a

@joshday
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/11058

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if Julia TagBot is installed, or can be done manually through the github interface, or via:

git tag -a v1.2.1 -m "<description of version>" 573ba8af0bf540b24ab84cd85756f2fbf23f8fbd
git push origin v1.2.1

Please sign in to comment.