Class: IntervalNotation::BasicIntervals::OpenClosedInterval
- Inherits:
-
Object
- Object
- IntervalNotation::BasicIntervals::OpenClosedInterval
show all
- Includes:
- ActslikeInterval
- Defined in:
- lib/interval_notation/basic_intervals.rb
Instance Method Summary
collapse
#eql?, #finite?, #from_finite?, #from_to_s, #hash, included, #inspect, #length, #singular_point?, #to_interval_set
Constructor Details
Returns a new instance of OpenClosedInterval.
72
73
74
75
76
77
|
# File 'lib/interval_notation/basic_intervals.rb', line 72
def initialize(from, to)
raise Error, "Interval (#{from};#{to}] can't be created" unless from < to
raise Error, "Infinite boundary should be open" unless to.to_f.finite?
@from = from
@to = to
end
|
Instance Method Details
#==(other) ⇒ Object
94
|
# File 'lib/interval_notation/basic_intervals.rb', line 94
def ==(other); other.is_a?(OpenClosedInterval) && from == other.from && to == other.to; end
|
#include_from? ⇒ Boolean
79
|
# File 'lib/interval_notation/basic_intervals.rb', line 79
def include_from?; false; end
|
#include_position?(value) ⇒ Boolean
93
|
# File 'lib/interval_notation/basic_intervals.rb', line 93
def include_position?(value); from < value && value <= to; end
|
#include_to? ⇒ Boolean
80
|
# File 'lib/interval_notation/basic_intervals.rb', line 80
def include_to?; true; end
|
#interval_boundaries(interval_index) ⇒ Object
95
96
97
98
|
# File 'lib/interval_notation/basic_intervals.rb', line 95
def interval_boundaries(interval_index)
[ BoundaryPoint.new(from, false, true, interval_index, true),
BoundaryPoint.new(to, true, false, interval_index, true) ]
end
|
#to_finite? ⇒ Boolean
82
|
# File 'lib/interval_notation/basic_intervals.rb', line 82
def to_finite?; true; end
|
#to_s ⇒ Object
78
|
# File 'lib/interval_notation/basic_intervals.rb', line 78
def to_s; "(#{from_to_s};#{to_to_s}]"; end
|
#to_to_s ⇒ Object
83
|
# File 'lib/interval_notation/basic_intervals.rb', line 83
def to_to_s; to; end
|