Class: AStar::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/IFMapper/AStar.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(info = nil) ⇒ Node

Returns a new instance of Node.



54
55
56
57
# File 'lib/IFMapper/AStar.rb', line 54

def initialize( info = nil )
  @h = @g = @f = 0.0
  @info = info
end

Instance Attribute Details

#childObject

Returns the value of attribute child.



39
40
41
# File 'lib/IFMapper/AStar.rb', line 39

def child
  @child
end

#fObject

Returns the value of attribute f.



40
41
42
# File 'lib/IFMapper/AStar.rb', line 40

def f
  @f
end

#gObject

Returns the value of attribute g.



40
41
42
# File 'lib/IFMapper/AStar.rb', line 40

def g
  @g
end

#hObject

Returns the value of attribute h.



40
41
42
# File 'lib/IFMapper/AStar.rb', line 40

def h
  @h
end

#infoObject (readonly)

Returns the value of attribute info.



42
43
44
# File 'lib/IFMapper/AStar.rb', line 42

def info
  @info
end

#parentObject

Returns the value of attribute parent.



39
40
41
# File 'lib/IFMapper/AStar.rb', line 39

def parent
  @parent
end

Instance Method Details

#<=>(b) ⇒ Object



44
45
46
47
48
# File 'lib/IFMapper/AStar.rb', line 44

def <=>(b)
  return -1 if @f > b.f
  return  0 if @f == b.f
  return  1
end

#inspectObject



50
51
52
# File 'lib/IFMapper/AStar.rb', line 50

def inspect
  "AStarNode: #{@f} = #{@g} + #{@h} #{@info.inspect}"
end