jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1225215 - /jmeter/trunk/src/jorphan/org/apache/jorphan/io/TextFile.java
Date Wed, 28 Dec 2011 16:15:00 GMT
Author: pmouawad
Date: Wed Dec 28 16:15:00 2011
New Revision: 1225215

URL: http://svn.apache.org/viewvc?rev=1225215&view=rev
Log:
Implemented equals and hashcode

Modified:
    jmeter/trunk/src/jorphan/org/apache/jorphan/io/TextFile.java

Modified: jmeter/trunk/src/jorphan/org/apache/jorphan/io/TextFile.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/jorphan/org/apache/jorphan/io/TextFile.java?rev=1225215&r1=1225214&r2=1225215&view=diff
==============================================================================
--- jmeter/trunk/src/jorphan/org/apache/jorphan/io/TextFile.java (original)
+++ jmeter/trunk/src/jorphan/org/apache/jorphan/io/TextFile.java Wed Dec 28 16:15:00 2011
@@ -172,4 +172,36 @@ public class TextFile extends File {
     public void setEncoding(String string) {
         encoding = string;
     }
+
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = super.hashCode();
+		result = prime * result
+				+ ((encoding == null) ? 0 : encoding.hashCode());
+		return result;
+	}
+
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (!super.equals(obj))
+			return false;
+		if (!(obj instanceof TextFile))
+			return false;
+		TextFile other = (TextFile) obj;
+		if (encoding == null) {
+			if (other.encoding != null)
+				return false;
+		} else if (!encoding.equals(other.encoding))
+			return false;
+		return true;
+	}
 }



Mime
View raw message