Skip to content

Commit

Permalink
Fixing rectangle dimension, and adding equals and hashCode
Browse files Browse the repository at this point in the history
  • Loading branch information
barancev committed Feb 21, 2016
1 parent f0e3e8c commit 3e80b6a
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion java/client/src/org/openqa/selenium/Rectangle.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,31 @@ public Point getPoint() {
}

public Dimension getDimension() {
return new Dimension(x, y);
return new Dimension(width, height);
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}

Rectangle rectangle = (Rectangle) o;

if (! getPoint().equals(rectangle.getPoint())) {
return false;
}
return getDimension().equals(rectangle.getDimension());

}

@Override
public int hashCode() {
int result = getPoint().hashCode();
result = 31 * result + getDimension().hashCode();
return result;
}
}

0 comments on commit 3e80b6a

Please sign in to comment.