incubator-depot-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nickcha...@apache.org
Subject svn commit: rev 43409 - incubator/depot/trunk/version/src/java/org/apache/depot/version/impl
Date Mon, 06 Sep 2004 06:42:13 GMT
Author: nickchalko
Date: Sun Sep  5 23:42:13 2004
New Revision: 43409

Modified:
   incubator/depot/trunk/version/src/java/org/apache/depot/version/impl/ApacheVersion.java
Log:
Fixed equals.

Modified: incubator/depot/trunk/version/src/java/org/apache/depot/version/impl/ApacheVersion.java
==============================================================================
--- incubator/depot/trunk/version/src/java/org/apache/depot/version/impl/ApacheVersion.java
(original)
+++ incubator/depot/trunk/version/src/java/org/apache/depot/version/impl/ApacheVersion.java
Sun Sep  5 23:42:13 2004
@@ -43,11 +43,10 @@
 import org.w3c.dom.Element;
 
 /**
- * Apache Version.
- * Has the genral form Major.minor.point.
- * Major version are not compatible.
- * Minor version are backwards compatible.
- * Point version are forwards and backwards compatible.
+ * Apache Version. Has the genral form Major.minor.point. Major version are not
+ * compatible. Minor version are backwards compatible. Point version are
+ * forwards and backwards compatible.
+ * 
  * @author arb_jack@users.apache.org
  */
 public class ApacheVersion implements Version, CompoundVersion, Dumpable,
@@ -249,18 +248,16 @@
 	}
 
 	public boolean equals(Object other) {
-		boolean equal = false;
-
-		if (other instanceof ApacheVersion) {
+		if (this == other) {
+			return true;
+		} else if (other instanceof ApacheVersion) {
 			ApacheVersion otherVersion = (ApacheVersion) other;
+			return otherVersion.m_data.equals(m_data);
+		} else {
 
-			equal = otherVersion.m_data.equals(m_data);
+			return false;
+		}
 
-			// :TODO: Specification?
-		} else
-			throw new IllegalArgumentException("Not a ApacheVersion: "
-					+ other.getClass() + " : " + other.toString());
-		return equal;
 	}
 
 	public int compareTo(Object other) {
@@ -292,11 +289,11 @@
 	/**
 	 * Compute if this version is compatible with other.
 	 * 
-	 * "Compatible" means (in effect) this version is a "good replacement"
-	 * for the other version.
+	 * "Compatible" means (in effect) this version is a "good replacement" for
+	 * the other version.
 	 * 
-	 * The aspects of a version that are utilized are:
-	 *  - Major Version - Minor Version - Release Level
+	 * The aspects of a version that are utilized are: - Major Version - Minor
+	 * Version - Release Level
 	 * 
 	 * The more specified in this version, the more are considered.
 	 * 
@@ -311,7 +308,7 @@
 	 *  
 	 */
 	public boolean isCompatible(Version other) {
- 		boolean compatible = false;
+		boolean compatible = false;
 
 		//
 		// If this is unset, then all are compatible...
@@ -325,14 +322,16 @@
 			//
 			// *other is unset, or major's equal
 			//
-			if ((VersionDataElement.UNSET_MAJOR == otherApacheVersion.getMajor())
+			if ((VersionDataElement.UNSET_MAJOR == otherApacheVersion
+					.getMajor())
 					|| otherApacheVersion.getMajor() == getMajor()) {
 
 				//
 				// other is unset, or minor's equal
 				//
-				if ((VersionDataElement.UNSET_MINOR == otherApacheVersion.getMinor())
-						||   getMinor() >=otherApacheVersion.getMinor()){
+				if ((VersionDataElement.UNSET_MINOR == otherApacheVersion
+						.getMinor())
+						|| getMinor() >= otherApacheVersion.getMinor()) {
 
 					//
 					//  *Other* Release Level Higher

Mime
View raw message