Class: IntervalNotation::BasicIntervals::ClosedOpenInterval
- Inherits:
-
Object
- Object
- IntervalNotation::BasicIntervals::ClosedOpenInterval
show all
- Includes:
- ActslikeInterval
- Defined in:
- lib/interval_notation/basic_intervals.rb
Instance Method Summary
collapse
#eql?, #finite?, #hash, included, #inspect, #length, #singular_point?, #to_finite?, #to_interval_set, #to_to_s
Constructor Details
Returns a new instance of ClosedOpenInterval.
103
104
105
106
107
108
|
# File 'lib/interval_notation/basic_intervals.rb', line 103
def initialize(from, to)
raise Error, "Interval [#{from};#{to}) can't be created" unless from < to
raise Error, "Infinite boundary should be open" unless from.to_f.finite?
@from = from
@to = to
end
|
Instance Method Details
#==(other) ⇒ Object
125
|
# File 'lib/interval_notation/basic_intervals.rb', line 125
def ==(other); other.is_a?(ClosedOpenInterval) && from == other.from && to == other.to; end
|
#from_finite? ⇒ Boolean
113
|
# File 'lib/interval_notation/basic_intervals.rb', line 113
def from_finite?; true; end
|
#from_to_s ⇒ Object
114
|
# File 'lib/interval_notation/basic_intervals.rb', line 114
def from_to_s; from; end
|
#include_from? ⇒ Boolean
110
|
# File 'lib/interval_notation/basic_intervals.rb', line 110
def include_from?; true; end
|
#include_position?(value) ⇒ Boolean
124
|
# File 'lib/interval_notation/basic_intervals.rb', line 124
def include_position?(value); from <= value && value < to; end
|
#include_to? ⇒ Boolean
111
|
# File 'lib/interval_notation/basic_intervals.rb', line 111
def include_to?; false; end
|
#interval_boundaries(interval_index) ⇒ Object
126
127
128
129
|
# File 'lib/interval_notation/basic_intervals.rb', line 126
def interval_boundaries(interval_index)
[ BoundaryPoint.new(from, true, true, interval_index, true),
BoundaryPoint.new(to, false, false, interval_index, true) ]
end
|
#to_s ⇒ Object
109
|
# File 'lib/interval_notation/basic_intervals.rb', line 109
def to_s; "[#{from_to_s};#{to_to_s})"; end
|