Class: Yzz::SidePair
Overview
This class represents a pair of a negward and posward side (Yzz::Side instance) of a Yzz cell along a certain dimension.
Instance Attribute Summary collapse
-
#dimension ⇒ Object
readonly
Returns the value of attribute dimension.
-
#negward ⇒ Object
(also: #n)
readonly
Returns the value of attribute negward.
-
#posward ⇒ Object
(also: #p)
readonly
Returns the value of attribute posward.
-
#zz ⇒ Object
readonly
Returns the value of attribute zz.
Instance Method Summary collapse
-
#*(new_neighbor) ⇒ Object
Crossovers a new neighbor posward.
-
#>>(new_neighbor) ⇒ Object
Links a neighbor posward.
-
#initialize(zz: ( raise ArgumentError, ":zz missing!" ), dimension: ( raise ArgumentError, ":dimension missing!" ), negward_neighbor: nil, posward_neighbor: nil) ⇒ SidePair
constructor
A new instance of SidePair.
-
#inspect ⇒ Object
Instance inspect string.
-
#N ⇒ Object
Returns negward neighbor.
-
#P ⇒ Object
Returns posward neighbor.
-
#to_s ⇒ Object
Returns the string briefly describing the instance.
Constructor Details
#initialize(zz: ( raise ArgumentError, ":zz missing!" ), dimension: ( raise ArgumentError, ":dimension missing!" ), negward_neighbor: nil, posward_neighbor: nil) ⇒ SidePair
Returns a new instance of SidePair.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/yzz/side_pair.rb', line 9 def initialize( zz: ( raise ArgumentError, ":zz missing!" ), dimension: ( raise ArgumentError, ":dimension missing!" ), negward_neighbor: nil, posward_neighbor: nil ) @zz, @dimension = zz, dimension @negward = Yzz::Side.new( zz: zz, dimension: dimension, direction: :negward, neighbor: negward_neighbor ) @posward = Yzz::Side.new( zz: zz, dimension: dimension, direction: :posward, neighbor: posward_neighbor ) end |
Instance Attribute Details
#dimension ⇒ Object (readonly)
Returns the value of attribute dimension.
5 6 7 |
# File 'lib/yzz/side_pair.rb', line 5 def dimension @dimension end |
#negward ⇒ Object (readonly) Also known as: n
Returns the value of attribute negward.
5 6 7 |
# File 'lib/yzz/side_pair.rb', line 5 def negward @negward end |
#posward ⇒ Object (readonly) Also known as: p
Returns the value of attribute posward.
5 6 7 |
# File 'lib/yzz/side_pair.rb', line 5 def posward @posward end |
#zz ⇒ Object (readonly)
Returns the value of attribute zz.
5 6 7 |
# File 'lib/yzz/side_pair.rb', line 5 def zz @zz end |
Instance Method Details
#*(new_neighbor) ⇒ Object
Crossovers a new neighbor posward.
32 33 34 |
# File 'lib/yzz/side_pair.rb', line 32 def * new_neighbor posward * new_neighbor end |
#>>(new_neighbor) ⇒ Object
Links a neighbor posward.
26 27 28 |
# File 'lib/yzz/side_pair.rb', line 26 def >> new_neighbor new_neighbor.along( dimension ).tap { posward << new_neighbor } end |
#inspect ⇒ Object
Instance inspect string.
52 53 54 |
# File 'lib/yzz/side_pair.rb', line 52 def inspect to_s end |
#N ⇒ Object
Returns negward neighbor.
42 |
# File 'lib/yzz/side_pair.rb', line 42 def N; negward.neighbor end |
#P ⇒ Object
Returns posward neighbor.
38 |
# File 'lib/yzz/side_pair.rb', line 38 def P; posward.neighbor end |
#to_s ⇒ Object
Returns the string briefly describing the instance.
46 47 48 |
# File 'lib/yzz/side_pair.rb', line 46 def to_s "#<Yzz::SidePair: #{zz} along #{dimension}>" end |