/** * @param array|\Traversable $xs * @param array|\Traversable $ys * @param JoinSelector $valueJoinSelector * @param JoinSelector $keyJoinSelector */ public function __construct($xs, $ys, $valueJoinSelector, $keyJoinSelector) { $this->valueJoinSelector = $valueJoinSelector; $this->keyJoinSelector = $keyJoinSelector; $this->it0 = IteratorUtil::iterator($xs); $this->it1 = IteratorUtil::iterator($ys); }
/** * @param array|\Traversable $xs */ public function __construct($xs) { $this->it = IteratorUtil::iterator($xs); $this->rewinded = false; $this->cache = array(); $this->cacheSize = 0; }
/** * @param array|\Traversable $xs * @param Selector $groupingKeySelector * @param Selector $elementSelector * @param EqualityComparer $eqComparer */ public function __construct($xs, $groupingKeySelector, $elementSelector, $eqComparer) { $this->it = IteratorUtil::iterator($xs); $this->groupingKeySelector = $groupingKeySelector; $this->elementSelector = $elementSelector; $this->eqComparer = $eqComparer; }
/** * @param array|\Traversable $xs * @param int $chunkSize * @throws \InvalidArgumentException */ public function __construct($xs, $chunkSize) { if ($chunkSize < 1) { throw new \InvalidArgumentException("chunkSize must be greater than 0"); } $this->it = IteratorUtil::iterator($xs); $this->chunkSize = $chunkSize; }
/** * @param mixed $key * @return GroupingGinq */ public function get($key) { /** * @var \ArrayObject $xs */ $xs = $this->dict->get($key, array()); return new GroupingGinq(IteratorUtil::iterator($xs), $key); }
/** * @param array|\Traversable $outer * @param array|\Traversable $inner * @param Selector $outerKeySelector * @param Selector $innerKeySelector * @param JoinSelector $valueJoinSelector * @param JoinSelector $keyJoinSelector * @param EqualityComparer $eqComparer */ public function __construct($outer, $inner, $outerKeySelector, $innerKeySelector, $valueJoinSelector, $keyJoinSelector, $eqComparer) { $this->outer = IteratorUtil::iterator($outer); $this->inner = IteratorUtil::iterator($inner); $this->outerKeySelector = $outerKeySelector; $this->innerKeySelector = $innerKeySelector; $this->valueJoinSelector = $valueJoinSelector; $this->keyJoinSelector = $keyJoinSelector; $this->eqComparer = $eqComparer; }
/** * @param array|\Traversable $xs * @param EqualityComparer $eqComparer */ public function __construct($xs, $eqComparer) { $this->it = IteratorUtil::iterator($xs); $this->eqComparer = $eqComparer; }
/** * @param array|\Traversable $xs */ public function __construct($xs) { $this->it = IteratorUtil::iterator($xs); }
/** * @param array|\Traversable $xs * @param Predicate $predicate */ public function __construct($xs, $predicate) { $this->it = IteratorUtil::iterator($xs); $this->predicate = $predicate; }
/** * @param array|\Traversable $xs * @param Comparer $comparer */ public function __construct($xs, $comparer) { $this->src = IteratorUtil::iterator($xs); $this->comparer = $comparer; }
/** * @param array|\Traversable $xs * @param \Closure $fn */ public function __construct($xs, $fn) { $this->it = IteratorUtil::iterator($xs); $this->fn = $fn; }
/** * @param array|\Traversable $xs * @param Selector $valueSelector * @param Selector $keySelector */ public function __construct($xs, $valueSelector, $keySelector) { $this->it = IteratorUtil::iterator($xs); $this->valueSelector = $valueSelector; $this->keySelector = $keySelector; }
protected function fetchIfValid() { if ($this->outer->valid()) { $outerV = $this->outer->current(); $outerK = $this->outer->key(); $compareKey = $this->outerCompareKeySelector->select($outerV, $outerK); $inners = $this->lookup->get($compareKey); $inners = new GroupingGinq(IteratorUtil::iterator($inners), $compareKey); $this->v = $this->resultValueSelector->select($outerV, $inners, $outerK, $compareKey); $this->k = $this->outer->key(); } }
public function rewind() { $f = $this->sourceFactory; $this->it = IteratorUtil::iterator($f()); $this->it->rewind(); }
protected function fetchOuter() { if ($this->outer->valid()) { $this->outerV = $this->outer->current(); $this->outerK = $this->outer->key(); $this->inner = IteratorUtil::iterator($this->manySelector->select($this->outerV, $this->outerK)); $this->inner->rewind(); } else { $this->inner = null; } }
/** * @param array|\Iterator|\IteratorAggregate $rhs * @return bool */ public function sequenceEquals($rhs) { $eqComparer = EqualityComparerResolver::resolve(null, EqualityComparer::getDefault()); $lhs = $this->getIterator(); $rhs = IteratorUtil::iterator($rhs); if ($lhs instanceof \Countable && $rhs instanceof \Countable) { if ($lhs->count() !== $rhs->count()) { return false; } } $lhs->rewind(); $rhs->rewind(); while ($lhs->valid()) { $v0 = $lhs->current(); if ($rhs->valid()) { $v1 = $rhs->current(); if (!$eqComparer->equals($v0, $v1)) { return false; } $rhs->next(); } else { return false; } $lhs->next(); } return true; }
/** * @param array|\Traversable $xs * @param array|\Traversable $ys */ public function __construct($xs, $ys) { $this->it0 = IteratorUtil::iterator($xs); $this->it1 = IteratorUtil::iterator($ys); }