Skip to content

Commit bf4e4d3

Browse files
committed
Move to struct type syntax
1 parent c8a2e69 commit bf4e4d3

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

src/categoricalvector.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ A[(:a,:x), :]
3939
A[(:a,:x,:x), :]
4040
```
4141
"""
42-
immutable CategoricalVector{T, A<:AbstractVector{T}} <: AbstractVector{T}
42+
struct CategoricalVector{T, A<:AbstractVector{T}} <: AbstractVector{T}
4343
data::A
4444
end
4545

src/core.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ parametric type.
1111
### Type parameters
1212
1313
```julia
14-
immutable Axis{name,T}
14+
struct Axis{name,T}
1515
```
1616
* `name` : the name of the axis, a Symbol
1717
* `T` : the type of the axis
@@ -42,7 +42,7 @@ A[Axis{2}(2:5)] # grabs the second through 5th columns
4242
```
4343
4444
"""
45-
immutable Axis{name,T}
45+
struct Axis{name,T}
4646
val::T
4747
end
4848
# Constructed exclusively through Axis{:symbol}(...) or Axis{1}(...)
@@ -75,7 +75,7 @@ dimension. Other advanced indexing along axis values are also provided.
7575
The AxisArray contains several type parameters:
7676
7777
```julia
78-
immutable AxisArray{T,N,D,Ax} <: AbstractArray{T,N}
78+
struct AxisArray{T,N,D,Ax} <: AbstractArray{T,N}
7979
```
8080
* `T` : the elemental type of the AbstractArray
8181
* `N` : the number of dimensions
@@ -143,7 +143,7 @@ A[ClosedInterval(0.,.3), [:a, :c]] # select an interval and two columns
143143
```
144144
145145
"""
146-
immutable AxisArray{T,N,D,Ax} <: AbstractArray{T,N}
146+
struct AxisArray{T,N,D,Ax} <: AbstractArray{T,N}
147147
data::D # D <:AbstractArray, enforced in constructor to avoid dispatch bugs (https://github.com/JuliaLang/julia/issues/6383)
148148
axes::Ax # Ax<:NTuple{N, Axis}, but with specialized Axis{...} types
149149
(::Type{AxisArray{T,N,D,Ax}})(data::AbstractArray{T,N}, axs::Tuple{Vararg{Axis,N}}) where {T,N,D,Ax} = new{T,N,D,Ax}(data, axs)
@@ -211,7 +211,7 @@ function AxisArray(A::AbstractArray{T,N}, names::NTuple{N,Symbol}, steps::NTuple
211211
end
212212

213213
# Traits
214-
immutable HasAxes{B} end
214+
struct HasAxes{B} end
215215
HasAxes(::Type{<:AxisArray}) = HasAxes{true}()
216216
HasAxes(::Type{<:AbstractArray}) = HasAxes{false}()
217217
HasAxes(::A) where A<:AbstractArray = HasAxes(A)
@@ -502,9 +502,9 @@ axisparams(::Type{AxisArray{T,N,D,Ax}}) where {T,N,D,Ax} = (Ax.parameters...)
502502

503503
### Axis traits ###
504504
abstract type AxisTrait end
505-
immutable Dimensional <: AxisTrait end
506-
immutable Categorical <: AxisTrait end
507-
immutable Unsupported <: AxisTrait end
505+
struct Dimensional <: AxisTrait end
506+
struct Categorical <: AxisTrait end
507+
struct Unsupported <: AxisTrait end
508508

509509
"""
510510
axistrait(ax::Axis) -> Type{<:AxisTrait}

src/indexing.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const Idx = Union{Real,Colon,AbstractArray{Int}}
22

33
using Base: ViewIndex, @propagate_inbounds, tail
44

5-
immutable Value{T}
5+
struct Value{T}
66
val::T
77
tol::T
88
end

src/intervals.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ end
5555

5656
# And, finally, we have an Array-of-Structs to Struct-of-Arrays transform for
5757
# the common case where the interval is constant over many offsets:
58-
immutable RepeatedInterval{T,S,A} <: AbstractVector{T}
58+
struct RepeatedInterval{T,S,A} <: AbstractVector{T}
5959
window::ClosedInterval{S}
6060
offsets::A # A <: AbstractVector
6161
end
@@ -71,14 +71,14 @@ Base.getindex(r::RepeatedInterval, i::Int) = r.window + r.offsets[i]
7171

7272
# As a special extension to intervals, we allow specifying Intervals about a
7373
# particular index, which is resolved by an axis upon indexing.
74-
immutable IntervalAtIndex{T}
74+
struct IntervalAtIndex{T}
7575
window::ClosedInterval{T}
7676
index::Int
7777
end
7878
atindex(window::ClosedInterval, index::Integer) = IntervalAtIndex(window, index)
7979

8080
# And similarly, an AoS -> SoA transform:
81-
immutable RepeatedIntervalAtIndexes{T,A<:AbstractVector{Int}} <: AbstractVector{IntervalAtIndex{T}}
81+
struct RepeatedIntervalAtIndexes{T,A<:AbstractVector{Int}} <: AbstractVector{IntervalAtIndex{T}}
8282
window::ClosedInterval{T}
8383
indexes::A # A <: AbstractVector{Int}
8484
end

src/sortedvector.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ A[ClosedInterval((:a,:x),(:b,:x)), :]
4949
```
5050
5151
"""
52-
immutable SortedVector{T} <: AbstractVector{T}
52+
struct SortedVector{T} <: AbstractVector{T}
5353
data::AbstractVector{T}
5454
end
5555

test/indexing.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ v = AxisArray(collect(.1:.1:10.0), .1:.1:10.0)
107107
# create a number type from which we build a StepRange but which is
108108
# not an Int.
109109
module IL # put in a module so this file can be re-run
110-
immutable IntLike <: Number
110+
struct IntLike <: Number
111111
val::Int
112112
end
113113
Base.one(x::IntLike) = IntLike(0)

0 commit comments

Comments
 (0)