<s> class ActivePlan ( object ) : <EOL> def __init__ ( self , join_observer_list , on_next , on_completed ) : <EOL> self . join_observer_list = join_observer_list <EOL> self . on_next = on_next <EOL> self . on_completed = on_completed <EOL> self . join_observers = { } <EOL> for join_observer in self . join_observer_list : <EOL> self . join_observers [ join_observer ] = join_observer <EOL> def dequeue ( self ) : <EOL> for join_observer in self . join_observers . values ( ) : <EOL> join_observer . queue . pop ( <NUM_LIT:0> ) <EOL> def match ( self ) : <EOL> has_values = True <EOL> for join_observer in self . join_observer_list : <EOL> if not len ( join_observer . queue ) : <EOL> has_values = False <EOL> break <EOL> if has_values : <EOL> first_values = [ ] <EOL> is_completed = False <EOL> for join_observer in self . join_observer_list : <EOL> first_values . append ( join_observer . queue [ <NUM_LIT:0> ] ) <EOL> if join_observer . queue [ <NUM_LIT:0> ] . kind == '<STR_LIT:C>' : <EOL> is_completed = True <EOL> if is_completed : <EOL> self . on_completed ( ) <EOL> else : <EOL> self . dequeue ( ) <EOL> values = [ ] <EOL> for value in first_values : <EOL> values . append ( value . value ) <EOL> self . on_next ( * values ) </s>
