Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
graph_drawing
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
graph_drawing
Commits
e4a17ba8
Commit
e4a17ba8
authored
Feb 16, 2012
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added negation to Leaf representation.
parent
122476b1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
node.py
node.py
+7
-7
No files found.
node.py
View file @
e4a17ba8
...
@@ -22,14 +22,14 @@ class Node(object):
...
@@ -22,14 +22,14 @@ class Node(object):
return
len
(
self
.
nodes
)
return
len
(
self
.
nodes
)
def
__eq__
(
self
,
node
):
def
__eq__
(
self
,
node
):
return
isinstance
(
node
,
Node
)
\
return
isinstance
(
node
,
Node
)
and
self
.
value
==
node
.
value
\
and
self
.
value
==
node
.
value
and
self
.
nodes
==
node
.
nodes
and
self
.
nodes
==
node
.
nodes
def
__neg__
(
self
):
def
__neg__
(
self
):
cop
y
=
deepcopy
(
self
)
cop
ied
=
deepcopy
(
self
)
cop
y
.
negated
+=
1
cop
ied
.
negated
+=
1
return
cop
y
return
cop
ied
def
__str__
(
self
):
def
__str__
(
self
):
return
'<Node value=%s nodes=%s negated=%d>'
\
return
'<Node value=%s nodes=%s negated=%d>'
\
...
@@ -50,7 +50,7 @@ class Leaf(Node):
...
@@ -50,7 +50,7 @@ class Leaf(Node):
return
len
(
str
(
self
.
value
))
return
len
(
str
(
self
.
value
))
def
__repr__
(
self
):
def
__repr__
(
self
):
return
repr
(
self
.
value
)
return
repr
(
'-'
*
self
.
negated
+
str
(
self
.
value
)
)
def
__str__
(
self
):
def
__str__
(
self
):
return
'
-'
*
self
.
negated
+
str
(
self
.
value
)
return
'
<Leaf %s>'
%
repr
(
self
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment