@param array $matchData
@param int   $currentIndex

@return bool
188649
protected function hasBetterMatch(array $matchData, $currentIndex)
    {
        $matchPercentage = $matchData[$currentIndex];
        foreach ($matchData as $index => $percentage) {
            if ($index > $currentIndex &&
                $percentage > $matchPercentage &&
                $percentage > $this->config->getMatchThreshold()
            ) {
                return true;
            }
        }

        return false;
    }
1097951
private static void match_glob(GlobData mdata, Context cx,
                                   Scriptable scope, int count,
                                   RegExpImpl reImpl)
    {
        if (mdata.arrayobj == null) {
            mdata.arrayobj = cx.newArray(scope, 0);
        }
        SubString matchsub = reImpl.lastMatch;
        String matchstr = matchsub.toString();
        mdata.arrayobj.put(count, mdata.arrayobj, matchstr);
    }
677299
private function getParentGroup($matchNumber, $previousRound)
    {
        $parentIndex = intval(($matchNumber + 1) / 2);
        $parent = $previousRound->get($parentIndex - 1);

        return $parent;
    }
1323761
private function checkByline($node, $matchString)
    {
        if (!$this->configuration->getArticleByLine()) {
            return false;
        }

        /*
         * Check if the byline is already set
         */
        if ($this->getAuthor()) {
            return false;
        }

        $rel = $node->getAttribute('rel');

        if ($rel === 'author' || preg_match(NodeUtility::$regexps['byline'], $matchString) && $this->isValidByline($node->getTextContent())) {
            $this->logger->info(sprintf('[Metadata] Found article author: \'%s\'', $node->getTextContent()));
            $this->setAuthor(trim($node->getTextContent()));

            return true;
        }

        return false;
    }
427489
public function getIndexData() {
		if ($this->index === null) {
			$currentPointer = ftell($this->file);
			fseek($this->file, 0);
			
			$count       = 0;
			$this->index = [];
			
			while (fgets($this->file) !== false) {
				$this->index[++ $count] = ftell($this->file);
			}

			fseek($this->file, $currentPointer);
		}
		
		return $this->index;
	}
1203002
public function match($data)
    {
        if (is_object($data)) {
            $data = get_class($data);
        }

        return in_array($data, (array)$this->getValue());
    }
895312
protected int getNextIndex(final int currentIndex) {

        if (!isPaused()) {
            return currentIndex + 1;
        }

        int ret = currentIndex;

        while (isPaused()) {

            sendStepPausing(ret + 1);

            try {
                Thread.sleep(getPauseSpan());
            } catch (InterruptedException e) {
                LOG.warn("thread.sleep.error", e);
            }

            TestScript testScript = current.getTestScript();
            if (testScript.isScriptFileChanged()) {
                LOG.info("script.file.changed");
                current.setTestScript(
                        dao.load(testScript.getScriptFile(), testScript.getSheetName(), false));
            }

            // コンソールから有効なコマンド入力があるまでループします。
            if (cmd == null || cmd.key == null) {
                continue;
            }

            final int cmdRet = cmd.execute(ret, current.getTestScript(), appCtx);

            if (cmdRet < 0) {
                LOG.info("cmd.error");
            } else {
                ret = cmdRet;

                if (current.getTestScript().getTestStep(ret) == null) {
                    LOG.info("test.step.end");
                    break;
                }

                LOG.info("empty");
                LOG.info("test.step.next.prev");
                for (int i = ret - 1; i <= ret + 1; i++) {
                    TestStep nextStep = current.getTestScript().getTestStep(i);
                    if (nextStep == null) {
                        continue;
                    }
                    String nextMark = i == ret + 1 ? " <- 次に実行" : "";
                    LOG.info("test.step.next", new Object[] { nextStep.getNo(),
                            nextStep.getItemName(), nextStep.getLocator(), nextMark });
                }
                LOG.info("empty");
            }

            //
            if (cmd.key.release && cmdRet >= 0) {
                cmd = null;
                break;
            } else {
                cmd = null;
            }

        }

        return ret;
    }
