Class: SuffixTree::ActivePoint

Inherits:
Object
  • Object
show all
Defined in:
lib/suffix_tree/active_point.rb

Overview

Active point rules 1) If rule 3 extension is applied then active length will increment by 1 if active length is

not greater then length of path on edge.

2) If rule 3 extension is applied and if active length gets greater than length path of edge

then change active node, active edge and active length

3) If active length is 0 then always start looking for the character from root. 4) If rule 2 extension is applied and if active node is root then active edge is active edge + 1

and active length is active lenght -1

5) If rule 2 extension is applied and if active node is not root then follow suffix link and

make active node as suffix link and do no change anything.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(node) ⇒ ActivePoint

Returns a new instance of ActivePoint.



25
26
27
28
29
# File 'lib/suffix_tree/active_point.rb', line 25

def initialize(node)
  @length = 0
  @edge = -1
  @node = node
end

Instance Attribute Details

#edgeObject

Returns the value of attribute edge.



23
24
25
# File 'lib/suffix_tree/active_point.rb', line 23

def edge
  @edge
end

#lengthObject

Returns the value of attribute length.



23
24
25
# File 'lib/suffix_tree/active_point.rb', line 23

def length
  @length
end

#nodeObject

Returns the value of attribute node.



23
24
25
# File 'lib/suffix_tree/active_point.rb', line 23

def node
  @node
end