ImageScience 3.0.0

imagescience.utility
Class VersionChecker

java.lang.Object
  extended by imagescience.utility.VersionChecker

public class VersionChecker
extends java.lang.Object

Compares version strings. The strings are assumed to be of the form P.S.T.Q, where P, S, T, and Q are integers representing the primary, secondary, tertiary, and quaternary version numbers, respectively, separated by a period. Rather than comparing the strings lexicographically, this class compares the values of P, S, T, and Q as integers, in that order. This allows any of them to be outside the range 0...9 and still compare properly. If any of them are missing, or do not represent an integer value, they default to 0. Version strings are allowed to have an extra period followed by additional version information, for example P.S.T.Q.beta, but that information is ignored.


Constructor Summary
VersionChecker()
          Default constructor.
 
Method Summary
static int compare(java.lang.String v1, java.lang.String v2)
          Indicates how the given version strings compare to each other.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VersionChecker

public VersionChecker()
Default constructor.

Method Detail

compare

public static int compare(java.lang.String v1,
                          java.lang.String v2)
Indicates how the given version strings compare to each other.

Parameters:
v1 - The first version string.
v2 - The second version string.
Returns:
An integer value indicating how v1 compares to v2:
Value -1 means v1 is smaller (older) than v2.
Value 0 means v1 is equal to v2.
Value 1 means v1 is larger (newer) than v2.
Throws:
java.lang.NullPointerException - If v1 or v2 is null.

ImageScience 3.0.0

Copyright (C) Erik Meijering. Permission to use this software and corresponding documentation for educational, research, and not-for-profit purposes, without a fee and without a signed licensing agreement, is granted, subject to the following terms and conditions.

IT IS NOT ALLOWED TO REDISTRIBUTE, SELL, OR LEASE THIS SOFTWARE, OR DERIVATIVE WORKS THEREOF, WITHOUT PERMISSION IN WRITING FROM THE COPYRIGHT HOLDER. THE COPYRIGHT HOLDER IS FREE TO MAKE VERSIONS OF THE SOFTWARE AVAILABLE FOR A FEE OR COMMERCIALLY ONLY.

IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OF ANY KIND WHATSOEVER, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.

THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE EXPRESS OR IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE AND CORRESPONDING DOCUMENTATION IS PROVIDED "AS IS". THE COPYRIGHT HOLDER HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.