trait NormalizingEquivalence[A] extends Equivalence[A]
An Equivalence[A]
implementation that determines the equality of two objects by normalizing
one or both objects, then comparing the results using an “after normalization” Equivalence
referenced from
the afterNormalizationEquivalence
member. By default, the afterNormalizationEquivalence
is
an instance of Equivalence.default[A]
.
NormalizingEquivalence
is returned by the Explicitly
DSL's “after
being
”
syntax, using for the afterNormalizationEquivalence
the implicit Equivalence
in scope for the type
of Normalization
passed to being
. Here's an example:
scala> import org.scalactic._ import org.scalactic._ scala> import Explicitly._ import Explicitly._ scala> val lowerCased: Normalization[String] = StringNormalizations.lowerCased lowerCased: org.scalactic.Normalization[String] = lowerCased scala> after being lowerCased res0: org.scalactic.NormalizingEquivalence[String] = ComposedNormalizingEquivalence(Equality.default,lowerCased)
- Self Type
- NormalizingEquivalence[A]
- Source
- NormalizingEquivalence.scala
- Alphabetic
- By Inheritance
- NormalizingEquivalence
- Equivalence
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def normalized(a: A): A
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.
- a
the object to normalize
- returns
the normalized form of the passed object
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- val afterNormalizationEquivalence: Equivalence[A]
The
Equivalence
with which to determine equality after normalizing the left-hand and right-hand values.The
Equivalence
with which to determine equality after normalizing the left-hand and right-hand values.In this trait's implementation, this
val
is initialized with the result of invokingEquivalence.default[A]
. Thus defaultEquivalence
is the defaultafterNormalizationEquivalence
. This may be changed by overridingafterNormalizationEquivalence
in subclasses. - final def and(other: Normalization[A]): NormalizingEquivalence[A]
Returns a new
NormalizingEquivalence
that combines this and the passedNormalization
.Returns a new
NormalizingEquivalence
that combines this and the passedNormalization
.The
normalized
method of theNormalizingEquivalence
's returned by this method returns a result obtained by forwarding the passed value first to thisNormalizingEquivalence
's implementation of the method, then passing that result to the passedNormalization
's implementation of the method. Essentially, the body of the composednormalized
method is:uniformityPassedToAnd.normalized(uniformityOnWhichAndWasInvoked.normalized(a))
- other
a
Normalization
to 'and' with this one- returns
a
NormalizingEquivalence
representing the composition of this and the passedNormalization
- final def areEquivalent(a: A, b: A): Boolean
Determines the equality of two objects by normalizing the left-hand value,
a
, and the right-hand value,b
, then passing them toareEquivalent
method ofafterNormalizationEquivalence
.Determines the equality of two objects by normalizing the left-hand value,
a
, and the right-hand value,b
, then passing them toareEquivalent
method ofafterNormalizationEquivalence
.Both the left-hand value,
a
, and right-hand value,b
, are normalized by passing them to thenormalized
method of thisNormalizingEquivalence
.- a
a left-hand-side object being compared with another (right-hand-side one) for equality (e.g.,
a == b
)- b
a right-hand-side object being compared with another (left-hand-side one) for equality (e.g.,
a == b
)- returns
true if the passed objects are "equal," as defined by this
Equivalence
instance
- Definition Classes
- NormalizingEquivalence → Equivalence
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- final def toNormalization: Normalization[A]
Converts this
NormalizingEquivalence
to aNormalization
.Converts this
NormalizingEquivalence
to aNormalization
.- returns
a
Normalization
whosenormalized
method is implemented by forwarding to thenormalized
method of thisNormalizingEquivalence
.
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()