582018
def currentItemChanged(self, _currentIndex=None, _previousIndex=None):
        
        self.editor.clear()
        self.editor.setTextColor(QCOLOR_REGULAR)

        regItem = self.getCurrentRegItem()

        if regItem is None:
            return

        if self._importOnSelect and regItem.successfullyImported is None:
            self.importRegItem(regItem)

        if regItem.successfullyImported is None:
            self.editor.setTextColor(QCOLOR_NOT_IMPORTED)
            self.editor.setPlainText('<plugin not yet imported>')
        elif regItem.successfullyImported is False:
            self.editor.setTextColor(QCOLOR_ERROR)
            self.editor.setPlainText(str(regItem.exception))
        elif regItem.descriptionHtml:
            self.editor.setHtml(regItem.descriptionHtml)
        else:
            self.editor.setPlainText(regItem.docString)
611603
protected function getMatchingUrlFragment(Request $request, $currentUrlFragment = "")
    {
        $uri = $currentUrlFragment;

        $this->matchedUrl = $this->url;

        if (preg_match("`^" . $this->url . "/?([0-9]+)(/|$)`", $uri, $match) && isset($match[1])) {
            $this->resourceIdentifier = $match[1];
            $this->isCollection = false;

            $this->matchedUrl = $match[0];
        }

        return $this->matchedUrl;
    }
85471
public function replace($currentFile, $config)
    {
        $patterns = array(
            'constants' => array(
                '`EKA_[A-Z_]+`',
            ), 'php'    => array(
                '__DIR__',
            ),
        );

        if (!is_array($config)) {

            foreach ($patterns['constants'] as $pattern) {
                if ((bool) preg_match_all($pattern, $config, $matches)) {

                    $matches   = array_unique($matches[0]);
                    $constants = array();//'.' => '');

                    foreach ($matches as $index => $constant) {
                        $constants[$constant] = constant($constant);
                    }

                    $config = str_replace(array_keys($constants), array_values($constants), $config);

                    if (is_numeric($config)) {
                        $config = (int) $config;
                    }
                }
            }

            $currentDir = dirname($currentFile);
            foreach ($patterns['php'] as $pattern) {

                if (strpos($pattern, $config) !== false) {
                    switch ($pattern) {
                        case '__DIR__':
                            $replace = $currentDir;
                            break;
                        default:
                            continue 2;
                    }

                    $config = str_replace($pattern, $replace, $config);
                }
            }

            if (false !== strpos($config, '..')) {
                $config = realpath($config);
            }
        } elseif (is_array($config)) {

            foreach ($config as $key => $conf) {
                $config[$key] = $this->replace($currentFile, $conf);
            }
        }

        return $config;
    }
1332178
private static boolean isMatch(List<ValueMatcher> matchers, int index, int value) {
		return (matchers.size() > index) ? matchers.get(index).match(value) : true;
	}
1255315
def setCurrentIndex(self, index):
        
        if self._currentIndex == index:
            return

        self._currentIndex = index
        self.currentIndexChanged.emit(index)

        for i, item in enumerate(self.items()):
            item.setMenuEnabled(i == index)
        self.repaint()
