Match extends single

@param array $rawSingle
@param array $outOrigin

@return boolean
334125
protected function matchExtendsSingle($rawSingle, &$outOrigin)
    {
        $counts = [];
        $single = [];

        foreach ($rawSingle as $part) {
            // matches Number
            if (! is_string($part)) {
                return false;
            }

            if (! preg_match('/^[\[.:#%]/', $part) && count($single)) {
                $single[count($single) - 1] .= $part;
            } else {
                $single[] = $part;
            }
        }

        $extendingDecoratedTag = false;

        if (count($single) > 1) {
            $matches = null;
            $extendingDecoratedTag = preg_match('/^[a-z0-9]+$/i', $single[0], $matches) ? $matches[0] : false;
        }

        foreach ($single as $part) {
            if (isset($this->extendsMap[$part])) {
                foreach ($this->extendsMap[$part] as $idx) {
                    $counts[$idx] = isset($counts[$idx]) ? $counts[$idx] + 1 : 1;
                }
            }
        }

        $outOrigin = [];
        $found = false;

        foreach ($counts as $idx => $count) {
            list($target, $origin, /* $block */) = $this->extends[$idx];

            // check count
            if ($count !== count($target)) {
                continue;
            }

            $this->extends[$idx][3] = true;

            $rem = array_diff($single, $target);

            foreach ($origin as $j => $new) {
                // prevent infinite loop when target extends itself
                if ($this->isSelfExtend($single, $origin)) {
                    return false;
                }

                $replacement = end($new);

                // Extending a decorated tag with another tag is not possible.
                if ($extendingDecoratedTag && $replacement[0] != $extendingDecoratedTag &&
                    preg_match('/^[a-z0-9]+$/i', $replacement[0])
                ) {
                    unset($origin[$j]);
                    continue;
                }

                $combined = $this->combineSelectorSingle($replacement, $rem);

                if (count(array_diff($combined, $origin[$j][count($origin[$j]) - 1]))) {
                    $origin[$j][count($origin[$j]) - 1] = $combined;
                }
            }

            $outOrigin = array_merge($outOrigin, $origin);

            $found = true;
        }

        return $found;
    }
690388
public function match(
        /*# string */ $httpMethod,
        /*# string */ $uriPath,
        array $parameters = []
    )/*# :  bool */ {
        $this->initResult($httpMethod, $uriPath);
        $this->getResult()->setParameters($parameters);

        $param = ['result' => $this->result];
        if ($this->trigger(self::EVENT_BEFORE_MATCH, $param) &&
            $this->matchWithCollectors() &&
            $this->trigger(self::EVENT_AFTER_MATCH, $param)
        ) {
            return true;
        }
        return false;
    }
73954
public function equals(LatLng $other, $maxMargin = null, $ignoreAltitude = true)
    {
        if ($maxMargin !== null) {
            $margin = max(
                abs(($this->getLatitude() - $other->getLatitude())),
                abs(($this->getLongitude() - $other->getLongitude()))
            );
            
            if (!$ignoreAltitude) {
                $margin = max(
                    $margin,
                    abs(($this->getAltitude() - $other->getLongitude()))
                );
            }

            return ($margin <= $maxMargin);
        }

        if ($this->getLatitude() !== $other->getLatitude()) {
            return false;
        }

        if ($this->getLongitude() !== $other->getLongitude()) {
            return false;
        }

        if (!$ignoreAltitude && $this->getAltitude() !== $other->getAltitude()) {
            return false;
        }

        return true;
    }
292863
private function doesTypeMatch(array $acceptedTypes, $contentType)
    {
        foreach ($acceptedTypes as $mimeType) {
            if (stripos($mimeType, $contentType) === 0) {
                return true;
            }
        }

        return false;
    }
424398
public boolean isMatching(SLProperties properties) {
        for (Map.Entry<String, String> matcher : matchers) {
            if (!properties.includesValues(matcher.getKey(), matcher.getValue())) {
                return false;
            }
        }
        return true;
    }
185926
private function whenMatch(Enum $enum, Match $match)
    {
        if (!$enum instanceof $this->subject) {
            $classSubject  = get_class($this->subject);
            $classArgument = get_class($enum);

            throw new InvalidArgumentException(
                "This map is already mapping an instance of {$classSubject}, " .
                "yet this invocation is trying to map an instance of {$classArgument}."
            );
        }

        if (array_key_exists($enum->getName(), $this->matches)) {
            throw new InvalidArgumentException(
                "This map has already mapped instance {$enum} to a value."
            );
        }

        /** @noinspection PhpInternalEntityUsedInspection */
        $this->matches[$enum->getName()] = $match;

        return $this;
    }
