Class: OpenEHR::AssumedLibraryTypes::Interval

Inherits:
Any
  • Object
show all
Defined in:
lib/open_ehr/assumed_library_types.rb

Overview

of Any

Direct Known Subclasses

RM::DataTypes::Quantity::DvInterval

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Interval

Returns a new instance of Interval.



14
15
16
17
18
# File 'lib/open_ehr/assumed_library_types.rb', line 14

def initialize(args = {})
  check_lower_upper(args[:lower], args[:upper])
  self.lower_included = args[:lower_included]
  self.upper_included = args[:upper_included]
end

Instance Attribute Details

#lowerObject

Returns the value of attribute lower.



12
13
14
# File 'lib/open_ehr/assumed_library_types.rb', line 12

def lower
  @lower
end

#upperObject

Returns the value of attribute upper.



12
13
14
# File 'lib/open_ehr/assumed_library_types.rb', line 12

def upper
  @upper
end

Instance Method Details

#==(value) ⇒ Object



67
68
69
70
71
# File 'lib/open_ehr/assumed_library_types.rb', line 67

def ==(value)
  return (@lower == value.lower) && (@upper == value.upper) &&
    (@lower_included == value.lower_included?) &&
      (@upper_included == value.upper_included?)
end

#has?(value) ⇒ Boolean

Returns:

  • (Boolean)


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

def has?(value)
  if ((@lower.nil?||@lower < value||((@lower_included == true) && (@lower == value)))&&
      (@upper.nil?||value < @upper||((@upper_included == true) && (@upper == value))))
    true
  else
    false
  end
end

#lower_included=(lower_included) ⇒ Object



32
33
34
35
36
37
# File 'lib/open_ehr/assumed_library_types.rb', line 32

def lower_included=(lower_included)
  if (lower == nil) && (lower_included != nil)
    raise ArgumentError, "lower is not set"
  end
  @lower_included = lower_included
end

#lower_included?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/open_ehr/assumed_library_types.rb', line 28

def lower_included?
  return @lower_included
end

#lower_unbounded?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/open_ehr/assumed_library_types.rb', line 39

def lower_unbounded?
  return @lower.nil?
end

#upper_included=(upper_included) ⇒ Object



47
48
49
50
51
52
# File 'lib/open_ehr/assumed_library_types.rb', line 47

def upper_included=(upper_included)
  if (@upper.nil?) && (upper_included != nil)
    raise ArgumentError, "upper is not set"
  end
  @upper_included = upper_included
end

#upper_included?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/open_ehr/assumed_library_types.rb', line 43

def upper_included?
  return @upper_included
end

#upper_unbounded?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/open_ehr/assumed_library_types.rb', line 54

def upper_unbounded?
  return @upper.nil?
end