From 030bb09eb889a2529ad7c5281e80b915de02ed03 Mon Sep 17 00:00:00 2001 From: Julian Straus Date: Mon, 22 Jun 2026 12:19:39 +0200 Subject: [PATCH 1/2] Fixed problems with eltype fucntionality --- src/op_scenarios/tree_periods.jl | 6 ++++-- src/representative/tree_periods.jl | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/op_scenarios/tree_periods.jl b/src/op_scenarios/tree_periods.jl index 4715b46..1d6502f 100644 --- a/src/op_scenarios/tree_periods.jl +++ b/src/op_scenarios/tree_periods.jl @@ -46,7 +46,7 @@ StrategicIndexable(::Type{<:StratNodeOpScenario}) = HasStratIndex() function Base.show(io::IO, osc::StratNodeOpScenario) return print(io, "sp$(_strat_per(osc))-br$(_branch(osc))-sc$(_opscen(osc))") end -Base.eltype(_::StratNodeOpScenario{T,OP}) where {T,OP} = TreePeriod{eltype(op)} +Base.eltype(_::StratNodeOpScenario{T,OP}) where {T,OP} = TreePeriod{eltype(OP)} """ struct StratNodeOpScens{T,OP<:TimeStructInnerIter{T}} <: AbstractTreeStructure{T} @@ -153,7 +153,9 @@ function Base.show(io::IO, osc::StratNodeReprOpScenario) "sp$(_strat_per(osc))-br$(_branch(osc))-rp$(_rper(osc))-sc$(_opscen(osc))", ) end -Base.eltype(_::StratNodeReprOpScenario{T,OP}) where {T,OP} = TreePeriod{eltype(op)} +function Base.eltype(_::StratNodeReprOpScenario{T,OP}) where {T,OP} + return TreePeriod{ReprPeriod{eltype(OP)}} +end """ struct StratNodeReprOpScens{T,OP<:TimeStructInnerIter{T}} <: AbstractTreeStructure{T} diff --git a/src/representative/tree_periods.jl b/src/representative/tree_periods.jl index 01b219f..6b31bca 100644 --- a/src/representative/tree_periods.jl +++ b/src/representative/tree_periods.jl @@ -40,7 +40,7 @@ end function Base.show(io::IO, rp::StratNodeReprPeriod) return print(io, "sp$(_strat_per(rp))-br$(_branch(rp))-rp$(_rper(rp))") end -Base.eltype(_::StratNodeReprPeriod{T,OP}) where {T,OP} = TreePeriod{eltype(op)} +Base.eltype(_::StratNodeReprPeriod{T,OP}) where {T,OP} = TreePeriod{eltype(OP)} """ struct StratNodeReprPers{T,OP<:TimeStructInnerIter{T}} <: AbstractTreeStructure{T} From 502ed738fd94bf4572dd356253d7f4a4b19f3bee Mon Sep 17 00:00:00 2001 From: Julian Straus Date: Mon, 22 Jun 2026 12:20:03 +0200 Subject: [PATCH 2/2] Fixed problem with getindex for StratReprPers --- src/representative/strat_periods.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/representative/strat_periods.jl b/src/representative/strat_periods.jl index f4c5275..c1d929a 100644 --- a/src/representative/strat_periods.jl +++ b/src/representative/strat_periods.jl @@ -94,7 +94,8 @@ function Base.iterate(rpers::StratReprPers, state = (nothing, 1)) return StratReprPeriod(rpers, state[2], next[1]), (next[2], state[2] + 1) end function Base.getindex(rpers::StratReprPers, index::Int) - return StratReprPeriod(rpers, index) + per = _oper_struct(rpers)[index] + return StratReprPeriod(rpers, index, per) end function Base.eachindex(rpers::StratReprPers) return eachindex(_oper_struct(rpers))