added == and != for equality
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
62c1aa6a8a
commit
59e762f52e
@ -70,3 +70,43 @@ public extension Optional where Wrapped: Collection {
|
|||||||
return self.isVisuallyEquivalent(to: models)
|
return self.isVisuallyEquivalent(to: models)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func == (lhs: (any MoleculeModelComparisonProtocol)?, rhs: (any MoleculeModelComparisonProtocol)?) -> Bool {
|
||||||
|
switch (lhs, rhs) {
|
||||||
|
case (.some(let lhs), .some(let rhs)):
|
||||||
|
return lhs.isEqual(to: rhs)
|
||||||
|
case (.none, .none):
|
||||||
|
return true
|
||||||
|
default:
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func != (lhs: (any MoleculeModelComparisonProtocol)?, rhs: (any MoleculeModelComparisonProtocol)?) -> Bool {
|
||||||
|
return !(lhs == rhs)
|
||||||
|
}
|
||||||
|
|
||||||
|
func == (lhs: [any MoleculeModelComparisonProtocol]?, rhs: [any MoleculeModelComparisonProtocol]?) -> Bool {
|
||||||
|
switch (lhs, rhs) {
|
||||||
|
case (.some(let lhs), .some(let rhs)):
|
||||||
|
return lhs == rhs
|
||||||
|
case (.none, .none):
|
||||||
|
return true
|
||||||
|
default:
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func != (lhs: [any MoleculeModelComparisonProtocol]?, rhs: [any MoleculeModelComparisonProtocol]?) -> Bool {
|
||||||
|
return !(lhs == rhs)
|
||||||
|
}
|
||||||
|
|
||||||
|
func == (lhs: [any MoleculeModelComparisonProtocol], rhs: [any MoleculeModelComparisonProtocol]) -> Bool {
|
||||||
|
return lhs.elementsEqual(rhs, by: { (lhsElement, rhsElement) -> Bool in
|
||||||
|
return lhsElement == rhsElement
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func != (lhs: [any MoleculeModelComparisonProtocol], rhs: [any MoleculeModelComparisonProtocol]) -> Bool {
|
||||||
|
return !(lhs == rhs)
|
||||||
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user