Skip to content

Commit e1208bc

Browse files
committed
Change === nothing statement to isnothing
1 parent d4de688 commit e1208bc

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

src/graph/rooted_spanning_forest.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function RootedSpanningForest(
5959
graph::LG.SimpleGraph{T},
6060
roots::Union{Nothing,T,AbstractVector{T},AbstractSet{T}}=nothing
6161
) where {T<:Int}
62-
roots_ = unique(roots === nothing ? rand(LG.vertices(graph)) : roots)
62+
roots_ = unique(isnothing(roots) ? rand(LG.vertices(graph)) : roots)
6363
if issubset(roots_, LG.vertices(graph))
6464
if LG.is_connected(graph)
6565
return RootedSpanningForest{LG.SimpleDiGraph{T}}(graph, roots_)

src/spatial/dominated_cftp.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function generate_sample_dcftp(
7070
)::Vector{T} where {T}
7171
@assert n₀ >= 1
7272

73-
window_ = win === nothing ? window(pp) : win
73+
window_ = isnothing(win) ? window(pp) : win
7474
β = upper_bound_papangelou_conditional_intensity(pp)
7575
birth_rate = β * volume(window_)
7676

src/spatial/hard_core.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function HardCorePointProcess(
7171
)
7272
@assert β > 0
7373
@assert r > 0
74-
win = window === nothing ? SquareWindow() : window
74+
win = isnothing(window) ? SquareWindow() : window
7575
return HardCorePointProcess{Vector{Float64}}(β, r, win)
7676
end
7777

@@ -199,7 +199,7 @@ function generate_sample_prs(
199199
)::Vector{T} where {T}
200200

201201
β, r = intensity(pp), interaction_range(pp)
202-
win_ = win === nothing ? window(pp) : win
202+
win_ = isnothing(win) ? window(pp) : win
203203

204204
β_max = 0.21027 / volume(BallWindow(zeros(dimension(win_)), r/2))
205205
if β > β_max

src/spatial/poisson.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function HomogeneousPoissonPointProcess(
4848
window::Union{Nothing,AbstractSpatialWindow}=nothing
4949
)
5050
@assert β > 0
51-
win = window === nothing ? SquareWindow() : window
51+
win = isnothing(window) ? SquareWindow() : window
5252
return HomogeneousPoissonPointProcess{Vector{Float64}}(β, win)
5353
end
5454

@@ -76,7 +76,7 @@ function generate_sample(
7676
pp::HomogeneousPoissonPointProcess{Vector{T}},
7777
win::Union{Nothing,AbstractWindow}=nothing
7878
)::Matrix{T} where {T<:Float64}
79-
window_ = win === nothing ? window(pp) : win
79+
window_ = isnothing(win) ? window(pp) : win
8080
n = rand(rng, Distributions.Poisson(pp.β * volume(window_)))
8181
return rand(rng, window_, n)
8282
end
@@ -118,7 +118,7 @@ function generate_sample_poisson_union_balls(
118118
win::Union{Nothing,AbstractWindow}=nothing
119119
)::Matrix{Float64}
120120
d = size(centers, 1)
121-
!(win === nothing) && @assert dimension(win) == d
121+
!(isnothing(win)) && @assert dimension(win) == d
122122

123123
𝒫 = Distributions.Poisson* volume(BallWindow(zeros(d), radius)))
124124
points = Matrix{Float64}(undef, d, 0)
@@ -135,7 +135,7 @@ function generate_sample_poisson_union_balls(
135135
points = hcat(points, proposed[:, accept])
136136
end
137137

138-
if win === nothing || isempty(points)
138+
if isnothing(win) || isempty(points)
139139
return points
140140
end
141141
return points[:, vec(mapslices(x -> x in win, points; dims=1))]

src/spatial/strauss.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function StraussPointProcess(
7979
@assert β > 0
8080
@assert 0 <= γ <= 1
8181
@assert r > 0
82-
win = window === nothing ? SquareWindow() : window
82+
win = isnothing(window) ? SquareWindow() : window
8383
return StraussPointProcess{Vector{Float64}}(β, γ, r, win)
8484
end
8585

0 commit comments

Comments
 (0)