class RubyPager::Coord
Attributes
id[R]
x[R]
y[R]
Public Class Methods
new(ex_index,ex_data)
click to toggle source
# File lib/ruby_pager/coord.rb, line 6 def initialize(ex_index,ex_data) @data = ex_data @id = ex_index load_coords() end
Public Instance Methods
get_consolidated_data()
click to toggle source
# File lib/ruby_pager/coord.rb, line 26 def get_consolidated_data consolidate_data() return @data end
id=(ex_id)
click to toggle source
# File lib/ruby_pager/coord.rb, line 11 def id=(ex_id) raise(StandardError, "Got passed a negative value to update the x coord") if ex_id.to_i < 0 @id=ex_id.to_i end
vertical_noise(ex_std_dev)
click to toggle source
# File lib/ruby_pager/coord.rb, line 31 def vertical_noise(ex_std_dev) noise_generator=GaussianNoise.new(@y,ex_std_dev) @y=noise_generator.rand.to_i end
x=(x_coord)
click to toggle source
# File lib/ruby_pager/coord.rb, line 16 def x=(x_coord) raise(StandardError, "Got passed a negative value to update the x coord") if x_coord.to_i < 0 @x=x_coord.to_i end
y=(y_coord)
click to toggle source
# File lib/ruby_pager/coord.rb, line 21 def y=(y_coord) raise(StandardError, "Got passed a negative value to update the y coord") if y_coord.to_i < 0 @y=y_coord.to_i end
Private Instance Methods
consolidate_data()
click to toggle source
# File lib/ruby_pager/coord.rb, line 45 def consolidate_data @data="#{@x},#{@y}" end
load_coords()
click to toggle source
# File lib/ruby_pager/coord.rb, line 38 def load_coords() separate = @data.split(",") raise(StandardError,"Got passed coord data that doesn't have exactly two dimensions")if separate.size !=2 @x = separate[0].to_i @y = separate[1].to_i end