Ejemplo n.º 1
0
 public function testAddToList()
 {
     $input = new ReduceInput();
     $input->addToList(new MapEntry('a', 1));
     $this->assertEquals(1, count($input->getList()));
     $input->addToList(new MapEntry('b', 1));
     $this->assertEquals(2, count($input->getList()));
 }
Ejemplo n.º 2
0
 public static function createInstance($entries)
 {
     $list = array();
     $current = null;
     $reduce_input = null;
     foreach ($entries as $entry) {
         if (!$entry->equals($current)) {
             $current = $entry;
             $reduce_input = new ReduceInput();
             $reduce_input->setKey($entry->getKey());
             $list[] = $reduce_input;
         }
         $reduce_input->addToList($entry);
     }
     return $list;
 }