Home | Trees | Indices | Help |
|
---|
|
object --+ | Equivalence
Representation of a general equivalence relation.
An Equivalence instance can be used to maintain a partition of objects into equivalence sets. Two objects x and y are considered equivalent either implicitly through a key function or explicitly. For the implicit case, x and y are equivalent if key(x) == key(y) for some provided function key (by default the identity function lambda x:x). For the explicit case, x and y are considered equivalent after a call to merge(x,y), regardless of their keys.
This class makes sure that the equivalence properties (reflexivity, symmetry, transitivity) are maintained, provided that key(x) remains fixed for a given object x (i.e. key is deterministic and does not depend on mutable state of x).
|
|||
|
|||
|
|||
|
|||
bool |
|
||
list of lists |
|
||
set |
|
||
|
|||
Inherited from |
|
|||
Inherited from |
|
|
Checks whether all objects are equivalent. An object doesn't have to be inserted first (through update or merge) in order to appear as an argument. In this case, its key is used to determine the partition it would belong if it was inserted.
|
objects into equivalence groups.
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0beta1 on Sun Jun 01 10:18:20 2008 | http://epydoc.sourceforge.net |