SourceType made Comparable

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@4721 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Xavier Le Vourch
2006-10-20 22:50:18 +00:00
parent 91614290e7
commit d1f45bb555

View File

@ -5,7 +5,7 @@ package net.sourceforge.pmd;
*
* @author Pieter_Van_Raemdonck - Application Engineers NV/SA - www.ae.be
*/
public final class SourceType {
public final class SourceType implements Comparable {
public static final SourceType JAVA_13 = new SourceType("java 1.3");
public static final SourceType JAVA_14 = new SourceType("java 1.4");
public static final SourceType JAVA_15 = new SourceType("java 1.5");
@ -31,10 +31,6 @@ public final class SourceType {
}
public boolean equals(Object other) {
if (other == null) {
return false;
}
if (other instanceof SourceType) {
return ((SourceType) other).getId().equals(getId());
}
@ -46,6 +42,10 @@ public final class SourceType {
return getId().hashCode();
}
public int compareTo(Object other) {
return getId().compareTo(((SourceType) other).getId());
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/