Property definitions

trees $ BKMatch :: defaultinit
# 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