Class: IntervalNotation::BasicIntervals::OpenOpenInterval
- Inherits:
-
Object
- Object
- IntervalNotation::BasicIntervals::OpenOpenInterval
show all
- Includes:
- ActslikeInterval
- Defined in:
- lib/interval_notation/basic_intervals.rb
Instance Method Summary
collapse
#closure, #deep_include_position?, #eql?, #finite?, #from_finite?, #from_infinite?, #from_to_s, #hash, included, #infinite?, #inspect, #length, #singular_point?, #to_finite?, #to_infinite?, #to_interval_set, #to_to_s
Constructor Details
Returns a new instance of OpenOpenInterval.
65
66
67
68
69
|
# File 'lib/interval_notation/basic_intervals.rb', line 65
def initialize(from, to)
raise Error, "Interval (#{from};#{to}) can't be created" unless from < to
@from = from
@to = to
end
|
Instance Method Details
#==(other) ⇒ Object
74
|
# File 'lib/interval_notation/basic_intervals.rb', line 74
def ==(other); other.is_a?(OpenOpenInterval) && from == other.from && to == other.to; end
|
#include_from? ⇒ Boolean
71
|
# File 'lib/interval_notation/basic_intervals.rb', line 71
def include_from?; false; end
|
#include_position?(value) ⇒ Boolean
73
|
# File 'lib/interval_notation/basic_intervals.rb', line 73
def include_position?(value); from < value && value < to; end
|
#include_to? ⇒ Boolean
72
|
# File 'lib/interval_notation/basic_intervals.rb', line 72
def include_to?; false; end
|
#integer_points ⇒ Object
79
|
# File 'lib/interval_notation/basic_intervals.rb', line 79
def integer_points; (from + 1).floor .. (to - 1).ceil; end
|
#interval_boundaries(interval_index) ⇒ Object
75
76
77
78
|
# File 'lib/interval_notation/basic_intervals.rb', line 75
def interval_boundaries(interval_index)
[ BoundaryPoint.new(from, false, true, interval_index, true),
BoundaryPoint.new(to, false, false, interval_index, true) ]
end
|
#to_s ⇒ Object
70
|
# File 'lib/interval_notation/basic_intervals.rb', line 70
def to_s; "(#{from_to_s};#{to_to_s})"; end
|