netx.jnlp
Class Version
public class Version
extends java.lang.Object
A JNLP Version string in the form "1.2-3_abc" followed by an
optional + (includes all later versions) or * (matches any
suffixes on versions). More than one version can be included
in a string by separating them with spaces.
Version strings are divided by "._-" charecters into parts.
These parts are compared numerically if they can be parsed as
integers or lexographically as strings otherwise. If the
number of parts is different between two version strings then
the smaller one is padded with zero or the empty string. Note
that the padding in this version means that 1.2+ matches
1.4.0-beta1, but may not in future versions.
Version(String versions) - Create a Version object based on a version string (ie,
"1.2.3+ 4.56*").
|
protected int | compare(String part1, String part2) - Compares two parts of a version string, by value if both can
be interpreted as integers or lexically otherwise.
|
protected boolean | equal(List parts1, List parts2) - Returns whether the parts of one version are equal to the
parts of another version.
|
protected List | getParts(String oneVersion) - Return the constituent parts of a version string.
|
protected List | getVersionStrings() - Return the individual version strings that make up a Version.
|
protected boolean | greater(List parts1, List parts2) - Returns whether the parts of one version are greater than
the parts of another version.
|
boolean | isVersionId() - Returns true if the version represents a version-id (a
single version number such as 1.2) and false otherwise.
|
boolean | matches(String version) - Returns true if all of this version's version-ids match one
or more of the specifed version's version-id.
|
boolean | matches(Version version) - Returns true if all of this version's version-ids match one
or more of the specifed version's version-id.
|
boolean | matchesAny(String version) - Returns true if any of this version's version-ids match one
or more of the specifed version's version-id.
|
boolean | matchesAny(Version version) - Returns true if any of this version's version-ids match one
or more of the specifed version's version-id.
|
protected void | normalize(versions[] , int maxLength) - Normalize version strings so that they contain the same
number of constituent parts.
|
String | toString()
|
Version
public Version(String versions)
Create a Version object based on a version string (ie,
"1.2.3+ 4.56*").
compare
protected int compare(String part1,
String part2)
Compares two parts of a version string, by value if both can
be interpreted as integers or lexically otherwise. If a part
is the result of normalization then it can be the Integer
zero or an empty string.
Returns a value equivalent to part1.compareTo(part2);
part1
- a part of a version stringpart2
- a part of a version string
- comparison of the two parts
equal
protected boolean equal(List parts1,
List parts2)
Returns whether the parts of one version are equal to the
parts of another version.
parts1
- normalized version partsparts2
- normalized version parts
getParts
protected List getParts(String oneVersion)
Return the constituent parts of a version string.
oneVersion
- a single version id string (not compound)
getVersionStrings
protected List getVersionStrings()
Return the individual version strings that make up a Version.
greater
protected boolean greater(List parts1,
List parts2)
Returns whether the parts of one version are greater than
the parts of another version.
parts1
- normalized version partsparts2
- normalized version parts
isVersionId
public boolean isVersionId()
Returns true if the version represents a version-id (a
single version number such as 1.2) and false otherwise.
matches
public boolean matches(String version)
Returns true if all of this version's version-ids match one
or more of the specifed version's version-id.
version
- a version string
matches
public boolean matches(Version version)
Returns true if all of this version's version-ids match one
or more of the specifed version's version-id.
version
- a Version object
matchesAny
public boolean matchesAny(String version)
Returns true if any of this version's version-ids match one
or more of the specifed version's version-id.
version
- a version string
matchesAny
public boolean matchesAny(Version version)
Returns true if any of this version's version-ids match one
or more of the specifed version's version-id.
version
- a Version object
normalize
protected void normalize(versions[] ,
int maxLength)
Normalize version strings so that they contain the same
number of constituent parts.
maxLength
- truncate lists to this maximum length
toString
public String toString()