org.xnap.commons.util
Class VersionParser

java.lang.Object
  extended by org.xnap.commons.util.VersionParser
All Implemented Interfaces:
Comparable

public class VersionParser
extends Object
implements Comparable

This class can parse an compare (software) versions.


Constructor Summary
VersionParser(String version)
          Constructs a new version parser that parses version.
 
Method Summary
static int compare(String v1, String v2)
          Compares version v1 with version v2.
 int compareTo(Object o)
          Compares this VersionParser to o.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VersionParser

public VersionParser(String version)
Constructs a new version parser that parses version.

Method Detail

compare

public static int compare(String v1,
                          String v2)
Compares version v1 with version v2.

Returns:
1, if v1 is more recent; 0, if v1 is equal to v2; -1, if v2 is more recent
See Also:
compareTo(Object)

compareTo

public int compareTo(Object o)
Compares this VersionParser to o.

Specified by:
compareTo in interface Comparable
Returns:
1, if v1 is more recent; 0, if v1 is equal to v2; -1, if v2 is more recent

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2004-2007 XNap Commons Team. All Rights Reserved.