scala.math.Equiv.scala Maven / Gradle / Ivy
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2010, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
package scala.math
/**
* A trait for representing equivalence relations. It is important to
* distinguish between a type that can be compared for equality or
* equivalence and a representation of equivalence on some type. This
* trait is for representing the latter.
*
*
* An equivalence
* relation is a binary relation on a type. This relation is exposed as
* the equiv method of the Equiv trait. This
* relation must be:
*
*
* - reflexive:
equiv(x, x) == true, for any x of
* type T.
* - symmetric:
equiv(x, y) == equiv(y, x), for any
* x and y of type T.
* - transitive: if
equiv(x, y) == true and equiv(y, z) == true
* then equiv(x, z) == true, for any x, y,
* and z of type T.
*
*
* @author Geoffrey Washburn
* @version 1.0, 2008-04-03
* @since 2.7
*/
trait Equiv[T] {
/** Returns true iff x is equivalent to
* y.
*/
def equiv(x: T, y: T): Boolean
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy