TestGame/addons/reactivex/abc/comparable.gd

28 lines
556 B
GDScript3
Raw Normal View History

2024-12-27 21:00:07 +01:00
class_name Comparable
## Interface for comparable objects
##
## This interface provides comparison functions. It is needed because GDScript
## does not allow defining custom operators.
func eq(_other) -> bool:
NotImplementedError.raise()
return false
func lt(_other) -> bool:
NotImplementedError.raise()
return false
func gt(_other) -> bool:
NotImplementedError.raise()
return false
func gte(other) -> bool:
return eq(other) or gt(other)
func lte(other) -> bool:
return eq(other) or lt(other)
func neq(other) -> bool:
return not eq(other)