Class: ExpandRuby::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/re_expand/Node.rb

Constant Summary collapse

@@id =
1
@@nodes =
{}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNode

Returns a new instance of Node.



40
41
42
43
44
45
46
47
# File 'lib/re_expand/Node.rb', line 40

def initialize
  @accept = nil
  @trans = []
  @id = @@id
  @@nodes[@id] = self
  @@id += 1
  @pars = []
end

Instance Attribute Details

#acceptObject

Returns the value of attribute accept.



51
52
53
# File 'lib/re_expand/Node.rb', line 51

def accept
  @accept
end

#idObject (readonly)

Returns the value of attribute id.



49
50
51
# File 'lib/re_expand/Node.rb', line 49

def id
  @id
end

#parsObject

Returns the value of attribute pars.



51
52
53
# File 'lib/re_expand/Node.rb', line 51

def pars
  @pars
end

#transObject (readonly)

Returns the value of attribute trans.



50
51
52
# File 'lib/re_expand/Node.rb', line 50

def trans
  @trans
end

Class Method Details

.node(id) ⇒ Object

ノードidからノードを取得



58
59
60
# File 'lib/re_expand/Node.rb', line 58

def Node.node(id) # ノードidからノードを取得
  @@nodes[id.to_i]
end

.nodesObject



62
63
64
# File 'lib/re_expand/Node.rb', line 62

def Node.nodes
  @@nodes.values
end

Instance Method Details

#addTrans(pat, dest) ⇒ Object



53
54
55
56
# File 'lib/re_expand/Node.rb', line 53

def addTrans(pat,dest)
  t = Trans.new(pat,dest)
  @trans << t
end