dot :: DotElement
dot $ DotElement :: SELF
Type of this instance, automatically specialized in every classcore :: Object :: class_factory
Implementation used byget_class
to create the specific class.
dot :: DotElement :: defaultinit
core :: Object :: defaultinit
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.
core :: Object :: output_class_name
Display class name on stdout (debug only).
# Something that can be rendered in dot format.
abstract class DotElement
# Element ID
var id: String
# Element attributes
var attrs = new AttributeMap
# Get attribute value for `key`
fun [](key: String): Object do return attrs[key]
# Set attribute `value` for `key`
fun []=(key: String, value: Object) do attrs[key] = value
# Render `self` to dot format
fun to_dot: Text do
var res = new Buffer
res.append "\"{escape_id}\" "
if attrs.not_empty then res.append "[{attrs.to_dot(",")}]"
return res.write_to_string
end
# Return `id.escape_to_dot`
fun escape_id: String do return id.escape_to_dot
end
lib/dot/dot.nit:32,1--57,3