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())); }
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; }
public static function emit(ReduceInput $input, $count) { self::$char_count[$input->getKey()] = $count; }
public function execute(ReduceInput $input) { $this->count = count($input->getList()); CharCounter::emit($input, $this->count); }