|
| 1 | +# after this, functionality was incorporated into Base |
| 2 | +if VERSION < v"0.7.0-DEV.1790" |
1 | 3 | using ShowItLikeYouBuildIt
|
2 | 4 |
|
3 | 5 | Base.summary(A::AbstractInterpolation) = summary_build(A)
|
@@ -53,6 +55,78 @@ function ShowItLikeYouBuildIt.showarg(io::IO, A::FilledExtrapolation{T,N,TI,IT,G
|
53 | 55 | print(io, ", ", A.fillvalue, ')')
|
54 | 56 | end
|
55 | 57 |
|
| 58 | +else |
| 59 | + |
| 60 | +function Base.showarg(io::IO, A::BSplineInterpolation{T,N,TW,ST,GT}, toplevel) where {T,N,TW,ST,GT} |
| 61 | + print(io, "interpolate(") |
| 62 | + Base.showarg(io, A.coefs, false) |
| 63 | + print(io, ", ") |
| 64 | + _showtypeparam(io, ST) |
| 65 | + print(io, ", ") |
| 66 | + _showtypeparam(io, GT) |
| 67 | + if toplevel |
| 68 | + print(io, ") with element type ",T) |
| 69 | + else |
| 70 | + print(io, ')') |
| 71 | + end |
| 72 | +end |
| 73 | + |
| 74 | +function Base.showarg(io::IO, A::GriddedInterpolation{T,N,TC,ST,K}, toplevel) where {T,N,TC,ST,K} |
| 75 | + print(io, "interpolate(") |
| 76 | + _showknots(io, A.knots) |
| 77 | + print(io, ", ") |
| 78 | + Base.showarg(io, A.coefs, false) |
| 79 | + print(io, ", ") |
| 80 | + _showtypeparam(io, ST) |
| 81 | + if toplevel |
| 82 | + print(io, ") with element type ",T) |
| 83 | + else |
| 84 | + print(io, ')') |
| 85 | + end |
| 86 | +end |
| 87 | + |
| 88 | +_showknots(io, A) = Base.showarg(io, A, false) |
| 89 | +function _showknots(io, tup::NTuple{N,Any}) where N |
| 90 | + print(io, '(') |
| 91 | + for (i, A) in enumerate(tup) |
| 92 | + Base.showarg(io, A, false) |
| 93 | + i < N && print(io, ',') |
| 94 | + end |
| 95 | + N == 1 && print(io, ',') |
| 96 | + print(io, ')') |
| 97 | +end |
| 98 | + |
| 99 | +function Base.showarg(io::IO, A::ScaledInterpolation{T}, toplevel) where {T} |
| 100 | + print(io, "scale(") |
| 101 | + Base.showarg(io, A.itp, false) |
| 102 | + print(io, ", ", A.ranges, ')') |
| 103 | + if toplevel |
| 104 | + print(io, " with element type ",T) |
| 105 | + end |
| 106 | +end |
| 107 | + |
| 108 | +function Base.showarg(io::IO, A::Extrapolation{T,N,TI,IT,GT,ET}, toplevel) where {T,N,TI,IT,GT,ET} |
| 109 | + print(io, "extrapolate(") |
| 110 | + Base.showarg(io, A.itp, false) |
| 111 | + print(io, ", ") |
| 112 | + _showtypeparam(io, ET) |
| 113 | + print(io, ')') |
| 114 | + if toplevel |
| 115 | + print(io, " with element type ",T) |
| 116 | + end |
| 117 | +end |
| 118 | + |
| 119 | +function Base.showarg(io::IO, A::FilledExtrapolation{T,N,TI,IT,GT}, toplevel) where {T,N,TI,IT,GT} |
| 120 | + print(io, "extrapolate(") |
| 121 | + Base.showarg(io, A.itp, false) |
| 122 | + print(io, ", ", A.fillvalue, ')') |
| 123 | + if toplevel |
| 124 | + print(io, " with element type ",T) |
| 125 | + end |
| 126 | +end |
| 127 | + |
| 128 | +end |
| 129 | + |
56 | 130 | _showtypeparam(io, ::Type{T}) where {T} =
|
57 | 131 | print(io, T.name.name, "()")
|
58 | 132 | _showtypeparam(io, ::Type{Quadratic{T}}) where {T} =
|
|
0 commit comments