3.21 each_item : Iterate for each item

Format

$obj$.each_item{$|weight,item,top,bottom|\dots $} $\rightarrow $ $Qtrue$

Description

Read itemset from ZDD object $obj$ one at a time, each set of weight and item are returned as $weight$ and $item$ correspondingly for the specified block.

When the itemsets are processed, if item is the first item, $top$ will return as true, if item is the last item, $bottom$ will return false.

Example

Example 1: Basic Example

> require 'zdd'
> a=ZDD::itemset("a")
> b=ZDD::itemset("b")
> c=ZDD::itemset("c")
> f=2*a+2*b+4*a*c
> f.each_item{|weight,item,top,bottom|
>   puts weight
>   item.show
>   puts top
>   puts bottom
>   puts "----------"
> }
4
 a
true
false
----------
4
 c
false
true
----------
2
 a
true
true
----------
2
 b
true
true
----------

See Also

each : Return by itemset