trait NormalizingEquality[A] extends Equality[A]
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
the afterNormalizationEquality member. By default, the afterNormalizationEquality is
an instance of Equality.default[A].
NormalizingEquality is returned by the Explicitly DSL's “after being”
syntax, using for the afterNormalizationEquality the implicit Equality in scope for the type
of Uniformity passed to being. Here's an example:
scala> import org.scalactic._ import org.scalactic._ scala> import Explicitly._ import Explicitly._ scala> import StringNormalizations._ import StringNormalizations._ scala> after being lowerCased res0: org.scalactic.NormalizingEquality[String] = ComposedNormalizingEquality(Equality.default,lowerCased)
- Self Type
- NormalizingEquality[A]
- Source
- NormalizingEquality.scala
- Alphabetic
- By Inheritance
- NormalizingEquality
- Equality
- 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
- abstract def normalizedCanHandle(b: Any): Boolean
Indicates whether this
NormalizingEquality'snormalizedmethod can “handle” the passed object, if cast to the appropriate typeA.Indicates whether this
NormalizingEquality'snormalizedmethod can “handle” the passed object, if cast to the appropriate typeA.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 tonormalized. It does not mean that the object will necessarily be modified when passed tonormalizedOrSameornormalized. For more information and examples, see the documentation fornormalizedCanHandlein traitUniformity, which has the same contract. - abstract def normalizedOrSame(b: Any): Any
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.- b
the object to normalize, if appropriate
- returns
a normalized form of the passed object, if this
Uniformitywas able to normalize it, else the same object passed
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 afterNormalizationEquality: Equality[A]
The
Equalitywith which to determine equality after normalizing the left-hand and, if appropriate, the right-hand values.The
Equalitywith which to determine equality after normalizing the left-hand and, if appropriate, the right-hand values.In this trait's implementation, this
valis initialized with the result of invokingEquality.default[A]. Thus defaultEqualityis the defaultafterNormalizationEquality. This may be changed by overridingafterNormalizationEqualityin subclasses. - final def and(other: Uniformity[A]): NormalizingEquality[A]
Returns a new
NormalizingEqualitythat combines this and the passedUniformity.Returns a new
NormalizingEqualitythat combines this and the passedUniformity.The
normalizedandnormalizedOrSamemethods of theNormalizingEquality's returned by this method return a result obtained by forwarding the passed value first to thisNormalizingEquality's implementation of the method, then passing that result to the passedUniformity's implementation of the method, respectively. Essentially, the body of the composednormalizedmethod is:uniformityPassedToAnd.normalized(uniformityOnWhichAndWasInvoked.normalized(a))
And the body of the composed
normalizedOrSamemethod is:uniformityPassedToAnd.normalizedOrSame(uniformityOnWhichAndWasInvoked.normalizedOrSame(a))
The
normalizeCanHandlemethod of theNormalizingEqualityreturned by this method returns a result obtained by anding the result of forwarding the passed value to thisNormalizingEquality's implementation of the method with the result of forwarding it to the passedUniformity's implementation. Essentially, the body of the composednormalizeCanHandlemethod is:normEqOnWhichAndWasInvoked.normalizeCanHandle(a) && uniformityPassedToAnd.normalizeCanHandle(a)
- other
a
Uniformityto 'and' with this one- returns
a
NormalizingEqualityrepresenting the composition of this and the passedUniformity
- final def areEqual(a: A, b: Any): Boolean
Determines the equality of two objects by normalizing the left-hand value,
a, and, if appropriate, the right-hand value,b, then passing them toareEqualmethod ofafterNormalizationEquality.Determines the equality of two objects by normalizing the left-hand value,
a, and, if appropriate, the right-hand value,b, then passing them toareEqualmethod ofafterNormalizationEquality.The left-hand value,
a, is normalized by passing it to thenormalizedmethod of thisNormalizingEquality. The right-hand value,b, is normalized, if appropriate, by passing it to thenormalizedOrSamemethod of thisNormalizingEquality.- a
a left-hand value being compared with another (right-hand-side one) for equality (e.g.,
a == b)- b
a right-hand value 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
Equalityinstance
- Definition Classes
- NormalizingEquality → Equality
- final def areEquivalent(a: A, b: A): Boolean
A final implementation of the
areEquivalentmethod ofEquivalencethat just passesaandbtoareEqualand returns the result.A final implementation of the
areEquivalentmethod ofEquivalencethat just passesaandbtoareEqualand returns the result.This method enables any
Equalityto be used where anEquivalenceis needed, such as the implicit enabling methods ofTypeCheckedTripleEqualsandConversionCheckedTripleEquals.- a
a left-hand value being compared with another, right-hand, value for equality (e.g.,
a == b)- b
a right-hand value being compared with another, left-hand, value for equality (e.g.,
a == b)- returns
true if the passed objects are "equal," as defined by the
areEqualmethod of thisEqualityinstance
- Definition Classes
- Equality → 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
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def toUniformity: Uniformity[A]
Converts this
NormalizingEqualityto aUniformity.Converts this
NormalizingEqualityto aUniformity.- returns
a
Uniformitywhosenormalized,normalizedCanHandle, andnormalizedOrSamemethods are implemented by the corresponding methods of thisNormalizingEquality.
- 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()