Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.pkg.client
Class Version

    java.lang.Object
      com.sun.pkg.client.Version

All Implemented Interfaces:
  java.lang.Comparable<Version>

    public class Version

extends java.lang.Object
implements java.lang.Comparable<Version>

A `Version` represents the version part of an IPS package FMRI. The version format is release[,build_release]-branch:publishtime, which is decomposed into three DotSequences and the publish time. The text representation of the publish time is in the ISO8601-compliant form "YYYYMMDDTHHMMSSZ", referring to the UTC time associated with the version. The release and branch DotSequences are interpreted normally, where v1 < v2 implies that v2 is a later release or branch. The build_release DotSequence records the system on which the package binaries were constructed. Interpretation of the build_release by the client is that, in the case b1 < b2, a b1 package can be run on either b1 or b2 systems, while a b2 package can only be run on a b2 system.

Nested Class Summary
`static class` | `Version.DotSequence` The `DotSequence` class represents the x.y.z parts of a Version object.

Constructor Summary
`Version(java.lang.String s)` Create a `Version` based on the given string representation.

Method Summary
`int` | `compareTo(Version v)` Compare two versions.
`boolean` | `equals(java.lang.Object v)` Compare two versions for equality.
`Version.DotSequence` | `getBranch()` Returns the branch part of the `Version`.
`java.util.Date` | `getPublishDate()` Returns the publish time part of the `Version`.
`Version.DotSequence` | `getRelease()` Returns the release part of the `Version`.
`int` | `hashCode()` Returns a hash code value for the object.
`boolean` | `isNull()` Tests whether this object is equal to the null or empty Version, i.e., Version("")
`boolean` | `isSuccessor(Version v)` Determine if a version is a successor to this version.
`boolean` | `matches(Version v)` Determine if a version matches this version A version v matches this version if it is all of the version information that is specified matches the corresponding version information in this version.
`java.lang.String` | `toString()` Returns a string representation for the `Version`.

Methods inherited from class java.lang.Object
`getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Version

    public Version(java.lang.String s)

  Create a `Version` based on the given string representation.

  Parameters:
    `s` - the string representation for the version

Method Detail

### matches

    public boolean matches(Version v)

  Determine if a version matches this version A version v matches this version if it is all of the version information that is specified matches the corresponding version information in this version. For example version 1 matches 1.1 and 1.2 but not 2.1.

  Parameters:
    `v` - the version to compare
  Returns:
    true if version v matches this version

### equals

    public boolean equals(java.lang.Object v)

  Compare two versions for equality.

  Overrides:
    `equals` in class `java.lang.Object`
  Returns:
    True if the two versions are equal

### hashCode

    public int hashCode()

  Returns a hash code value for the object. See the description of Object.hashcode for more details.

  Overrides:
    `hashCode` in class `java.lang.Object`
  Returns:
    a hash code value for this object.

### compareTo

    public int compareTo(Version v)

  Compare two versions.

  Specified by:
    `compareTo` in interface `java.lang.Comparable<Version>`
  Parameters:
    `v` -
  Returns:
    -1 if this version is less than v, 0 if they are equal, 1 if this version is greater than v

### isSuccessor

    public boolean isSuccessor(Version v)

  Determine if a version is a successor to this version. The definition of "successor" here is that of the CONSTRAINT_AUTO that is implemented in the pkg(5) version module. See the Python code in version.py for details.

### toString

    public java.lang.String toString()

  Returns a string representation for the `Version`.

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    a string representation for the object.

### isNull

    public boolean isNull()

  Tests whether this object is equal to the null or empty Version, i.e., Version("")

  Returns:
    true if this is the nullVersion

### getRelease

    public Version.DotSequence getRelease()

  Returns the release part of the `Version`.

  Returns:
    the release part of the object.

### getBranch

    public Version.DotSequence getBranch()

  Returns the branch part of the `Version`.

  Returns:
    the branch part of the object.

### getPublishDate

    public java.util.Date getPublishDate()

  Returns the publish time part of the `Version`. If no publish time was provided when the object was created, the publish time returned is a Date created with 0.

  Returns:
    the publish time part of the object.

Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD