Class: DancingLinks::SparseMatrix::SparseMatrixNode
- Inherits:
-
Object
- Object
- DancingLinks::SparseMatrix::SparseMatrixNode
- Defined in:
- lib/dancing_links.rb
Overview
All nodes within the matrix are instances of this class.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#down ⇒ Object
Returns the value of attribute down.
-
#header ⇒ Object
Returns the value of attribute header.
-
#left ⇒ Object
Returns the value of attribute left.
-
#right ⇒ Object
Returns the value of attribute right.
-
#row_num ⇒ Object
Returns the value of attribute row_num.
-
#up ⇒ Object
Returns the value of attribute up.
Instance Method Summary collapse
-
#initialize(row_num = -1,, header = self, left = self, right = self, up = self, down = self) ⇒ SparseMatrixNode
constructor
A new instance of SparseMatrixNode.
Constructor Details
#initialize(row_num = -1,, header = self, left = self, right = self, up = self, down = self) ⇒ SparseMatrixNode
Returns a new instance of SparseMatrixNode.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/dancing_links.rb', line 45 def initialize row_num=-1, header=self, left=self, right=self, up=self, down=self @row_num = row_num @header = header @left = left @right = right @up = up @down = down #puts "row: #{row_num}" @header.count = (@header.count + 1) if @header @left.right = self if @left @right.left = self if @right @up.down = self if @up @down.up = self if @down end |
Instance Attribute Details
#down ⇒ Object
Returns the value of attribute down.
62 63 64 |
# File 'lib/dancing_links.rb', line 62 def down @down end |
#header ⇒ Object
Returns the value of attribute header.
62 63 64 |
# File 'lib/dancing_links.rb', line 62 def header @header end |
#left ⇒ Object
Returns the value of attribute left.
62 63 64 |
# File 'lib/dancing_links.rb', line 62 def left @left end |
#right ⇒ Object
Returns the value of attribute right.
62 63 64 |
# File 'lib/dancing_links.rb', line 62 def right @right end |
#row_num ⇒ Object
Returns the value of attribute row_num.
62 63 64 |
# File 'lib/dancing_links.rb', line 62 def row_num @row_num end |
#up ⇒ Object
Returns the value of attribute up.
62 63 64 |
# File 'lib/dancing_links.rb', line 62 def up @up end |