Skip to content

Commit b5d7ea7

Browse files
committed
Update meta printing
1 parent 221de73 commit b5d7ea7

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/plugins/meta/meta_engine.jl

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,26 @@ struct MetaSpecification
3939
submodel_meta::Vector
4040
end
4141

42+
function Base.show(io::IO, c::MetaSpecification)
43+
indent = get(io, :indent, 1)
44+
head = get(io, :head, true)
45+
if head
46+
print(io, "Meta: \n")
47+
else
48+
print(io, "\n")
49+
end
50+
for meta in getmetaobjects(c)
51+
print(io, " "^indent)
52+
print(io, meta)
53+
print(io, "\n")
54+
end
55+
for submodel in getsubmodelmeta(c)
56+
print(io, " "^indent)
57+
print(io, submodel)
58+
print(io, "\n")
59+
end
60+
end
61+
4262
getmetaobjects(m::MetaSpecification) = m.meta_objects
4363
getsubmodelmeta(m::MetaSpecification) = m.submodel_meta
4464
getspecificsubmodelmeta(m::MetaSpecification) = filter(m -> is_specificsubmodelmeta(m), getsubmodelmeta(m))
@@ -76,6 +96,16 @@ getkey(m::GeneralSubModelMeta) = getsubmodel(m)
7696

7797
const SubModelMeta = Union{GeneralSubModelMeta, SpecificSubModelMeta}
7898

99+
function Base.show(io::IO, constraint::SubModelMeta)
100+
print(
101+
IOContext(io, (:indent => get(io, :indent, 0) + 2), (:head => false)),
102+
"Meta for submodel ",
103+
getsubmodel(constraint),
104+
" = ",
105+
getmetaobjects(constraint)
106+
)
107+
end
108+
79109
MetaSpecification() = MetaSpecification(Vector{MetaObject}(), Vector{SubModelMeta}())
80110

81111
Base.push!(m::MetaSpecification, o::MetaObject) = push!(m.meta_objects, o)

0 commit comments

Comments
 (0)