Class: OCL::Range

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

Overview

Label

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(first, last, exclude_end) ⇒ Range

Returns a new instance of Range.



50
51
52
53
54
# File 'lib/dbc/ocl.rb', line 50

def initialize(first, last, exclude_end)
	@first = first
	@last = last
	@exclude_end = (exclude_end == true)
end

Instance Attribute Details

#firstObject (readonly)

Returns the value of attribute first.



66
67
68
# File 'lib/dbc/ocl.rb', line 66

def first
  @first
end

#lastObject (readonly)

Returns the value of attribute last.



66
67
68
# File 'lib/dbc/ocl.rb', line 66

def last
  @last
end

Instance Method Details

#exclude_end?Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/dbc/ocl.rb', line 55

def exclude_end?
	@exclude_end
end

#test_expression(expression) ⇒ Object



58
59
60
61
62
63
64
65
# File 'lib/dbc/ocl.rb', line 58

def test_expression(expression)
	if @exclude_end
		s = '<'
	else
		s = '<='
	end 
	"(((#{@first}) <= (#{expression})) && ((#{expression}) #{s} (#{@last})))"
end