Check if artifact matches patterns.

@throws InvalidVersionSpecificationException
344225
public boolean match( Artifact artifact )
        throws InvalidVersionSpecificationException
    {
        for ( Pattern pattern : patterns )
        {
            if ( pattern.match( artifact ) )
            {
                for ( Pattern ignorePattern : ignorePatterns )
                {
                    if ( ignorePattern.match( artifact ) )
                    {
                        return false;
                    }
                }
                return true;
            }
        }
        return false;
    }
20848
private void checkVersion(final Future<Boolean> aFuture) {
        final String versionFilePath = getVersionFilePath();

        myFileSystem.exists(versionFilePath, result -> {
            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug(MessageCodes.PT_DEBUG_007, versionFilePath);
            }

            if (result.succeeded()) {
                if (result.result()) {
                    if (LOGGER.isDebugEnabled()) {
                        LOGGER.debug(MessageCodes.PT_DEBUG_008, versionFilePath);
                    }

                    checkPrefix(aFuture);
                } else {
                    aFuture.complete(!result.result());
                }
            } else {
                aFuture.fail(result.cause());
            }
        });
    }
260532
public static function validateVersion($requiredVersion, $composerVersion)
    {
        if (false === strpos($composerVersion, '@') && !version_compare($composerVersion, $requiredVersion, '>=')) {
            $msg = 'Foxy requires the Composer\'s minimum version "%s", current version is "%s"';

            throw new RuntimeException(sprintf($msg, $requiredVersion, $composerVersion));
        }
    }
360185
private static boolean artifactsMatch(org.apache.maven.model.Dependency d, Artifact a) {
        return isEqualOrNull(a.getArtifactId(), d.getArtifactId())
                && isEqualOrNull(a.getGroupId(), d.getGroupId())
                && isEqualOrNull(a.getVersion(), d.getVersion());
    }
1220560
public void parseVersion( String version )
    {
        DefaultVersioning artifactVersion = new DefaultVersioning( version );

        getLog().debug( "Parsed Version" );
        getLog().debug( "         major: " + artifactVersion.getMajor() );
        getLog().debug( "         minor: " + artifactVersion.getMinor() );
        getLog().debug( "   incremental: " + artifactVersion.getPatch() );
        getLog().debug( "   buildnumber: " + artifactVersion.getBuildNumber() );
        getLog().debug( "     qualifier: " + artifactVersion.getQualifier() );

        defineVersionProperty( "majorVersion", artifactVersion.getMajor() );
        defineVersionProperty( "minorVersion", artifactVersion.getMinor() );
        defineVersionProperty( "incrementalVersion", artifactVersion.getPatch() );
        defineVersionProperty( "buildNumber", artifactVersion.getBuildNumber() );

        defineVersionProperty( "nextMajorVersion", artifactVersion.getMajor() + 1 );
        defineVersionProperty( "nextMinorVersion", artifactVersion.getMinor() + 1 );
        defineVersionProperty( "nextIncrementalVersion", artifactVersion.getPatch() + 1 );
        defineVersionProperty( "nextBuildNumber", artifactVersion.getBuildNumber() + 1 );

        defineFormattedVersionProperty( "majorVersion", String.format( formatMajor, artifactVersion.getMajor() ) );
        defineFormattedVersionProperty( "minorVersion", String.format( formatMinor, artifactVersion.getMinor() ) );
        defineFormattedVersionProperty( "incrementalVersion", String.format( formatIncremental, artifactVersion.getPatch() ) );
        defineFormattedVersionProperty( "buildNumber", String.format( formatBuildNumber, artifactVersion.getBuildNumber() ));

        defineFormattedVersionProperty( "nextMajorVersion", String.format( formatMajor, artifactVersion.getMajor() + 1 ));
        defineFormattedVersionProperty( "nextMinorVersion", String.format( formatMinor, artifactVersion.getMinor() + 1 ));
        defineFormattedVersionProperty( "nextIncrementalVersion", String.format( formatIncremental, artifactVersion.getPatch() + 1 ));
        defineFormattedVersionProperty( "nextBuildNumber", String.format( formatBuildNumber, artifactVersion.getBuildNumber() + 1 ));
        
        String osgi = artifactVersion.getAsOSGiVersion();

        String qualifier = artifactVersion.getQualifier();
        String qualifierQuestion = "";
        if ( qualifier == null )
        {
            qualifier = "";
        } else {
            qualifierQuestion = qualifierPrefix;
        }

        defineVersionProperty( "qualifier", qualifier );
        defineVersionProperty( "qualifier?", qualifierQuestion + qualifier );

        defineVersionProperty( "osgiVersion", osgi );
    }
637059
function isCached(project, majorVersion) {
    var cid = project+majorVersion;
    return cache[cid] && cache[cid].short_name[0] == project && cache[cid].api_version[0] == majorVersion;
  }
