comparator

class comparator#(type T =  int)

singleton Provides strategies to compare objects.

Parameter

Toptional The type of an object to be compared.  The default is int.
Summary
comparatorsingleton Provides strategies to compare objects.
Types
this_typeThe shorthand of comparator #(T).
Functions
newprotected Creates a new comparator.
get_instancestatic Returns the singleton instance of this comparator.
eqvirtual Returns 1 if two inputs are equal.
nevirtual Returns 1 if two inputs are not equal.
ltvirtual Returns 1 if x is less than y.
gtvirtual Returns 1 if x is greater than y.
levirtual Returns 1 if x is less than or equal to y.
gevirtual Returns 1 if x is greater than or equal to y.

Types

this_type

typedef comparator#(T) this_type

The shorthand of comparator #(T).

Functions

new

protected function new()

protected Creates a new comparator.

get_instance

static function this_type get_instance()

static Returns the singleton instance of this comparator.

Returns

The singleton instance.

eq

virtual function bit eq(x,
y)

virtual Returns 1 if two inputs are equal.  This function uses the logical equality operator (==) for the object comparison.

Arguments

xAn input of type T.
yAnother input of type T.

Returns

If x is equal to y, then returns 1.  Otherwise, returns 0.

ne

virtual function bit ne(x,
y)

virtual Returns 1 if two inputs are not equal.

Arguments

xAn input of type T.
yAnother input of type T.

Returns

This function returns the negated value of eq (x,y).

lt

virtual function bit lt(x,
y)

virtual Returns 1 if x is less than y.

Arguments

xAn input of type T.
yAnother input of type T.

Returns

This function always returns 0.  A subclass should implement this function if necessary.

gt

virtual function bit gt(x,
y)

virtual Returns 1 if x is greater than y.

Arguments

xAn input of type T.
yAnother input of type T.

Returns

This function returns the value of lt (y,x).

le

virtual function bit le(x,
y)

virtual Returns 1 if x is less than or equal to y.

Arguments

xAn input of type T.
yAnother input of type T.

Returns

This function returns the negated value of gt (x,y).

ge

virtual function bit ge(x,
y)

virtual Returns 1 if x is greater than or equal to y.

Arguments

xAn input of type T.
yAnother input of type T.

Returns

This function returns the negated value of lt (x,y).

class comparator#(type T =  int)
singleton Provides strategies to compare objects.
typedef comparator#(T) this_type
The shorthand of comparator #(T).
protected function new()
protected Creates a new comparator.
static function this_type get_instance()
static Returns the singleton instance of this comparator.
virtual function bit eq(x,
y)
virtual Returns 1 if two inputs are equal.
virtual function bit ne(x,
y)
virtual Returns 1 if two inputs are not equal.
virtual function bit lt(x,
y)
virtual Returns 1 if x is less than y.
virtual function bit gt(x,
y)
virtual Returns 1 if x is greater than y.
virtual function bit le(x,
y)
virtual Returns 1 if x is less than or equal to y.
virtual function bit ge(x,
y)
virtual Returns 1 if x is greater than or equal to y.