994336
public static AbstractMessage unserializeFrom( RawDataBuffer rawIn , boolean asInternalCopy )
    {
    	int size = rawIn.readInt();
    	
    	// Extract a sub buffer
    	RawDataBuffer rawMessage = new RawDataBuffer(rawIn.readBytes(size));
        byte type = rawMessage.readByte(); 
        AbstractMessage message = MessageType.createInstance(type);
        message.initializeFromRaw(rawMessage); 
        if (asInternalCopy)
            message.setInternalCopy(true);

        return message;
    }
1305497
final boolean match(JmsJcaUserDetails userDetails,
                        SICoreConnection coreConnection) {

        boolean usersMatch = (_userDetails == null) ? (userDetails == null)
                        : (_userDetails.equals(userDetails));
        boolean coreConnectionsMatch = (coreConnection == null)
                                       || coreConnection.isEquivalentTo(_coreConnection);

        return usersMatch && coreConnectionsMatch && isValid();
    }
681532
@Override
    public boolean matches(TargetProperties targetConatiner, IBond targetBond) {
        if (this.smartQueryBond != null) {
            return smartQueryBond.matches(targetBond);
        } else {
            if (!isBondMatchFlag()) {
                return true;
            }
            if (isBondMatchFlag() && isBondTypeMatch(targetBond)) {
                return true;
            }
            if (isBondMatchFlag() && this.unsaturation == getUnsaturation(targetConatiner, targetBond)) {
                return true;
            }
        }
        return false;
    }
1286311
private boolean isAggregationDistinctSelectItem(final String innerExpression) {
        String pattern = "\\(\\s*DISTINCT\\s+.*\\)";
        return Pattern.matches(pattern, innerExpression.toUpperCase());
    }
1149420
public char match(ISense source, ISense target) throws MatcherLibraryException {
        List<String> sourceLemmas = source.getLemmas();
        List<String> targetLemmas = target.getLemmas();
        for (String sourceLemma : sourceLemmas) {
            for (String targetLemma : targetLemmas) {
                if (sourceLemma.equals(targetLemma)) {
                    return IMappingElement.EQUIVALENCE;
                }
            }
        }
        return IMappingElement.IDK;
    }
603754
public static Matcher<Object> hasSingleFailureContaining(final String string) {
        return new BaseMatcher<Object>() {
            public boolean matches(Object item) {
                return item.toString().contains(string) && failureCountIs(1).matches(item);
            }

            public void describeTo(Description description) {
                description.appendText("has single failure containing " + string);
            }
        };
    }
138054
public boolean assessMatch(final OgnlContext ognlContext) throws OgnlException
	{

		if (! inputRun)
		{
			throw new IllegalArgumentException("Attempted to match on a rule whose rulesets input has not yet been produced");
		}

		final Object result = condition.run(ognlContext, ognlContext);

		if (result == null || !Boolean.class.isAssignableFrom(result.getClass()))
		{
			throw new IllegalArgumentException("Expression " + condition.getOriginalExpression() +
			                                   " did not return a boolean value");
		}

		matches = (Boolean) result;

		return matches;
	}
18869
function (element, type, original) {
                // we're not using forAll here simply because it's a bit slower and this
                // needs to be fast
                var i, list = map['$' + type]
                if (list) {
                  for (i = list.length; i--;) {
                    if (list[i].matches(element, original, null))
                      return true
                  }
                }
                return false
              }
127589
function matches (el, selector) {
  var _matches = el.matches ||
    el.matchesSelector ||
    el.msMatchesSelector ||
    el.mozMatchesSelector ||
    el.webkitMatchesSelector ||
    el.oMatchesSelector

  if (_matches) {
    return _matches.call(el, selector)
  } else if (el.parentNode) {
    // IE8 and below
    var nodes = el.parentNode.querySelectorAll(selector)
    for (var i = nodes.length; i--; 0) {
      if (nodes[i] === el) return true
    }
    return false
  }
}
682049
protected function matchSingle($field, $searchTxt, $fieldList, $appointment)
    {
        $result = true;

        if ($field && $searchTxt) {
            $value = $this->getAppointmentFieldValue($appointment, $field);
            if (isset($this->_lookupTables[$field])) {
                if ($fieldList && $fieldList !== true) {
                    if (! isset($fieldList)) {
                        $result = false;
                    }
                } else {
                    $result = false;
                }
            } else {
                $regex = '/' . str_replace(array('%', '_'), array('.*', '.{1,1}'), $searchTxt) . '/i';

                if (! (boolean) preg_match($regex, $value)) {
                    $result = false;
                }
            }
        }

        return $result;
    }
956321
@Override
	protected boolean matchesSafely(T actual, Description mismatch)
	{
		boolean matches = true;
		
		for (Matcher<? super T> matcher : matchers)
		{
			if (!matcher.matches(actual))
			{
				if (!matches)
				{
					mismatch.appendText(SEPARATOR);
				}
				
				matches = false;
				
				matcher.describeMismatch(actual, mismatch);
			}
		}
		
		return matches;
	}