Class: IntervalNotation::BasicIntervals::ClosedClosedInterval
- Inherits:
-
Object
- Object
- IntervalNotation::BasicIntervals::ClosedClosedInterval
show all
- Includes:
- ActslikeInterval
- Defined in:
- lib/interval_notation/basic_intervals.rb
Instance Method Summary
collapse
#eql?, #hash, included, #inspect, #length, #singular_point?, #to_interval_set
Constructor Details
Returns a new instance of ClosedClosedInterval.
134
135
136
137
138
139
|
# File 'lib/interval_notation/basic_intervals.rb', line 134
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? && to.to_f.finite?
@from = from
@to = to
end
|
Instance Method Details
#==(other) ⇒ Object
153
|
# File 'lib/interval_notation/basic_intervals.rb', line 153
def ==(other); other.is_a?(ClosedClosedInterval) && from == other.from && to == other.to; end
|
#closure ⇒ Object
150
|
# File 'lib/interval_notation/basic_intervals.rb', line 150
def closure; self; end
|
#finite? ⇒ Boolean
146
|
# File 'lib/interval_notation/basic_intervals.rb', line 146
def finite?; true; end
|
#from_finite? ⇒ Boolean
144
|
# File 'lib/interval_notation/basic_intervals.rb', line 144
def from_finite?; true; end
|
#from_to_s ⇒ Object
147
|
# File 'lib/interval_notation/basic_intervals.rb', line 147
def from_to_s; from; end
|
#include_from? ⇒ Boolean
141
|
# File 'lib/interval_notation/basic_intervals.rb', line 141
def include_from?; true; end
|
#include_position?(value) ⇒ Boolean
152
|
# File 'lib/interval_notation/basic_intervals.rb', line 152
def include_position?(value); from <= value && value <= to; end
|
#include_to? ⇒ Boolean
142
|
# File 'lib/interval_notation/basic_intervals.rb', line 142
def include_to?; true; end
|
#interval_boundaries(interval_index) ⇒ Object
154
155
156
157
|
# File 'lib/interval_notation/basic_intervals.rb', line 154
def interval_boundaries(interval_index)
[ BoundaryPoint.new(from, true, true, interval_index, true),
BoundaryPoint.new(to, true, false, interval_index, true) ]
end
|
#to_finite? ⇒ Boolean
145
|
# File 'lib/interval_notation/basic_intervals.rb', line 145
def to_finite?; true; end
|
#to_s ⇒ Object
140
|
# File 'lib/interval_notation/basic_intervals.rb', line 140
def to_s; "[#{from_to_s};#{to_to_s}]"; end
|
#to_to_s ⇒ Object
148
|
# File 'lib/interval_notation/basic_intervals.rb', line 148
def to_to_s; to; end
|