Skip to content

Commit 7f812e2

Browse files
authored
Merge pull request #692 from JuliaRobotics/master
v0.10.10-rc1
2 parents f788416 + 26fbdf0 commit 7f812e2

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "DistributedFactorGraphs"
22
uuid = "b5cc3c7e-6572-11e9-2517-99fb8daf2f04"
3-
version = "0.10.9"
3+
version = "0.10.10"
44

55
[deps]
66
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

src/CloudGraphsDFG/services/CGStructure.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function isValidLabel(abstractNode::N)::Bool where N <: AbstractCGNode
22
id = String(abstractNode.id)
3-
return all(t -> t != uppercase(id), _invalidIds) && match(_validLabelRegex, id) != nothing
3+
return all(t -> t != uppercase(id), _invalidIds) && match(_validLabelRegex, id) !== nothing
44
end
55

66
# Fastest way I can think to convert the data into a dict

src/DistributedFactorGraphs.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ using SparseArrays
2929
using UUIDs
3030
using Pkg
3131

32+
import Base: getindex
33+
3234

3335
##==============================================================================
3436
# Exports
@@ -76,6 +78,8 @@ export exists,
7678
getVariables, getFactors,
7779
isVariable, isFactor
7880

81+
export getindex
82+
7983
export isConnected
8084

8185
export getBiadjacencyMatrix

src/services/AbstractDFG.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,17 @@ Get a DFGFactor from a DFG using its label.
247247
function getFactor(dfg::G, label::Union{Symbol, String}) where G <: AbstractDFG
248248
error("getFactor not implemented for $(typeof(dfg))")
249249
end
250+
251+
function Base.getindex(dfg::AbstractDFG, lbl::Union{Symbol, String})
252+
if isVariable(dfg, lbl)
253+
getVariable(dfg, lbl)
254+
elseif isFactor(dfg, lbl)
255+
getFactor(dfg, lbl)
256+
else
257+
error("Cannot find $lbl in this $(typeof(dfg))")
258+
end
259+
end
260+
250261
"""
251262
$(SIGNATURES)
252263
Update a complete DFGVariable in the DFG.

0 commit comments

Comments
 (0)