Class: OCL::Unary

Inherits:
Block
  • Object
show all
Defined in:
lib/dbc/ocl.rb

Overview

Xor

Direct Known Subclasses

CUnary, Not, UBitNot, UMinus, UPlus

Instance Method Summary collapse

Methods inherited from Block

check_condition, result, #to_s

Constructor Details

#initialize(exp) ⇒ Unary

Returns a new instance of Unary.



220
221
222
# File 'lib/dbc/ocl.rb', line 220

def initialize(exp)
	@expression = exp
end

Instance Method Details

#cexp?Boolean

Returns:

  • (Boolean)


223
224
225
# File 'lib/dbc/ocl.rb', line 223

def cexp?
	@expression.cexp?
end

#to_cexpObject



226
227
228
# File 'lib/dbc/ocl.rb', line 226

def to_cexp
	"#{csymbol}#{@expression.to_cexp}"
end

#to_exp(result, indent_str = '') ⇒ Object



229
230
231
232
233
234
# File 'lib/dbc/ocl.rb', line 229

def to_exp(result, indent_str = '')
	# expresssion should be a block
	str = ''
	str << @expression.to_exp(result, indent_str)
	str << indent_str << "#{result} = #{csymbol}#{result};\n"
end