diff --git a/src/anyons.jl b/src/anyons.jl index 6ac5d19..91b7833 100644 --- a/src/anyons.jl +++ b/src/anyons.jl @@ -56,7 +56,7 @@ Base.length(::SectorValues{FibonacciAnyon}) = 2 function Base.iterate(::SectorValues{FibonacciAnyon}, i=0) return i == 0 ? (FibonacciAnyon(:I), 1) : (i == 1 ? (FibonacciAnyon(:τ), 2) : nothing) end -function Base.getindex(S::SectorValues{FibonacciAnyon}, i) +function Base.getindex(S::SectorValues{FibonacciAnyon}, i::Int) if i == 1 return FibonacciAnyon(:I) elseif i == 2 @@ -177,7 +177,7 @@ const all_isinganyons = (IsingAnyon(:I), IsingAnyon(:σ), IsingAnyon(:ψ)) Base.IteratorSize(::Type{SectorValues{IsingAnyon}}) = HasLength() Base.length(::SectorValues{IsingAnyon}) = length(all_isinganyons) Base.iterate(::SectorValues{IsingAnyon}, i=1) = iterate(all_isinganyons, i) -Base.getindex(S::SectorValues{IsingAnyon}, i) = getindex(all_isinganyons, i) +Base.getindex(::SectorValues{IsingAnyon}, i::Int) = getindex(all_isinganyons, i) function findindex(::SectorValues{IsingAnyon}, a::IsingAnyon) a == all_isinganyons[1] && return 1 diff --git a/src/fermions.jl b/src/fermions.jl index a1d4b52..b8b1724 100644 --- a/src/fermions.jl +++ b/src/fermions.jl @@ -23,7 +23,7 @@ Base.length(::SectorValues{FermionParity}) = 2 function Base.iterate(::SectorValues{FermionParity}, i=0) return i == 2 ? nothing : (FermionParity(i), i + 1) end -function Base.getindex(::SectorValues{FermionParity}, i) +function Base.getindex(::SectorValues{FermionParity}, i::Int) return 1 <= i <= 2 ? FermionParity(i - 1) : throw(BoundsError(values(FermionParity), i)) end findindex(::SectorValues{FermionParity}, f::FermionParity) = f.isodd ? 2 : 1