Class: Obfuscator::BinaryExpression

Inherits:
Expression show all
Defined in:
lib/number_obfuscator/binary_expression.rb

Direct Known Subclasses

Division, Multiplication, Subtraction, Summation

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Expression

addType, makeExpression, #to_s, #to_tex

Constructor Details

#initialize(l, r) ⇒ BinaryExpression

Returns a new instance of BinaryExpression


9
10
11
12
# File 'lib/number_obfuscator/binary_expression.rb', line 9

def initialize(l, r)
  @left  = l
  @right = r
end

Instance Attribute Details

#leftObject (readonly)

Returns the value of attribute left


5
6
7
# File 'lib/number_obfuscator/binary_expression.rb', line 5

def left
  @left
end

#rightObject (readonly)

Returns the value of attribute right


6
7
8
# File 'lib/number_obfuscator/binary_expression.rb', line 6

def right
  @right
end

Class Method Details

.make(n, depth) ⇒ Object


14
15
16
17
18
# File 'lib/number_obfuscator/binary_expression.rb', line 14

def self.make(n, depth)
  (l, r) = makePair(n)
  self.new(makeExpression(l, depth - 1),
           makeExpression(r, depth - 1))
end