r1463 - trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata
Author: tchemit Date: 2008-03-31 21:01:56 +0000 (Mon, 31 Mar 2008) New Revision: 1463 Modified: trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/Version.java Log: javadoc Modified: trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/Version.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/Version.java 2008-03-26 13:54:32 UTC (rev 1462) +++ trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/Version.java 2008-03-31 21:01:56 UTC (rev 1463) @@ -22,7 +22,7 @@ /** * Pointed version class. - * + * * @author Code Lutin, Landais Gabriel, Chemit Tony */ public class Version implements Comparable<Version>, Serializable { @@ -38,9 +38,8 @@ /** * Static public factory of Version from his string representation. - * + * * @param version the string representation of the version - * * @return a new instance of version */ public static Version valueOf(String version) { @@ -49,7 +48,7 @@ /** * Instantiates a new version. - * + * * @param versions the versions */ private Version(int[] versions) { @@ -58,7 +57,7 @@ /** * Default constructor. - * + * * @param version String version */ private Version(String version) { @@ -74,9 +73,8 @@ /** * Retrieve sub version. - * + * * @param position Sub version wanted - * * @return the sub version number */ public Integer getVersion(int position) { @@ -88,9 +86,10 @@ /** * Truncate the version to n pointed versions. - * + * <p/> + * Note :As Version is immutable, a new instance of Version is returned. + * * @param nVersions the number of pointed versions - * * @return the version */ public Version truncate(int nVersions) { @@ -103,15 +102,15 @@ newVersion[i] = 0; } } - Version result = new Version(newVersion); - return result; + return new Version(newVersion); } /** * Increment the i th pointed version. - * + * <p/> + * Note :As Version is immutable, a new instance of Version is returned. + * * @param iVersion the pointed version to increment - * * @return the version */ public Version increment(int iVersion) { @@ -122,7 +121,7 @@ /** * Length of version. - * + * * @return Number of subversions */ public int getLength() { @@ -179,10 +178,7 @@ */ @Override public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + Arrays.hashCode(pointedVersion); - return result; + return 31 + Arrays.hashCode(pointedVersion); } /* (non-Javadoc) @@ -190,16 +186,9 @@ */ @Override public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - final Version other = (Version) obj; - if (!Arrays.equals(pointedVersion, other.pointedVersion)) - return false; - return true; + return this == obj || + obj != null && getClass() == obj.getClass() && + Arrays.equals(pointedVersion, ((Version) obj).pointedVersion); } } \ No newline at end of file
participants (1)
-
tchemit@users.labs.libre-entreprise.org