Added similarity relation.
This commit is contained in:
parent
f58cd7f2f6
commit
9b282c4acb
|
|
@ -5,5 +5,9 @@ mod tree;
|
|||
mod test;
|
||||
|
||||
fn main() {
|
||||
unimplemented!();
|
||||
// safely: trust me!!
|
||||
// having fun or funly having?
|
||||
unsafe {
|
||||
std::hint::unreachable_unchecked()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
16
src/tree.rs
16
src/tree.rs
|
|
@ -93,3 +93,19 @@ impl<T: Eq, U: Float> Tree<T, U> {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct SimilarityRelation<T: Eq> {
|
||||
left: T,
|
||||
right: T,
|
||||
with_respect_to: T
|
||||
}
|
||||
|
||||
// implement symmetry
|
||||
impl<T: Eq> PartialEq for SimilarityRelation<T> {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
(
|
||||
(self.left == other.left && self.right == other.right)
|
||||
|| (self.left == other.right && self.right == other.left)
|
||||
)
|
||||
&& self.with_respect_to == other.with_respect_to
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue