Skip to content

Commit 3e80b6a

Browse files
committed
Fixing rectangle dimension, and adding equals and hashCode
1 parent f0e3e8c commit 3e80b6a

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

java/client/src/org/openqa/selenium/Rectangle.java

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,31 @@ public Point getPoint() {
7575
}
7676

7777
public Dimension getDimension() {
78-
return new Dimension(x, y);
78+
return new Dimension(width, height);
79+
}
80+
81+
@Override
82+
public boolean equals(Object o) {
83+
if (this == o) {
84+
return true;
85+
}
86+
if (o == null || getClass() != o.getClass()) {
87+
return false;
88+
}
89+
90+
Rectangle rectangle = (Rectangle) o;
91+
92+
if (! getPoint().equals(rectangle.getPoint())) {
93+
return false;
94+
}
95+
return getDimension().equals(rectangle.getDimension());
96+
97+
}
98+
99+
@Override
100+
public int hashCode() {
101+
int result = getPoint().hashCode();
102+
result = 31 * result + getDimension().hashCode();
103+
return result;
79104
}
80105
}

0 commit comments

Comments
 (0)