POSet
to JSONSerializable::inspect
to show more useful information
more_collections :: more_collections
Highly specific, but useful, collections-related classes.serialization :: serialization_core
Abstract services to serialize Nit objects to different formatscore :: union_find
union–find algorithm using an efficient disjoint-set data structureserialize_to_json
and JsonSerializer
clone
method of the astbuilder tool
# Service to serialize `POSet` to JSON
module serialize_model
private import json::serialization_write
import model
redef class POSet[E]
# Serialize `self` to JSON using the `to_s` representation of each item
fun to_thin_json: String
do
var thin_poset = new POSet[String]
for e in self do
var from = (e or else "null").to_s
for g in self[e].direct_greaters do
thin_poset.add_edge(from, (g or else "null").to_s)
end
end
return thin_poset.serialize_to_json
end
end
src/model/serialize_model.nit:15,1--36,3