Class: Mgmg::IR::Reined

Inherits:
Object
  • Object
show all
Defined in:
lib/mgmg/ir.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(body, rein) ⇒ Reined

Returns a new instance of Reined.



140
141
142
# File 'lib/mgmg/ir.rb', line 140

def initialize(body, rein)
	@body, @rein = body, rein
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



143
144
145
# File 'lib/mgmg/ir.rb', line 143

def body
  @body
end

#reinObject

Returns the value of attribute rein.



143
144
145
# File 'lib/mgmg/ir.rb', line 143

def rein
  @rein
end

Instance Method Details

#evaluate(s, c) ⇒ Object



147
148
149
150
151
152
153
154
155
# File 'lib/mgmg/ir.rb', line 147

def evaluate(s, c)
	ret = @body.evaluate(s, c)
	@rein.each do |r|
		if r != 0
			ret *= (100+r).quo(100)
		end
	end
	ret
end

#evaluate3(s, a, c) ⇒ Object



156
157
158
159
160
161
162
163
164
# File 'lib/mgmg/ir.rb', line 156

def evaluate3(s, a, c)
	ret = @body.evaluate3(s, a, c)
	@rein.each do |r|
		if r != 0
			ret *= (100+r).quo(100)
		end
	end
	ret
end

#initialize_copy(other) ⇒ Object



144
145
146
# File 'lib/mgmg/ir.rb', line 144

def initialize_copy(other)
	@body, @rein = other.body.dup, other.rein.dup
end

#to_sObject



165
166
167
168
169
170
171
172
173
174
175
# File 'lib/mgmg/ir.rb', line 165

def to_s
	ret = @body.to_s
	buff = ''
	@rein.each do |r|
		if r != 0
			buff += "(#{100+r}/100)"
		end
	end
	ret = '('+ret+')'+buff unless buff.empty?
	ret
end