Class: HeadMusic::Time::EventMap::Event
- Inherits:
-
Struct
- Object
- Struct
- HeadMusic::Time::EventMap::Event
- Defined in:
- lib/head_music/time/event_map.rb
Overview
One (position, value) pair, carrying the sort tuple computed once at insert so that lookups never recompute it.
Instance Attribute Summary collapse
-
#position ⇒ Object
Returns the value of attribute position.
-
#tuple ⇒ Object
Returns the value of attribute tuple.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#after?(other_tuple) ⇒ Boolean
Array has no #>, so every ordering question goes through <=>.
- #at?(other_tuple) ⇒ Boolean
- #to_s ⇒ Object
Instance Attribute Details
#position ⇒ Object
Returns the value of attribute position
27 28 29 |
# File 'lib/head_music/time/event_map.rb', line 27 def position @position end |
#tuple ⇒ Object
Returns the value of attribute tuple
27 28 29 |
# File 'lib/head_music/time/event_map.rb', line 27 def tuple @tuple end |
#value ⇒ Object
Returns the value of attribute value
27 28 29 |
# File 'lib/head_music/time/event_map.rb', line 27 def value @value end |
Instance Method Details
#after?(other_tuple) ⇒ Boolean
Array has no #>, so every ordering question goes through <=>.
29 30 31 |
# File 'lib/head_music/time/event_map.rb', line 29 def after?(other_tuple) (tuple <=> other_tuple) > 0 end |
#at?(other_tuple) ⇒ Boolean
33 34 35 |
# File 'lib/head_music/time/event_map.rb', line 33 def at?(other_tuple) tuple == other_tuple end |
#to_s ⇒ Object
37 38 39 |
# File 'lib/head_music/time/event_map.rb', line 37 def to_s "#{position}=#{value}" end |