class RubyPager::Coords
Public Class Methods
blank()
click to toggle source
# File lib/ruby_pager/coords.rb, line 11 def self.blank return Coords.new(Coords.blank_data) end
blank_data()
click to toggle source
# File lib/ruby_pager/coords.rb, line 54 def self.blank_data res = "" return res end
new(ex_coords_string)
click to toggle source
# File lib/ruby_pager/coords.rb, line 5 def initialize(ex_coords_string) @data = ex_coords_string @points=Array.new load_points() end
Public Instance Methods
[](ex_index)
click to toggle source
# File lib/ruby_pager/coords.rb, line 19 def [](ex_index) raise(RangeError, "Index #{ex_index} is out of range") unless ex_index.between?(0,@points.size-1) return @points[ex_index] end
clear()
click to toggle source
# File lib/ruby_pager/coords.rb, line 35 def clear @points.clear end
delete(ex_delete_index)
click to toggle source
# File lib/ruby_pager/coords.rb, line 45 def delete(ex_delete_index) @points.delete_at(ex_delete_index) review_points_index() end
get_consolidated_data()
click to toggle source
# File lib/ruby_pager/coords.rb, line 24 def get_consolidated_data consolidate_data() return @data end
push(ex_coord)
click to toggle source
# File lib/ruby_pager/coords.rb, line 29 def push(ex_coord) raise(ArgumentError, "Got passed a non coord object") if ex_coord.class != RubyPager::Coord ex_coord.id=@points.size @points.push(ex_coord) end
reload(ex_coord_string)
click to toggle source
# File lib/ruby_pager/coords.rb, line 39 def reload(ex_coord_string) clear @data=ex_coord_string load_points end
size()
click to toggle source
# File lib/ruby_pager/coords.rb, line 15 def size return @points.size end
vertical_noise(ex_std_dev)
click to toggle source
# File lib/ruby_pager/coords.rb, line 50 def vertical_noise(ex_std_dev) @points.each {|point| point.vertical_noise(ex_std_dev)} end
Private Instance Methods
consolidate_data()
click to toggle source
# File lib/ruby_pager/coords.rb, line 67 def consolidate_data @data="" @points.each {|point| @data+=" " if @data.size() > 0 @data+= point.get_consolidated_data} end
load_points()
click to toggle source
# File lib/ruby_pager/coords.rb, line 60 def load_points() coord_string_array= @data.split coord_string_array.each_with_index {|string_coord,index| @points.push(Coord.new(index,string_coord)) } end
review_points_index()
click to toggle source
# File lib/ruby_pager/coords.rb, line 74 def review_points_index @points.each_with_index {|point,index | point.id=index} end