org.scalautils

NormalizingEquality

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.scalautils._
import org.scalautils._

scala> import Explicitly._ import Explicitly._

scala> import StringNormalizations._ import StringNormalizations._

scala> after being lowerCased res0: org.scalautils.NormalizingEquality[String] = ComposedNormalizingEquality(Equality.default,lowerCased)

Self Type
NormalizingEquality[A]
Source
NormalizingEquality.scala
Linear Supertypes
Equality[A], Equivalence[A], AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. NormalizingEquality
  2. Equality
  3. Equivalence
  4. AnyRef
  5. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Abstract Value Members

  1. 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

  2. abstract def normalizedCanHandle(b: Any): Boolean

    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.

  3. 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 Uniformity was able to normalize it, else the same object passed

Concrete Value Members

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

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

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

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. val afterNormalizationEquality: Equality[A]

    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.

  7. final def and(other: Uniformity[A]): NormalizingEquality[A]

    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)
    

    other

    a Uniformity to 'and' with this one

    returns

    a NormalizingEquality representing the composition of this and the passed Uniformity

  8. 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 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

    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 Equality instance

    Definition Classes
    NormalizingEqualityEquality
  9. final def areEquivalent(a: A, b: A): Boolean

    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

    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 areEqual method of this Equality instance

    Definition Classes
    EqualityEquivalence
  10. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  11. def clone(): AnyRef

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

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

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

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

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

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

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

    Definition Classes
    AnyRef
  19. final def notify(): Unit

    Definition Classes
    AnyRef
  20. final def notifyAll(): Unit

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

    Definition Classes
    AnyRef
  22. def toString(): String

    Definition Classes
    AnyRef → Any
  23. final def toUniformity: Uniformity[A]

    Converts this NormalizingEquality to a Uniformity.

    Converts this NormalizingEquality to a Uniformity.

    returns

    a Uniformity whose normalized, normalizedCanHandle, and normalizedOrSame methods are implemented by the corresponding methods of this NormalizingEquality.

  24. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws()

Inherited from Equality[A]

Inherited from Equivalence[A]

Inherited from AnyRef

Inherited from Any

Ungrouped