1275826
protected static function isFileVersionMatch(string $version): bool
    {
        try {
            $fileVersion = null;
            if (class_exists(self::CONNECTOR_CLASS)) {
                $ref = new \ReflectionClass(self::CONNECTOR_CLASS);
                if (preg_match(FW::VERSION_WITHOUT_BUG_FIX, $ref->getDocComment(), $result)) {
                    $fileVersion = Arr::first($result);
                }
            }

            return version_compare($fileVersion, $version, '>=');
        } catch (\Exception $e) {
            return false;
        }
    }
513330
function isVersionAtLeast(dottedVersion, major, minor, patch){
	var i, v, t,
		verParts = $.map($.trim(dottedVersion).split("."), function(e){ return parseInt(e, 10); }),
		testParts = $.map(Array.prototype.slice.call(arguments, 1), function(e){ return parseInt(e, 10); });

	for( i = 0; i < testParts.length; i++ ){
		v = verParts[i] || 0;
		t = testParts[i] || 0;
		if( v !== t ){
			return ( v > t );
		}
	}
	return true;
}
669204
static boolean hasUpdate(final String newer, final String older) {
		return VERSION_PATTERN.matcher(newer).matches() && VERSION_PATTERN.matcher(older).matches() ? newer.compareTo(older) > 0 : false;
	}
1232872
protected function checkPlatformVersion() 
    {
        // based on browscap.ini
        if ($this->_platform == self::PLATFORM_WINDOWS) 
        {
	        /*if( stripos($this->_agent, 'windows NT 7.1') !== false ) {
			    $this->_platform = self::PLATFORM_WINDOWS_7;
		    }
	        else*/
            if( stripos($this->_agent, 'windows NT 10.0') !== false ) 
            {
                $this->_platformVersion = self::PLATFORM_WINDOWS_10;
            }
            elseif( stripos($this->_agent, 'windows NT 6.3') !== false ) 
            {
                $this->_platformVersion = self::PLATFORM_WINDOWS_81;
                if( stripos($this->_agent, 'arm') !== false )
                {
                    $this->_platformVersion = self::PLATFORM_WINDOWS_RT;
                }
            }
            elseif( stripos($this->_agent, 'windows NT 6.2') !== false ) 
            {
			    $this->_platformVersion = self::PLATFORM_WINDOWS_8;
			    if( stripos($this->_agent, 'arm') !== false ) 
			    {
			        $this->_platformVersion = self::PLATFORM_WINDOWS_RT;
			    }
		    }
		    elseif( stripos($this->_agent, 'windows NT 6.1') !== false ) {
			    $this->_platformVersion = self::PLATFORM_WINDOWS_7;
		    }
		    elseif( stripos($this->_agent, 'windows NT 6.0') !== false ) {
			    $this->_platformVersion = self::PLATFORM_WINDOWS_VISTA;
		    }
		    elseif( stripos($this->_agent, 'windows NT 5.2') !== false ) {
			    $this->_platformVersion = self::PLATFORM_WINDOWS_2003;
		    }
		    elseif( stripos($this->_agent, 'windows NT 5.1') !== false ) {
			    $this->_platformVersion = self::PLATFORM_WINDOWS_XP;
		    }
		    elseif( stripos($this->_agent, 'windows XP') !== false ) {
		        $this->_platformVersion = self::PLATFORM_WINDOWS_XP;
		    }
		    elseif( stripos($this->_agent, 'windows NT 5.0') !== false ) {
			    $this->_platformVersion = self::PLATFORM_WINDOWS_2000;
		    }
		    elseif( stripos($this->_agent, 'windows NT 4.0') !== false ) {
			    $this->_platformVersion = self::PLATFORM_WINDOWS_NT;
		    }
		    elseif( stripos($this->_agent, 'windows Me') !== false ) {
			    $this->_platformVersion = self::PLATFORM_WINDOWS_ME;
		    }
		    elseif( stripos($this->_agent, 'windows 98') !== false ) {
			    $this->_platformVersion = self::PLATFORM_WINDOWS_98;
		    }
		    elseif( stripos($this->_agent, 'windows 95') !== false ) {
		        $this->_platformVersion = self::PLATFORM_WINDOWS_95;
		    }
        }

        if ($this->_platform == self::PLATFORM_WINDOWS_PHONE)
        {
            if ( stripos($this->_agent, 'Windows Phone OS') !== false )
            {
                $aresult = explode(' ',stristr($this->_agent,'Windows Phone OS'));
                $this->_platformVersion = self::PLATFORM_WINDOWS_PHONE .' '. str_replace(array('(',')',';'),'',$aresult[3]);
            }
            elseif ( stripos($this->_agent, 'Windows Phone') !== false )
            {
                $aresult = explode(' ',stristr($this->_agent,'Windows Phone'));
                $this->_platformVersion = self::PLATFORM_WINDOWS_PHONE .' '. str_replace(array('(',')',';'),'',$aresult[2]);
            }
        }
        
        if ($this->_platform == self::PLATFORM_APPLE)
        {
            if ( stripos($this->_agent, 'Mac OS X') !== false ) 
            {
                $this->_platformVersion = self::PLATFORM_MACOSX;
            }
            if ( stripos($this->_agent, 'iPad') !== false 
              || stripos($this->_agent, 'iPod') !== false
              || stripos($this->_agent, 'iPhone') !== false) 
            {
                $this->_platformVersion = self::PLATFORM_IOSX;
            }
        }
	    elseif( stripos($this->_agent, 'Warp 4') !== false ) {
		    $this->_platformVersion = self::PLATFORM_WARP4;
	    }
    }
