org.scalautils

DefaultNormalizingEquality

trait DefaultNormalizingEquality [A] extends Equality[A] with Normalization[A]

An Equality implementation that determines the equality of two objects by normalizing both objects, if possible, and then comparing the results using default equality (as defined by the areEqual method of DefaultEquality).

import org.scalautils._

class StringEquality extends NormalizedEquality[String] { def isInstanceOfA(b: Any) = b.isInstanceOf[String] def normalized(s: String): String = s.trim.toLowerCase }

Linear Supertypes
Normalization[A], Equality[A], AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. DefaultNormalizingEquality
  2. Normalization
  3. Equality
  4. AnyRef
  5. Any
Visibility
  1. Public
  2. All

Abstract Value Members

  1. def isInstanceOfA (b: Any): Boolean

    Indicates whether the passed object is an instance of type A.

    Indicates whether the passed object is an instance of type A.

    This method is invoked by sibling method areEqual to determine whether or not b can be cast to A so that it can be safely passed to normalized. To implement this method, simply call b.isInstanceOf[A] for the actual A type. For example, if you are defining a NormalizedEquality[String], your isInstanceOf method should look like:

    def isInstanceOfA(b: Any) = b.isInstanceOf[String]
    

    If you are defining a NormalizedEquality[xml.Node] your isInstanceOf method should look like:

    def isInstanceOfA(b: Any) = b.isInstanceOf[xml.Node]
    

    b

    the object to inspect to determine whether it is an instance of A

    returns

    true if the passed object is an instance of A

    Attributes
    abstract
    Definition Classes
    DefaultNormalizingEqualityNormalization
  2. def normalized (o: A): A

    Normalizes the passed object.

    Normalizes the passed object.

    o

    the object to normalize

    returns

    the normalized form of the passed object

    Attributes
    abstract
    Definition Classes
    DefaultNormalizingEqualityNormalization

Concrete Value Members

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

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

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

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

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

    Attributes
    final
    Definition Classes
    Any
  6. def and (other: Normalization[A]): Normalization[A]

    Attributes
    final
    Definition Classes
    Normalization
  7. def areEqual (a: A, b: Any): Boolean

    Indicates whether the objects passed as a and b are equal by first passing b to the isInstanceOfA method.

    Indicates whether the objects passed as a and b are equal by first passing b to the isInstanceOfA method. If isInstanceOfA returns true, this method casts b to type A and passes that to normalized to obtain b in normalized form. This method then passes a to normalized, to obtain a in normalized form. Finally, this method invokes areEqual on DefaultEquality, passing the normalized a object, and either the normalized b object, if b was an instance of A, else just the raw, unnormalized b. This method returns the result of that areEqual invocation.

    a

    a left-hand-side object being compared with another (right-hand-side one) for equality

    b

    a right-hand-side object being compared with another (left-hand-side one) for equality

    returns

    true if the passed objects are "equal," as defined by this Equality instance@tparam A the type whose normalized equality is being defined

    Attributes
    final
    Definition Classes
    DefaultNormalizingEqualityEquality
  8. def asInstanceOf [T0] : T0

    Attributes
    final
    Definition Classes
    Any
  9. def clone (): AnyRef

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

    Attributes
    final
    Definition Classes
    AnyRef
  11. def equals (arg0: Any): Boolean

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

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

    Attributes
    final
    Definition Classes
    AnyRef → Any
  14. def hashCode (): Int

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

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

    Attributes
    final
    Definition Classes
    AnyRef
  17. def notify (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  18. def notifyAll (): Unit

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

    Attributes
    final
    Definition Classes
    AnyRef
  20. def toString (): String

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

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

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

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()

Inherited from Normalization[A]

Inherited from Equality[A]

Inherited from AnyRef

Inherited from Any