Skip to content

Commit 7394b6a

Browse files
committed
use variable name x
1 parent a29b9a9 commit 7394b6a

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

src/metadata.jl

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,23 @@ Base.size(x::MeshMeta) = size(metafree(x))
195195

196196

197197
"""
198-
`Feature` type acts same as Meta method
198+
199+
Feature(::type{T}, Names, Types)
200+
201+
Returns a `Feature` that holds a geometry and it's metadata
202+
203+
`Feature` acts the same as `Meta` method.
199204
The difference lies in the fact that it is designed to handle
200-
heterogeneous types.
205+
geometries and metadata of different/heterogeneous types.
206+
207+
eg: While a Point MetaGeometry is a `PointMeta`, the Feature representation is `Feature{Point}`
208+
The downside being it's not subtyped to `AbstractPoint` like a `PointMeta` is.
201209
202-
eg: A Point MetaGeometry is a `PointMeta`
203-
But a feature is represented as `Feature{Point}`
210+
Example:
211+
```julia
212+
julia> Feature(Point(1, 2), city = "Mumbai")
213+
Feature{Point{2,Int64},(:city,),Tuple{String}}([1, 2], (city = "Mumbai",))
214+
```
204215
"""
205216
struct Feature{T, Names, Types}
206217
main::T
@@ -244,7 +255,7 @@ function StructArrays.createinstance(::Type{F}, x, args...) where {F<:Feature}
244255
end
245256

246257
"""
247-
Accepts an Array/iterator of Features and put it into a StructArray
258+
Accepts an iterable of Features and put it into a StructArray
248259
"""
249260
function collect_feature(iter)
250261
cols = Tables.columntable(iter)
@@ -256,6 +267,6 @@ function collect_feature(main, meta::NamedTuple{names, types}) where {names, typ
256267
return StructArray{F}(; main=main, meta...)
257268
end
258269

259-
Base.getindex(f::Feature, idx::Int) = getindex(metafree(f), idx)
260-
Base.size(f::Feature) = size(metafree(f))
270+
Base.getindex(x::Feature, idx::Int) = getindex(metafree(x), idx)
271+
Base.size(x::Feature) = size(metafree(x))
261272

0 commit comments

Comments
 (0)