public function evaluate(FlowQuery $flowQuery, array $arguments)
{
$output = array();
$outputNodePaths = array();
foreach ($flowQuery->getContext() as $contextNode) {
$nextNode = $this->getNextForNode($contextNode);
if ($nextNode !== null && !isset($outputNodePaths[$nextNode->getPath()])) {
$outputNodePaths[$nextNode->getPath()] = true;
$output[] = $nextNode;
}
}
$flowQuery->setContext($output);
if (isset($arguments[0]) && !empty($arguments[0])) {
$flowQuery->pushOperation('filter', $arguments);
}
}