Skip to content

Commit

Permalink
range of multiple atoms
Browse files Browse the repository at this point in the history
  • Loading branch information
louisponet committed May 12, 2020
1 parent 57e326a commit 22058ee
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/atom.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,14 @@ for interface_function in fieldnames(Atom)
@eval export $interface_function
end


function Base.range(at::AbstractAtom)
projs = projections(at)
@assert length(projs) != 0 "At $(name(at)) has no defined projections. Please use `setprojections!` first."
return projs[1].start : projs[end].last
end

Base.range(v::Vector{AbstractAtom}) = vcat(range.(v)...)

setname!(at::AbstractAtom, name::Symbol) =
atom(at).name = name

Expand Down

0 comments on commit 22058ee

Please sign in to comment.