lib/ravensat/ast/node.rb in ravensat-1.0.2 vs lib/ravensat/ast/node.rb in ravensat-1.0.3

- old
+ new

@@ -12,10 +12,12 @@ until node_stack.empty? current_parent, current_children = node_stack.pop current_node = current_children.shift + and_node_obj = AndNode.new + case current_node when AndNode node_stack.push [current_parent, current_children.clone] node_stack.push [current_node, current_node.children.clone] when OrNode @@ -24,20 +26,20 @@ when NotNode yield(current_node) yield(current_node.children.first) if current_children.empty? - yield(node_stack.last.first) + yield(and_node_obj) else yield(current_parent) node_stack.push [current_parent, current_children.clone] end when VarNode, Extension::BooleanVariable yield(current_node) if current_children.empty? - yield(node_stack.last.first) + yield(and_node_obj) else yield(current_parent) node_stack.push [current_parent, current_children.clone] end end @@ -86,9 +88,14 @@ def vars_size self.vars.size end def clauses_size - self.count{|node| node.is_a? AndNode} + 1 + cnt = 0 + self.each_by_descriptive do |node| + cnt+=1 if node.is_a? AndNode + end + cnt + # self.count{|node| node.is_a? AndNode} + 1 end end end