994868
public function checkServerVersion()
    {
        $serverVersion   = $this->getServerVersion();
        $requiredVersion = Config::getInstance()->General['minimum_mysql_version'];

        if (version_compare($serverVersion, $requiredVersion) === -1) {
            throw new Exception(Piwik::translate('General_ExceptionDatabaseVersion', array('MySQL', $serverVersion, $requiredVersion)));
        }
    }
519114
private boolean verify(String version, Long time) {
    if (versionToItem.containsKey(version)) {
      Path path = collectionCachePath.resolve(version);
      File file = path.toFile();
      if (file.exists() && file.canRead() && file.canWrite()) {
        if (time != null) {
          if (!file.setLastModified(time)) {
            log.debug("couldn't change filetime " + file.getAbsolutePath());
          } else {
            expirationVersion.put(version, time + (1000 * lifeTime));
          }
        }
        return true;
      } else {
        return false;
      }
    } else {
      return false;
    }
  }
487669
@Override
    protected Artifact createArtifact(final ArtifactItem item) throws MojoExecutionException {
        assert item != null;
        
        if (item.getVersion() == null) {
            throw new MojoExecutionException("Unable to find artifact without version specified: " + item.getGroupId()
                + ":" + item.getArtifactId() + ":" + item.getVersion() + " in either project dependencies or in project dependencyManagement.");
        }
        
        // if version is a range get the highest available version
        if (item.getVersion().trim().startsWith("[") || item.getVersion().trim().startsWith("(") ) {
            try {
                item.setVersion(resolveVersionRange(item.getGroupId(), item.getArtifactId(), item.getType(), item.getVersion()));
            } catch (VersionRangeResolutionException e) {
                throw new MojoExecutionException("Could not get the highest version from the range: " + item.getVersion(), e);
            }
        }
        
        return resolveArtifactItem(item);
    }
370123
protected boolean checkIfModelMatches ( String groupId, String artifactId, String version, Model model )
    {
        // try these first.
        String modelGroup = model.getGroupId();
        String modelArtifactId = model.getArtifactId();
        String modelVersion = model.getVersion();

        try
        {
            if ( StringUtils.isEmpty( modelGroup ) )
            {
                modelGroup = model.getParent().getGroupId();
            }
            else
            {
                // MENFORCER-30, handle cases where the value is a property like ${project.parent.groupId}
                modelGroup = (String) helper.evaluate( modelGroup );
            }

            if ( StringUtils.isEmpty( modelVersion ) )
            {
                modelVersion = model.getParent().getVersion();
            }
            else
            {
                // MENFORCER-30, handle cases where the value is a property like ${project.parent.version}
                modelVersion = (String) helper.evaluate( modelVersion );
            }
            
            // Is this only required for Maven2?
            modelArtifactId = (String) helper.evaluate( modelArtifactId );
        }
        catch ( NullPointerException e )
        {
            // this is probably bad. I don't have a valid
            // group or version and I can't find a
            // parent????
            // lets see if it's what we're looking for
            // anyway.
        }
        catch ( ExpressionEvaluationException e )
        {
            // as above
        }
        return ( StringUtils.equals( groupId, modelGroup ) && StringUtils.equals( version, modelVersion ) && StringUtils
            .equals( artifactId, modelArtifactId ) );
    }
70433
protected function _checkImageVersions($identifier, array $versions) {
		if (!isset($this->_imageVersions[$identifier])) {
			throw new RuntimeException(sprintf('No image version config found for identifier "%s"!', $identifier));
		}

		foreach ($versions as $version) {
			if (!isset($this->_imageVersions[$identifier][$version])) {
				throw new RuntimeException(sprintf('Invalid version "%s" for identifier "%s"!', $identifier, $version));
			}
		}
	}
842811
private static function preReleaseEquals(PreRelease $v1, PreRelease $v2)
    {
        // If they don't match on the versionable level they can not match
        if (!self::versionableEquals($v1, $v2)) {
            return false;
        }

        // Both other parts need to match
        if ($v1->getGreek() !== $v2->getGreek()) {
            return false;
        }
        if ($v1->getReleaseNumber() !== $v2->getReleaseNumber()) {
            return false;
        }

        return true;
    }
876597
public VersionRange parseRange(final String pattern) {
    checkNotNull(pattern);
    try {
      return versionScheme.parseVersionRange(pattern);
    }
    catch (InvalidVersionSpecificationException e) {
      throw Throwables.propagate(e);
    }
  }