diff --git a/src/Parameter.jl b/src/Parameter.jl index 920afec..3b618b1 100644 --- a/src/Parameter.jl +++ b/src/Parameter.jl @@ -1,4 +1,4 @@ -import Base: show +import Base: show, getindex, eltype, length, iterate @doc raw""" Parameter @@ -32,6 +32,14 @@ struct Parameters exceptions::Vector{UPolyFrac} end +getindex(p::Parameters, i::Integer) = p.params[i] + +eltype(::Type{Parameters}) = Parameter + +length(p::Parameters) = length(p.params) + +iterate(p::Parameters, state::Integer=1) = state > length(p) ? nothing : (p[state], state+1) + function Parameters(p::Vector{Parameter}) return Parameters(p,UPolyFrac[]) end diff --git a/src/Show.jl b/src/Show.jl index 7ee62ea..b37e446 100644 --- a/src/Show.jl +++ b/src/Show.jl @@ -73,9 +73,9 @@ julia> [g[3]] function show(io::IO, ::MIME"text/plain", c::AbstractGenericCharacter) io = pretty(io) println(io, "Generic character of ", parent(c).importname, Indent()) - if c isa GenericCharacter && !isempty(c.params.params) + if !isempty(parameters(c)) println(io, "with parameters ", Indent()) - print(io, c.params) + print(io, parameters(c)) if !isempty(c.substitutions) print(io, ", substitutions: $(join(c.substitutions, ", "))") end @@ -121,9 +121,9 @@ julia> [conjugacy_class_type(g, 3)] function show(io::IO, ::MIME"text/plain", c::AbstractGenericConjugacyClass) io = pretty(io) println(io, "Generic conjugacy class of ", parent(c).importname, Indent()) - if c isa GenericConjugacyClass && !isempty(parent(c).classparams[c.index].params) + if !isempty(parameters(c)) println(io, "with parameters ", Indent()) - print(io, parent(c).classparams[c.index]) + print(io, parameters(c)) if !isempty(c.substitutions) print(io, ", substitutions: $(join(c.substitutions, ", "))") end