Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions src/freeplane.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,15 @@ def __init__(self,
_node3.attrib["BUILTIN"] = "yes"
_node2.append(_node3)


def __eq__(self, __value) -> bool:
"""
compares two mindmaps by recursively comparing their nodes

:returns: bool
"""
return self.rootnode == __value.rootnode

# MAP

@classmethod
Expand Down Expand Up @@ -1138,6 +1147,33 @@ def __str__(self):
return self.plaintext


def __eq__(self, __value) -> bool:
"""
compares two nodes by comparing some of their attributes and
recursively comparing their children

supported attributes for comparison: plaintext, hyperlink, imagepath, details

:returns: bool
"""
if self.plaintext != __value.plaintext:
return False

if self.hyperlink != __value.hyperlink:
return False

if self.imagepath != __value.imagepath:
return False

if self.details != __value.details:
return False

if len(self.children) != len(__value.children):
return False

return all([self.children[i] == __value.children[i] for i in range(len(self.children))])


@property
def is_detached_head(self):
"""
Expand Down