Returns a normalized form of the passed object.
Returns a normalized form of the passed object.
If the passed object is already in normal form, this method may return the same instance passed.
the object to normalize
the normalized form of the passed object
Indicates whether this NormalizingEquality
's normalized
method can “handle” the passed object, if cast to the
appropriate type A
.”“
Indicates whether this NormalizingEquality
's normalized
method can “handle” the passed object, if cast to the
appropriate type A
.
If this method returns true for a particular passed object, it means that if the object is passed
to normalizedOrSame
, that method will return the result of passing it to normalized
.
It does not mean that the object will necessarily be modified when passed to normalizedOrSame
or normalized
.
For more information and examples, see the documentation for normalizedCanHandle
in trait Uniformity
,
which has the same contract.
Returns either the result of passing this object to normalized
, if appropriate, or the same object.
Returns either the result of passing this object to normalized
, if appropriate, or the same object.
the object to normalize, if appropriate
a normalized form of the passed object, if this Uniformity
was able to normalize it, else the same object passed
The Equality
with which to determine equality after normalizing the left-hand and, if appropriate,
the right-hand values.
The Equality
with which to determine equality after normalizing the left-hand and, if appropriate,
the right-hand values.
In this trait's implementation, this val
is initialized with the result of invoking Equality.default[A]
.
Thus default Equality
is the default afterNormalizationEquality
. This may be changed by overriding
afterNormalizationEquality
in subclasses.
Returns a new NormalizingEquality
that combines this and the passed Uniformity
.
Returns a new NormalizingEquality
that combines this and the passed Uniformity
.
The normalized
and normalizedOrSame
methods
of the NormalizingEquality
's returned by this method return a result
obtained by forwarding the passed value first to this NormalizingEquality
's implementation of the method,
then passing that result to the passed Uniformity
's implementation of the method, respectively.
Essentially, the body of the composed normalized
method is:
uniformityPassedToAnd.normalized(uniformityOnWhichAndWasInvoked.normalized(a))
And the body of the composed normalizedOrSame
method is:
uniformityPassedToAnd.normalizedOrSame(uniformityOnWhichAndWasInvoked.normalizedOrSame(a))
The normalizeCanHandle
method of the NormalizingEquality
returned by this method returns a result
obtained by anding the result of forwarding the passed value to this NormalizingEquality
's implementation of the method
with the result of forwarding it to the passed Uniformity
's implementation.
Essentially, the body of the composed normalizeCanHandle
method is:
normEqOnWhichAndWasInvoked.normalizeCanHandle(a) && uniformityPassedToAnd.normalizeCanHandle(a)
a Uniformity
to 'and' with this one
a NormalizingEquality
representing the composition of this and the passed Uniformity
Determines the equality of two objects by normalizing the left-hand value, a
, and, if appropriate, the right-hand
value, b
, then passing them to areEqual
method of afterNormalizationEquality
.
Determines the equality of two objects by normalizing the left-hand value, a
, and, if appropriate, the right-hand
value, b
, then passing them to areEqual
method of afterNormalizationEquality
.
The left-hand value, a
, is normalized by passing it to the normalized
method of this
NormalizingEquality
. The right-hand value, b
, is normalized, if appropriate, by passing it
to the normalizedOrSame
method of this NormalizingEquality
.
a left-hand value being compared with another (right-hand-side one) for equality (e.g., a == b
)
a right-hand value being compared with another (left-hand-side one) for equality (e.g., a == b
)
true if the passed objects are "equal," as defined by this Equality
instance
A final implementation of the areEquivalent
method of Equivalence
that just passes
a
and b
to areEqual
and returns the result.
A final implementation of the areEquivalent
method of Equivalence
that just passes
a
and b
to areEqual
and returns the result.
This method enables any Equality
to be used where an Equivalence
is needed, such
as the implicit enabling methods of TypeCheckedTripleEquals
and ConversionCheckedTripleEquals
.
a left-hand value being compared with another, right-hand, value for equality (e.g., a == b
)
a right-hand value being compared with another, left-hand, value for equality (e.g., a == b
)
true if the passed objects are "equal," as defined by the areEqual
method of this
Equality
instance
Converts this NormalizingEquality
to a Uniformity
.
Converts this NormalizingEquality
to a Uniformity
.
a Uniformity
whose normalized
, normalizedCanHandle
, and normalizedOrSame
methods
are implemented by the corresponding methods of this NormalizingEquality
.
An
Equality[A]
implementation that determines the equality of two objects by normalizing one or both objects, then comparing the results using an “after normalization” equality referenced from theafterNormalizationEquality
member. By default, theafterNormalizationEquality
is an instance ofEquality.default[A]
.NormalizingEquality
is returned by theExplicitly
DSL's “after
being
” syntax, using for theafterNormalizationEquality
the implicitEquality
in scope for the type ofUniformity
passed tobeing
. Here's an example: