Package net.sf.saxon.style

## Class PackageVersion

- java.lang.Object
- - net.sf.saxon.style.PackageVersion

- All Implemented Interfaces:
    `java.lang.Comparable<PackageVersion>`

      public class PackageVersion
      extends java.lang.Object
      implements java.lang.Comparable<PackageVersion>

  A class to represent an XSLT package version such as 1.12.5 or 3.0-alpha

  This implements the semantics given in http://www.w3.org/TR/xslt-30/#package-versions, where a series of dot-separated integers may be followed optionally by '-'NCName

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static PackageVersion` | `MAX_VALUE` |
    `static PackageVersion` | `ONE` |
    `java.util.List<java.lang.Integer>` | `parts` |
    `java.lang.String` | `suffix` |
    `static PackageVersion` | `ZERO` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `PackageVersion​(int[] values)` | Return a package version defined by a fixed sequence of int values, which implies no suffix
    `PackageVersion​(java.lang.String s)` | Generate a package version from a string description

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `int` | `compareTo​(PackageVersion o)` |
    `boolean` | `equals​(java.lang.Object o)` |
    `boolean` | `equalsIgnoringSuffix​(PackageVersion other)` | Compare two version numbers for equality, ignoring the suffix part of the version number.
    `boolean` | `isPrefix​(PackageVersion v)` | Tests whether this package version is a prefix (i.e.
    `java.lang.String` | `toString()` |

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### parts

          public java.util.List<java.lang.Integer> parts

    - #### suffix

          public java.lang.String suffix

    - #### ZERO

          public static PackageVersion ZERO

    - #### ONE

          public static PackageVersion ONE

    - #### MAX_VALUE

          public static PackageVersion MAX_VALUE

  - ### Constructor Detail

    - #### PackageVersion

          public PackageVersion​(int[] values)

      Return a package version defined by a fixed sequence of int values, which implies no suffix
      Parameters:
        `values` - the sequence of integer components

    - #### PackageVersion

          public PackageVersion​(java.lang.String s)
                         throws XPathException

      Generate a package version from a string description
      Parameters:
        `s` - The input string describing the package version according to the grammar given at: http://www.w3.org/TR/xslt-30/#package-versions
      Throws:
        `XPathException`

  - ### Method Detail

    - #### equals

          public boolean equals​(java.lang.Object o)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### equalsIgnoringSuffix

          public boolean equalsIgnoringSuffix​(PackageVersion other)

      Compare two version numbers for equality, ignoring the suffix part of the version number. For example 2.1-alpha compares equal to 2.1-beta
      Parameters:
        `other` - the other name/version pair
      Returns:
        true if the values are equal in all respects other than the alphanumeric suffix of the version number.

    - #### compareTo

          public int compareTo​(PackageVersion o)

      Specified by:
        `compareTo` in interface `java.lang.Comparable<PackageVersion>`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### isPrefix

          public boolean isPrefix​(PackageVersion v)

      Tests whether this package version is a prefix (i.e. shares all its components in order) of another package version, and thus this version.* should match it.
      Parameters:
        `v` - The version to be checked that it is equal, or 'extends' this version
      Returns:
        true if this is a prefix, false if not.