Class: OCL::Or

Inherits:
Binary show all
Defined in:
lib/dbc/ocl.rb

Overview

And

Instance Method Summary collapse

Methods inherited from Binary

#cexp?, #initialize, #to_cexp

Methods inherited from Block

check_condition, result, #to_s

Constructor Details

This class inherits a constructor from OCL::Binary

Instance Method Details

#csymbolObject



210
# File 'lib/dbc/ocl.rb', line 210

def csymbol; '||' end

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



194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/dbc/ocl.rb', line 194

def to_exp(result, indent_str = '')
  str = ''
  if @expression1.cexp?
    str << Block.check_condition(@expression1.to_cexp, result, indent_str)
  else
    str << @expression1.to_exp(result, indent_str)
  end
  # if expression1 is true we must check condtion
  str << indent_str << "if (!#{result}) {\n"
  if @expression2.cexp?
    str << Block.check_condition(@expression2.to_cexp, result, "\t" << indent_str)
  else
    str << @expression2.to_exp(result, "\t" << indent_str)
  end
  str << indent_str << "}\n"
end