Class: Algorithms::Containers::Trie::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/containers/trie.rb

Overview

:nodoc: all

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(char, value) ⇒ Node

Returns a new instance of Node.



111
112
113
114
115
116
# File 'lib/containers/trie.rb', line 111

def initialize(char, value)
  @char = char
  @value = value
  @left = @mid = @right = nil
  @end = false
end

Instance Attribute Details

#charObject

Returns the value of attribute char.



109
110
111
# File 'lib/containers/trie.rb', line 109

def char
  @char
end

#endObject

Returns the value of attribute end.



109
110
111
# File 'lib/containers/trie.rb', line 109

def end
  @end
end

#leftObject

Returns the value of attribute left.



109
110
111
# File 'lib/containers/trie.rb', line 109

def left
  @left
end

#midObject

Returns the value of attribute mid.



109
110
111
# File 'lib/containers/trie.rb', line 109

def mid
  @mid
end

#rightObject

Returns the value of attribute right.



109
110
111
# File 'lib/containers/trie.rb', line 109

def right
  @right
end

#valueObject

Returns the value of attribute value.



109
110
111
# File 'lib/containers/trie.rb', line 109

def value
  @value
end

Instance Method Details

#last?Boolean

Returns:

  • (Boolean)


118
119
120
# File 'lib/containers/trie.rb', line 118

def last?
  @end == true
end