PartialOrder< T> class
abstract
The PartialOrder
type class is used to define a
partial ordering on some type A
.
A partial order is defined by a relation <=, which obeys the following laws:
- x <= x (reflexivity)
- if x <= y and y <= x, then x == y (anti-symmetry)
- if x <= y and y <= z, then x <= z (transitivity)
To compute both <= and >= at the same time, we use a double
number
to encode the result of the comparisons x <= y and x >= y.
The truth table is defined as follows:
x <= y | x >= y | result | note |
---|---|---|---|
true | true | 0.0 | (corresponds to x == y) |
false | false | null | (x and y cannot be compared) |
true | false | -1.0 | (corresponds to x < y) |
false | true | 1.0 | (corresponds to x > y) |
Note: A partial order under which every pair of elements is comparable is called a total order (Order).
Constructors
- PartialOrder()
-
const
Properties
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
Methods
-
and(
Eq< T> eq) → Eq< T> -
Return an
Eq
that gives the result of and ofeq1
andeq2
.inherited -
contramap<
A>( T map(A)) → PartialOrder< A> -
Return an Eq instance based on a parameter of type
T
extracted from a classA
.override -
eqv(
T x, T y) → bool -
Returns
true
ifx
==y
,false
otherwise.override -
gt(
T x, T y) → bool -
Returns
true
ifx
>y
,false
otherwise. -
gteqv(
T x, T y) → bool -
Returns
true
ifx
>=y
,false
otherwise. -
lt(
T x, T y) → bool -
Returns
true
ifx
<y
,false
otherwise. -
lteqv(
T x, T y) → bool -
Returns
true
ifx
<=y
,false
otherwise. -
neqv(
T x, T y) → bool -
Returns
false
ifx
andy
are equivalent,true
otherwise.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
or(
Eq< T> eq) → Eq< T> -
Return an
Eq
that gives the result of or of this Eq andeq
.inherited -
partialCompare(
T x, T y) → double? -
Result of comparing
x
withy
. -
toString(
) → String -
A string representation of this object.
inherited
-
xor(
Eq< T> eq) → Eq< T> -
Return an
Eq
that gives the result of xor of this Eq andeq
.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
by<
A, B>( B f(A a), PartialOrder< B> po) → PartialOrder< A> -
Convert an implicit
PartialOrder[B]
to anPartialOrder[A]
using the given functionf
.override -
from<
A>( double? f(A a1, A a2)) → PartialOrder< A> -
Define a
PartialOrder[A]
using the given functionf
. -
reverse<
A>( PartialOrder< A> p) → PartialOrder< A> -
Defines a partial order on
A
fromp
where all arrows switch direction.