Trait

org.scalactic

NormalizingEquivalence

Related Doc: package scalactic

Permalink

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]
Linear Supertypes
Equivalence[A], AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. NormalizingEquivalence
  2. Equivalence
  3. AnyRef
  4. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def normalized(a: A): A

    Permalink

    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

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. val afterNormalizationEquivalence: Equivalence[A]

    Permalink

    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 invoking Equivalence.default[A]. Thus default Equivalence is the default afterNormalizationEquivalence. This may be changed by overriding afterNormalizationEquivalence in subclasses.

  5. final def and(other: Normalization[A]): NormalizingEquivalence[A]

    Permalink

    Returns a new NormalizingEquivalence that combines this and the passed Normalization.

    Returns a new NormalizingEquivalence that combines this and the passed Normalization.

    The normalized method of the NormalizingEquivalence's returned by this method returns a result obtained by forwarding the passed value first to this NormalizingEquivalence's implementation of the method, then passing that result to the passed Normalization's implementation of the method. Essentially, the body of the composed normalized 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 passed Normalization

  6. final def areEquivalent(a: A, b: A): Boolean

    Permalink

    Determines the equality of two objects by normalizing the left-hand value, a, and the right-hand value, b, then passing them to areEquivalent method of afterNormalizationEquivalence.

    Determines the equality of two objects by normalizing the left-hand value, a, and the right-hand value, b, then passing them to areEquivalent method of afterNormalizationEquivalence.

    Both the left-hand value, a, and right-hand value, b, are normalized by passing them to the normalized method of this NormalizingEquivalence.

    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
    NormalizingEquivalenceEquivalence
  7. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  8. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  13. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  14. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  16. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  17. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  18. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  19. final def toNormalization: Normalization[A]

    Permalink

    Converts this NormalizingEquivalence to a Normalization.

    Converts this NormalizingEquivalence to a Normalization.

    returns

    a Normalization whose normalized method is implemented by forwarding to the normalized method of this NormalizingEquivalence.

  20. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  21. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Equivalence[A]

Inherited from AnyRef

Inherited from Any

Ungrouped