Class: RubyPager::Coords

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_pager/coords.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ex_coords_string) ⇒ Coords

Returns a new instance of Coords.



5
6
7
8
9
# File 'lib/ruby_pager/coords.rb', line 5

def initialize(ex_coords_string)
  @data = ex_coords_string
  @points=Array.new
  load_points()
end

Class Method Details

.blankObject



11
12
13
# File 'lib/ruby_pager/coords.rb', line 11

def self.blank
  return Coords.new(Coords.blank_data)
end

.blank_dataObject



54
55
56
57
# File 'lib/ruby_pager/coords.rb', line 54

def self.blank_data
  res = ""
  return res
end

Instance Method Details

#[](ex_index) ⇒ Object

Raises:

  • (RangeError)


19
20
21
22
# 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

#clearObject



35
36
37
# File 'lib/ruby_pager/coords.rb', line 35

def clear
  @points.clear
end

#delete(ex_delete_index) ⇒ Object



45
46
47
48
# 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_dataObject



24
25
26
27
# File 'lib/ruby_pager/coords.rb', line 24

def get_consolidated_data
  consolidate_data()
  return @data
end

#push(ex_coord) ⇒ Object

Raises:

  • (ArgumentError)


29
30
31
32
33
# 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) ⇒ Object



39
40
41
42
43
# File 'lib/ruby_pager/coords.rb', line 39

def reload(ex_coord_string)
  clear
  @data=ex_coord_string
  load_points
end

#sizeObject



15
16
17
# File 'lib/ruby_pager/coords.rb', line 15

def size
  return @points.size
end

#vertical_noise(ex_std_dev) ⇒ Object



50
51
52
# File 'lib/ruby_pager/coords.rb', line 50

def vertical_noise(ex_std_dev)
  @points.each {|point| point.vertical_noise(ex_std_dev)}
end