Used to order results returned by BKTree::search
.
trees :: BKMatch :: defaultinit
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
trees :: BKMatch :: defaultinit
core :: Object :: defaultinit
core :: Comparable :: 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).
# A match in a BKTree
#
# Used to order results returned by `BKTree::search`.
class BKMatch
super Comparable
redef type OTHER: BKMatch
# Distance of `key` from the search query
var distance: Int
# Matched `key`
var key: String
redef fun ==(o) do return o isa BKMatch and distance == o.distance and key == o.key
redef fun <=>(o) do
if distance == o.distance then
return key <=> o.key
end
return distance <=> o.distance
end
redef fun to_s do return "\{{distance}: {key}\}"
end
lib/trees/bktree.nit:125,1--149,3