Null-safe version parser.

@param version the version string.
@return the version.
774004
public static Version parseVersion(String version) {
		if (!Strings.isNullOrEmpty(version)) {
			try {
				return Version.parseVersion(version);
			} catch (Throwable exception) {
				//
			}
		}
		return null;
	}
1067970
public Version find(String versionToFind) {
		for (Version version : list) {
			if (version.version.equals(versionToFind)) {
				return version;
			}
		}
		return null;
	}
75451
public static String fixVersion(String version)
    {
        if (version != null)
            if (version.length() > 0)
        {
            version = version.toUpperCase();
            if (Character.isLetter(version.charAt(0)))
                version = version.substring(1, version.length()) + version.substring(0, 1); // Move letter to start
        }
        return version;
    }
1355741
private Version parseVersion() {
        int major = intOf(consumeNextToken(NUMERIC).lexeme);
        int minor = 0;
        if (tokens.positiveLookahead(DOT)) {
            tokens.consume();
            minor = intOf(consumeNextToken(NUMERIC).lexeme);
        }
        int patch = 0;
        if (tokens.positiveLookahead(DOT)) {
            tokens.consume();
            patch = intOf(consumeNextToken(NUMERIC).lexeme);
        }
        return versionFor(major, minor, patch);
    }
1198176
@Nullable
	private static String retrieveRemoteVersion(@Nonnull final URL url, @Nonnull final Charset charset) throws IOException {
		final InputStream stream = url.openStream();
		final InputStreamReader reader = new InputStreamReader(stream, charset);
		final LineNumberReader lnr = new LineNumberReader(reader);
		final String line = lnr.readLine();
		lnr.close();
		reader.close();
		stream.close();
		return line;
	}
1322911
public static VersionNumber parseVersion(@Nonnull final String version) {
		Check.notNull(version, "version");

		VersionNumber result = new VersionNumber(new ArrayList<String>(0), version);
		final Matcher matcher = VERSIONSTRING.matcher(version);
		if (matcher.find()) {
			final List<String> groups = Arrays.asList(matcher.group(MAJOR_INDEX).split("\\."));
			final String extension = matcher.group(EXTENSION_INDEX) == null ? VersionNumber.EMPTY_EXTENSION : trimRight(matcher
					.group(EXTENSION_INDEX));
			result = new VersionNumber(groups, extension);
		}

		return result;
	}
456052
public final void parseVersion(String version) {
        versionParts = new ArrayList<>();
        if (version != null) {
            final Pattern rx = Pattern.compile("(\\d+[a-z]{1,3}$|[a-z]+\\d+|\\d+|(release|beta|alpha)$)");
            final Matcher matcher = rx.matcher(version.toLowerCase());
            while (matcher.find()) {
                versionParts.add(matcher.group());
            }
            if (versionParts.isEmpty()) {
                versionParts.add(version);
            }
        }
    }
448918
public void setCompileVersion(String version) {
        if (StringUtils.isNotEmpty(version)
                && !version.equals(ClassUtils.getJavaVersion())) {
            options.add("-target");
            options.add(version);
            lintOptions.add("-target");
            lintOptions.add(version);
        }
    }
685269
public static boolean isCompatibleJREVersion(String version) {
		if (version != null && !version.isEmpty()) {
			final Version current = Version.parseVersion(version);
			if (current != null) {
				final Version minJdk = Version.parseVersion(SARLVersion.MINIMAL_JDK_VERSION);
				assert minJdk != null;
				if (current.compareTo(minJdk) >= 0) {
					final Version maxJdk = Version.parseVersion(SARLVersion.MAXIMAL_JDK_VERSION);
					assert maxJdk != null;
					return current.compareTo(maxJdk) <= 0;
				}
			}
		}
		return false;
	}
1002329
public boolean isModifiedOnVersion(String version) {
		if (version == null || version.isEmpty()) {
			return true;
		}
		if (this.history != null && this.history.isModifiedOnVersion(version)) {
			return true;
		}
		if (this.fields != null) {
			for (APIParameter param : this.fields) {
				if (param.isModifiedOnVersion(version)) {
					return true;
				}
			}
		}
		return false;
	}
617099
public boolean isModifiedOnVersion(String version) {
		if (version == null || version.isEmpty()) {
			return true;
		}
		return version.equalsIgnoreCase(this.version);
	}
201976
public static boolean isOlderUnsupportedVersion(String version) {
		return ((version == null) || "".equals(version) || version.startsWith("0") || version.startsWith("1"));
	}
652015
private int[] parse(String version) {
        final Matcher m = Pattern.compile("(\\d+)\\.(\\d+)\\.(\\d+)-?(SNAPSHOT)?\\.?(\\d*)?").matcher(version);
        if (!m.matches()) {
            throw new IllegalArgumentException("Malformed version string: " + version);
        }

        return new int[] {Integer.parseInt(m.group(1)),   // major
                Integer.parseInt(m.group(2)),             // minor
                Integer.parseInt(m.group(3)),             // revision
                m.group(4) == null ? 0                    // no SNAPSHOT suffix
                        : m.group(5).isEmpty() ? 0        // "SNAPSHOT"
                        : Integer.parseInt(m.group(5)),   // "SNAPSHOT.123"
        };
    }
183798
public static Version parse(String version) {
        if (version == null) {
            throw new NullPointerException("version is null");
        }
        Version result = new Version();
        String[] numbers = version.split(".");
        for (int i = 0; i < numbers.length; i++) {
            String parts[] = numbers[i].split("-");
            int number = Integer.parseInt(parts[0]);
            StringBuilder label = new StringBuilder();
            for (int j = 1; j < parts.length; j++) {
                if ((i < numbers.length - 1) && (j < parts.length - 1)){
                    label.append('-').append(parts[j]);
                } else {
                    result.setSnapshot(parts[j].equalsIgnoreCase("SNAPSHOT"));
                }
            }
            result.append(number, label.toString());
        }
        return result;
    }
94294
public static VersionNumber parseLastVersionNumber(@Nonnull final String text) {
		return VersionParser.parseLastVersionNumber(Check.notNull(text, "text"));
	}
1338451
static int getMajorJavaVersion(String javaVersion) {
    int version = parseDotted(javaVersion);
    if (version == -1) {
      version = extractBeginningInt(javaVersion);
    }
    if (version == -1) {
      return 6;  // Choose minimum supported JDK version as default
    }
    return version;
  }
998921
public org.tensorflow.framework.VersionDef getVersion() {
    return version_ == null ? org.tensorflow.framework.VersionDef.getDefaultInstance() : version_;
  }