Class: SuffixTreeBuilder
- Inherits:
-
Object
- Object
- SuffixTreeBuilder
- Defined in:
- lib/persist/suffix_tree_db.rb
Instance Attribute Summary collapse
-
#suffixCount ⇒ Object
readonly
Returns the value of attribute suffixCount.
Instance Method Summary collapse
- #buildNode ⇒ Object
-
#initialize(stdb, dataSource) ⇒ SuffixTreeBuilder
constructor
A new instance of SuffixTreeBuilder.
Constructor Details
#initialize(stdb, dataSource) ⇒ SuffixTreeBuilder
Returns a new instance of SuffixTreeBuilder.
52 53 54 55 56 57 58 59 60 |
# File 'lib/persist/suffix_tree_db.rb', line 52 def initialize(stdb, dataSource) @suffxTreeDB = stdb @dataSource = dataSource @root = nil @unresolvedParents = {} @unresolvedSuffixLinks = {} @unresolvedChildren = {} @allNodes = {} end |
Instance Attribute Details
#suffixCount ⇒ Object (readonly)
Returns the value of attribute suffixCount.
50 51 52 |
# File 'lib/persist/suffix_tree_db.rb', line 50 def suffixCount @suffixCount end |
Instance Method Details
#buildNode ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/persist/suffix_tree_db.rb', line 62 def buildNode nodeId = @suffxTreeDB.readInt() if (nodeId > 0) then node = resolveNodeId(nodeId) resolve(nodeId, node) @allNodes[nodeId] = node @root = node if (@root == nil) resolveParent(node, @suffxTreeDB.readInt()) node.incomingEdgeStartOffset = @suffxTreeDB.readInt() node.incomingEdgeEndOffset = @suffxTreeDB.readInt() @suffixCount = node.suffixOffset = @suffxTreeDB.readInt() resolveSuffixLink(node, @suffxTreeDB.readInt()) childNodeId = @suffxTreeDB.readInt() while (childNodeId != 0) do resolveChild(node, childNodeId) childNodeId = @suffxTreeDB.readInt() end return node end return false end |