Class: Vertex

Inherits:
Object
  • Object
show all
Includes:
Colorizeable
Defined in:
lib/vertex.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Colorizeable

#rgb_to_xterm, #xterm_color

Class Attribute Details

.color_widthObject

Returns the value of attribute color_width.



14
15
16
# File 'lib/vertex.rb', line 14

def color_width
  @color_width
end

.hueObject

Returns the value of attribute hue.



14
15
16
# File 'lib/vertex.rb', line 14

def hue
  @hue
end

.max_distObject

Returns the value of attribute max_dist.



14
15
16
# File 'lib/vertex.rb', line 14

def max_dist
  @max_dist
end

Instance Attribute Details

#distObject

Returns the value of attribute dist.



5
6
7
# File 'lib/vertex.rb', line 5

def dist
  @dist
end

#iObject

Returns the value of attribute i.



5
6
7
# File 'lib/vertex.rb', line 5

def i
  @i
end

#id=(value) ⇒ Object

Sets the attribute id

Parameters:

  • value

    the value to set the attribute id to.



5
6
7
# File 'lib/vertex.rb', line 5

def id=(value)
  @id = value
end

#jObject

Returns the value of attribute j.



5
6
7
# File 'lib/vertex.rb', line 5

def j
  @j
end

#labelObject Also known as: to_s

Returns the value of attribute label.



5
6
7
# File 'lib/vertex.rb', line 5

def label
  @label
end

#markedObject

Returns the value of attribute marked.



5
6
7
# File 'lib/vertex.rb', line 5

def marked
  @marked
end

Instance Method Details

#charObject



26
27
28
# File 'lib/vertex.rb', line 26

def char
  dist.to_s.chars.last
end

#mark(dist: 0) ⇒ Object



21
22
23
24
# File 'lib/vertex.rb', line 21

def mark(dist: 0)
  @marked = true
  @dist = dist
end

#marked?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/vertex.rb', line 17

def marked?
  marked
end

#resetObject



30
31
32
33
# File 'lib/vertex.rb', line 30

def reset
  @marked = false
  @dist = 0
end