operator == method
Provides structural equality for tissues.
Equality is determined by:
- Identity: If both references point to the same object.
- Unmodifiable Linkage: If
otheris an Unmodifiable view pointing back tothis. - Content Equality: If
otheris a standard Iterable, equality is delegated to the underlying_nucleus.container.
When to use
This operator is called automatically when comparing tissues for equality. You rarely need to invoke it directly.
How it works
- First checks if the objects are identical (same instance).
- If
otheris an Unmodifiable view ofthis, returnstrue. - If
otheris an Iterable, delegates to the underlying container's equality logic. - Otherwise, returns
false.
Parameters:
other: The object to compare with this tissue.
Returns:
true if the tissues are equal; false otherwise.
Implementation
@override
bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
if (other is Tissue<E>) {
if (other is Unmodifiable) {
if (other._nucleus.bind != null &&
identical(this, other._nucleus.bind)) {
return identical(other, unmodifiable);
}
}
}
if (other is Iterable<E>) {
return _nucleus.container == other;
}
return false;
}