The user is asked to compare a
with b
then set res
accordingly.
a < b
then the user sets res
to -1a > b
then the user sets res
to 1a == b
then the user sets res
to 0It is the responsibility of the user to implement a total order. ie. the implemented comparison must be asymmetric, transitive and total.
for_abuse :: CompareQuery :: defaultinit
for_abuse :: CompareQuery :: res=
The result of the comparison (according to the user)for_abuse $ CompareQuery :: SELF
Type of this instance, automatically specialized in every classcore :: Object :: class_factory
Implementation used byget_class
to create the specific class.
core :: Object :: defaultinit
for_abuse :: CompareQuery :: 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).for_abuse :: CompareQuery :: res=
The result of the comparison (according to the user)
# A comparison query.
# The user is asked to compare `a` with `b` then set `res` accordingly.
#
# * if `a < b` then the user sets `res` to -1
# * if `a > b` then the user sets `res` to 1
# * if `a == b` then the user sets `res` to 0
#
# It is the responsibility of the user to implement a total order.
# ie. the implemented comparison must be asymmetric, transitive and total.
class CompareQuery[E]
# The first element to compare
var a: E
# The second element to compare
var b: E
# The result of the comparison (according to the user)
var res = 0 is writable
end
lib/for_abuse/for_abuse.nit:68,1--84,3