2
2
** ________ ___ / / ___ Scala API **
3
** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL **
3
** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL **
4
4
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
5
5
** /____/\___/_/ |_/____/_/ | | **
11
/** In an attempt to contain the damage being inflicted on
12
* consistency by the ad hoc equals methods spread around
13
* xml, the logic is centralized and all the xml classes
14
* go through the xml.Equality trait. There are two forms
17
* 1) def strict_==(other: xml.Equality)
19
* This one tries to honor the little things like symmetry
20
* and hashCode contracts. The equals method routes all
21
* comparisons through this.
23
* 2) xml_==(other: Any)
25
* This one picks up where strict_== leaves off. It might
26
* declare any two things equal.
28
* As things stood, the logic not only made a mockery of
29
* the collections equals contract, but also laid waste to
30
* that of case classes.
11
/** In an attempt to contain the damage being inflicted on consistency by the
12
* ad hoc `equals` methods spread around `xml`, the logic is centralized and
13
* all the `xml` classes go through the `xml.Equality trait`. There are two
14
* forms of `xml` comparison.
16
* 1. `'''def''' strict_==(other: scala.xml.Equality)`
18
* This one tries to honor the little things like symmetry and hashCode
19
* contracts. The `equals` method routes all comparisons through this.
21
* 1. `xml_==(other: Any)`
23
* This one picks up where `strict_==` leaves off. It might declare any two
26
* As things stood, the logic not only made a mockery of the collections
27
* equals contract, but also laid waste to that of case classes.
32
29
* Among the obstacles to sanity are/were:
72
68
trait Equality extends scala.Equals {
73
def basisForHashCode: Seq[Any]
69
protected def basisForHashCode: Seq[Any]
74
71
def strict_==(other: Equality): Boolean
75
72
def strict_!=(other: Equality) = !strict_==(other)
77
/** We insist we're only equal to other xml.Equality implementors,
74
/** We insist we're only equal to other `xml.Equality` implementors,
78
75
* which heads off a lot of inconsistency up front.
80
77
override def canEqual(other: Any): Boolean = other match {