Main Page | Class List | File List | Class Members | Related Pages

org.doxygen.tools.DoxygenVersion Class Reference

List of all members.

Detailed Description

This class provides Doxygen version comparison support.

Author:
Karthik Kumar
Version:
Revision
1.2.4.5
Since:
Ant-Doxygen 1.0

Definition at line 71 of file DoxygenVersion.java.

Public Member Functions

 DoxygenVersion (String releaseMajorMinor, final int orderOfMagnitude) throws NumberFormatException
 DoxygenVersion (final String releaseMajorMinor)
final int compareTo (final Object obj)
boolean isCompatible (String version)
final String toString ()


Constructor & Destructor Documentation

org.doxygen.tools.DoxygenVersion.DoxygenVersion String  releaseMajorMinor,
final int  orderOfMagnitude
throws NumberFormatException
 

This constructor parses each of the version components for subsequent version-version comparison. This class solves the normal String v. int collation / comparison issues at the version string level.

Parameters:
releaseMajorMinor string obtained from "Doxygen --version".
orderOfMagnitude or number of components in the version string.

Definition at line 98 of file DoxygenVersion.java.

Referenced by org.doxygen.tools.DoxygenVersion.isCompatible().

00100                                                        {
00101         if (releaseMajorMinor.endsWith("+")) {
00102             upwards = true;
00103             int len = releaseMajorMinor.length();
00104             releaseMajorMinor = releaseMajorMinor.substring(0, len -1);
00105         }                            
00106         StringTokenizer st =
00107                     new StringTokenizer(releaseMajorMinor, ".");
00108 
00109         versions = new int[orderOfMagnitude];
00110 
00111         for (int i = 0; (i < orderOfMagnitude); i++) {
00112             versions[i] =
00113                 Integer.parseInt((String) st.nextToken());
00114         }
00115     }

org.doxygen.tools.DoxygenVersion.DoxygenVersion final String  releaseMajorMinor  ) 
 

This constructor assumes a canonical Doxygen version string form. That being Release.Major.Minor.

Parameters:
releaseMajorMinor version string obtained from "Doxygen --version". The order of magnitude is assumed to be DEFAULT_MAGNITUDE.

Definition at line 130 of file DoxygenVersion.java.

00130                                                           {
00131         this(releaseMajorMinor, DEFAULT_MAGNITUDE);
00132     }


Member Function Documentation

final int org.doxygen.tools.DoxygenVersion.compareTo final Object  obj  ) 
 

This method implements the compareTo() method from the Comparable interface.

Parameters:
obj instance to be compared against this instance.
Returns:
an int in the following range:
  • (1) - if this version is greater than obj version
  • (0) - if both versions are equal are equal.
  • (-1) - if this version is less than obj version, or if obj is not an instance of org.doxygen.tools.DoxygenVersion.

Definition at line 152 of file DoxygenVersion.java.

References org.doxygen.tools.DoxygenVersion.versions.

00152                                                  {
00153         if (obj instanceof DoxygenVersion) {
00154             DoxygenVersion dv = (DoxygenVersion) obj;
00155 
00156             for (int i = 0; (i < versions.length); i++) {
00157                 if (this.versions[i] > dv.versions[i]) {
00158                     return 1;
00159                 } else if (this.versions[i] == dv.versions[i]) {
00160                     continue;
00161                 } else {
00162                     return -1;
00163                 }
00164             }
00165             return 0; //Equal
00166         } else {
00167             return -1;
00168         }
00169     }

boolean org.doxygen.tools.DoxygenVersion.isCompatible String  version  ) 
 

To check if the given version is compatible with the current version.

Parameters:
version Version against which compatibility is to be checked.
Returns:
Returns true, if the argument version is ok against current version. false, otherwise.

Definition at line 179 of file DoxygenVersion.java.

References org.doxygen.tools.DoxygenVersion.DoxygenVersion(), and org.doxygen.tools.DoxygenVersion.upwards.

Referenced by org.doxygen.tools.DoxygenProcess.checkVersion().

00179                                                 {
00180         DoxygenVersion compatVersion = new DoxygenVersion(version);
00181         if (compatVersion.upwards) {
00182             return (this.compareTo(compatVersion) >= 0);
00183         } else {
00184             return (this.compareTo(compatVersion) == 0);
00185         }
00186     }

final String org.doxygen.tools.DoxygenVersion.toString  ) 
 

This method provides a standard diagnostic method toString().

Returns:
Stringified form of the values contained by this instance.

Definition at line 196 of file DoxygenVersion.java.

00196                                    {
00197         StringBuffer sb = new StringBuffer();
00198         for (int i = 0; (i < versions.length); i++) {
00199             sb.append(versions[i] + ".");
00200         }
00201         return sb.toString();
00202     }


The documentation for this class was generated from the following file:
Generated on Sat Jan 31 02:17:29 2004 for Ant-Doxygen by doxygen 1.3.4