a_star :: Graph :: defaultinit
a_star $ Graph :: core_serialize_to
Actual serialization ofself
to serializer
a_star $ Graph :: from_deserializer
Create an instance of this class from thedeserializer
serialization :: Serializable :: accept_json_serializer
Refinable service to customize the serialization of this class to JSONserialization :: Serializable :: accept_msgpack_attribute_counter
Hook to customize the behavior of theAttributeCounter
serialization :: Serializable :: accept_msgpack_serializer
Hook to customize the serialization of this class to MessagePackserialization :: Serializable :: add_to_bundle
Called by[]=
to dynamically choose the appropriate method according
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
serialization :: Serializable :: core_serialize_to
Actual serialization ofself
to serializer
core :: Object :: defaultinit
a_star :: Graph :: defaultinit
serialization :: Serializable :: from_deserializer
Create an instance of this class from thedeserializer
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
serialization :: Serializable :: msgpack_extra_array_items
Hook to request a larger than usual metadata arraycore :: Object :: output_class_name
Display class name on stdout (debug only).serialization :: Serializable :: serialize_msgpack
Serializeself
to MessagePack bytes
serialization :: Serializable :: serialize_to
Serializeself
to serializer
serialization :: Serializable :: serialize_to_json
Serializeself
to JSON
serialization :: Serializable :: to_pretty_json
Serializeself
to plain pretty JSON
Serializer::serialize
# General graph
class Graph[N: Node, L: Link]
super Serializable
# Nodes in this graph
var nodes = new Set[N]
# Links in this graph
var links = new Set[L]
# Add a `node` to this graph
fun add_node(node: N): N
do
nodes.add(node)
return node
end
# Add a `link` to this graph
fun add_link(link: L): L
do
links.add(link)
link.from.links.add(link)
return link
end
# Used to check if nodes have been searched in one pathfinding
private var pathfinding_current_evocation: Int = 0
redef fun core_serialize_to(serializer)
do
serializer.serialize_attribute("nodes", nodes)
serializer.serialize_attribute("links", links)
end
redef init from_deserializer(deserializer)
do
deserializer.notify_of_creation self
var nodes = deserializer.deserialize_attribute("nodes", (new GetName[Set[N]]).to_s)
if deserializer.deserialize_attribute_missing then
deserializer.errors.add new AttributeMissingError(self, "nodes")
end
if nodes isa Set[N] then self.nodes = nodes
var links = deserializer.deserialize_attribute("links", (new GetName[Set[L]]).to_s)
if deserializer.deserialize_attribute_missing then
deserializer.errors.add new AttributeMissingError(self, "links")
end
if links isa Set[L] then for link in links do add_link link
end
end
lib/a_star/a_star.nit:245,1--298,3