My favorites
▼
|
Sign in
jau
Java Annotation Based Utilities
Project Home
Downloads
Wiki
Issues
Source
Checkout
Browse
Changes
Source path:
svn
/
trunk
/
JAU
/
test
/
com
/
googlecode
/
jau
/
RealClass.java
‹r60
r91
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package com.googlecode.jau;
/**
* "Real life example"
*/
@JAUEquals
@JAUHashCode
public class RealClass {
private int x = 1;
private int y = 2;
private int z = 3;
private double a = 5.4343;
private String txt = "Testme";
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final RealClass other = (RealClass) obj;
if (this.x != other.x) {
return false;
}
if (this.y != other.y) {
return false;
}
if (this.z != other.z) {
return false;
}
if (Double.doubleToLongBits(this.a) != Double.doubleToLongBits(other.a)) {
return false;
}
if ((this.txt == null) ? (other.txt != null) : !this.txt.equals(other.txt)) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 7;
hash = 23 * hash + this.x;
hash = 23 * hash + this.y;
hash = 23 * hash + this.z;
hash =
23 * hash +
(int) (Double.doubleToLongBits(this.a) ^
(Double.doubleToLongBits(this.a) >>> 32));
hash = 23 * hash + (this.txt != null ? this.txt.hashCode() : 0);
return hash;
}
@Override
public String toString() {
return super.toString() +
"(x="+x + ", y="+ y + ", z="+z + ", a="+a+", txt=\""+txt+"\")";
}
}
Show details
Hide details
Change log
r69
by Tim.Lebedkov on Feb 8, 2009
Diff
improve performance for equals()
Go to:
/trunk/JAU/build.xml
...perf-config-equals-bigstring.xml
...k/JAU/perf-config-equals-int.xml
/trunk/JAU/perf-config-tostring.xml
...om/googlecode/jau/ClassInfo.java
.../src/com/googlecode/jau/JAU.java
...e/jau/EqualsJAUIntPerfTest_.java
...au/EqualsManualIntPerfTest_.java
...oglecode/jau/GGJAUPerfTest_.java
...ecode/jau/GGManualPerfTest_.java
...om/googlecode/jau/RealClass.java
...om/googlecode/jau/ToMapTest.java
Project members,
sign in
to write a code review
Older revisions
r60
by Tim.Lebedkov on Feb 4, 2009
Diff
- more tests
All revisions of this file
File info
Size: 1567 bytes, 61 lines
View raw file
Powered by
Google Project Hosting