class Yzz::SidePair

This class represents a pair of a negward and posward side (Yzz::Side instance) of a Yzz cell along a certain dimension.

Attributes

n[R]
negward[R]
p[R]
posward[R]

Public Class Methods

new( negward_neighbor: nil, posward_neighbor: nil ) click to toggle source

Takes two optional named parameters, :negward_neighbor and :posward_neigbor. If not given, the sides are constructed not linked to any neigbors.

# File lib/yzz/side_pair.rb, line 27
def initialize( negward_neighbor: nil, posward_neighbor: nil )
  param_class!( { NegwardSide: ::Yzz::NegwardSide,
                  PoswardSide: ::Yzz::PoswardSide },
                with: { zz: zz, dimension: dimension } )
  @negward = NegwardSide().new( neighbor: negward_neighbor )
  @posward = PoswardSide().new( neighbor: posward_neighbor )
end

Public Instance Methods

*(new_neighbor) click to toggle source

Crossovers the supplied zz object posward.

# File lib/yzz/side_pair.rb, line 43
def * new_neighbor
  posward * new_neighbor
end
>>(new_neighbor) click to toggle source

Makes the supplied object the posward neighbor of the receiver.

# File lib/yzz/side_pair.rb, line 37
def >> new_neighbor
  new_neighbor.along( dimension ).tap { posward << new_neighbor }
end
N() click to toggle source

Returns negward neighbor.

# File lib/yzz/side_pair.rb, line 53
def N; negward.neighbor end
P() click to toggle source

Returns posward neighbor.

# File lib/yzz/side_pair.rb, line 49
def P; posward.neighbor end
inspect() click to toggle source

Instance inspect string.

# File lib/yzz/side_pair.rb, line 63
def inspect
  to_s
end
to_s() click to toggle source

Returns the string briefly describing the instance.

# File lib/yzz/side_pair.rb, line 57
def to_s
  "#<Yzz::SidePair: #{zz} along #{dimension}>"
end
zz() click to toggle source

Reader zz delegates to the class, relying on parametrized subclassing.

# File lib/yzz/side_pair.rb, line 11
def zz
  self.class.zz 
end