1212749
protected function isMultiValuedPropertyDirty(array $cleanData, $currentValue)
    {
        if (count($cleanData['value']) > 0 && count($cleanData['value']) === count($currentValue)) {
            if ($currentValue instanceof \SplObjectStorage) {
                $cleanIdentifiers = [];
                foreach ($cleanData['value'] as &$cleanObjectData) {
                    $cleanIdentifiers[] = $cleanObjectData['value']['identifier'];
                }
                sort($cleanIdentifiers);
                $currentIdentifiers = [];
                foreach ($currentValue as $currentObject) {
                    $currentIdentifier = $this->getIdentifierByObject($currentObject);
                    if ($currentIdentifier !== null) {
                        $currentIdentifiers[] = $currentIdentifier;
                    }
                }
                sort($currentIdentifiers);
                if ($cleanIdentifiers !== $currentIdentifiers) {
                    return true;
                }
            } else {
                foreach ($cleanData['value'] as &$cleanObjectData) {
                    if (!isset($currentValue[$cleanObjectData['index']])) {
                        return true;
                    }
                    if (($cleanObjectData['type'] === 'array' && $this->isMultiValuedPropertyDirty($cleanObjectData, $currentValue[$cleanObjectData['index']]) === true)
                        || ($cleanObjectData['type'] !== 'array' && $this->isSingleValuedPropertyDirty($cleanObjectData['type'], $cleanObjectData['value'], $currentValue[$cleanObjectData['index']]) === true)) {
                        return true;
                    }
                }
            }
        } elseif (count($cleanData['value']) > 0 || count($currentValue) > 0) {
            return true;
        }
        return false;
    }
1363385
public function isExpanded($currentUrl)
    {
        if (!$this->subnodes instanceof Collection) {
            return false;
        }

        return $this
            ->subnodes
            ->exists(function ($_, NodeInterface $node) use ($currentUrl) {

                return
                    $node->isActive($currentUrl) ||
                    $node->isExpanded($currentUrl);
            });
    }
716454
public function moveBlockUp( $currentIndex )
    {
        $array =& $this->attributes['blocks'];

        $newIndex = $currentIndex - 1;

        if ( $newIndex < 0 || $newIndex >= count( $array ) )
            return false;

        $tmpItem = $array[$newIndex];

        $array[$newIndex] =& $array[$currentIndex];
        $array[$currentIndex] =& $tmpItem;

        if ( $tmpItem->toBeRemoved() )
            $this->moveBlockUp( $newIndex );

        return true;
    }
306664
private function matchRequest(&$classData)
    {
        if (!is_array($classData)) {
            throw new RestException("Invalid class cache data.");
        }

        // build the request url upon which we will do the matching
        try {
            $url = $this->getUrl();
        } catch (\Exception $e) {
            throw $e;
        }


        // get request method
        $method = $this->getMethod();
        if (!in_array($method, self::$supportedRequestTypes)) {
            throw new RestException('Unsupported request method: "' . $method . '"');
        }

        $callbacks = (empty($classData[$method])) ? [] : $classData[$method];

        // match array
        $matchedMethod = [
            'methodData'        => false,
            'matchedParameters' => false
        ];

        // validate that we have the ending class name in the url
        $classUrl = PathTransformations::classNameToUrl($this->class, $this->normalize);
        if (strpos($url, '/' . $classUrl . '/') !== false) {
            $matchedMethod = $this->matchMethod($callbacks, $url);

            // if method was not matched
            if (!$matchedMethod['methodData']) {
                // if no method was matched, let's try to match a default method
                $matchedMethod = $this->matchDefaultMethod($callbacks, $url, $classUrl);
            }
        }

        $methodData = (isset($matchedMethod['methodData'])) ? $matchedMethod['methodData'] : false;
        $matchedParameters = ($matchedMethod['matchedParameters']) ? $matchedMethod['matchedParameters'] : [];

        $requestBag = new RequestBag();
        $requestBag->setClassData($classData)
                   ->setMethodData($methodData)
                   ->setMethodParameters($matchedParameters)
                   ->setApi($this->api);

        $callback = new Callback($requestBag);

        return $callback->getCallbackResult();
    }
1072193
protected function currentUrlMatches()
    {
        if ($this->url() == Request::url()) { // If URLs are equal, always return true
            return true;
        }

        if ($this->activeUrlPattern) { // If pattern was set, see if it matches
            $pattern = ltrim(preg_replace('/\/\*/', '(/.*)?', $this->activeUrlPattern), '/');
            return preg_match("@^{$pattern}\z@", Request::path());
        }

        return false; // No match
    }