Class: AStar::Node
- Inherits:
-
Object
- Object
- AStar::Node
- Defined in:
- lib/IFMapper/AStar.rb
Instance Attribute Summary collapse
-
#child ⇒ Object
Returns the value of attribute child.
-
#f ⇒ Object
Returns the value of attribute f.
-
#g ⇒ Object
Returns the value of attribute g.
-
#h ⇒ Object
Returns the value of attribute h.
-
#info ⇒ Object
readonly
Returns the value of attribute info.
-
#parent ⇒ Object
Returns the value of attribute parent.
Instance Method Summary collapse
- #<=>(b) ⇒ Object
-
#initialize(info = nil) ⇒ Node
constructor
A new instance of Node.
- #inspect ⇒ Object
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
#child ⇒ Object
Returns the value of attribute child.
39 40 41 |
# File 'lib/IFMapper/AStar.rb', line 39 def child @child end |
#f ⇒ Object
Returns the value of attribute f.
40 41 42 |
# File 'lib/IFMapper/AStar.rb', line 40 def f @f end |
#g ⇒ Object
Returns the value of attribute g.
40 41 42 |
# File 'lib/IFMapper/AStar.rb', line 40 def g @g end |
#h ⇒ Object
Returns the value of attribute h.
40 41 42 |
# File 'lib/IFMapper/AStar.rb', line 40 def h @h end |
#info ⇒ Object (readonly)
Returns the value of attribute info.
42 43 44 |
# File 'lib/IFMapper/AStar.rb', line 42 def info @info end |
#parent ⇒ Object
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 |
#inspect ⇒ Object
50 51 52 |
# File 'lib/IFMapper/AStar.rb', line 50 def inspect "AStarNode: #{@f} = #{@g} + #{@h} #{@info.inspect}" end |