beaker.common.util.Relation.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of beaker-common_2.12 Show documentation
Show all versions of beaker-common_2.12 Show documentation
Reinventing database transactions
The newest version!
package beaker.common.util
import scala.language.implicitConversions
/**
* A binary relation. Relations are reflexive (x ~ x) and symmetric (x ~ y -> y ~ x).
*/
trait Relation[-T] {
/**
* Returns whether or not x and y are related.
*
* @param x An element.
* @param y Another element.
* @return Whether or not x and y are related.
*/
def related(x: T, y: T): Boolean
}
object Relation {
// All elements are related.
val Total: Relation[Any] = (x, y) => true
// All elements are unrelated.
val Identity: Relation[Any] = (x, y) => x == y
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy