Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
SeleniumHQ
GitHub Repository: SeleniumHQ/Selenium
Path: blob/trunk/java/src/org/openqa/selenium/Dimension.java
1865 views
1
// Licensed to the Software Freedom Conservancy (SFC) under one
2
// or more contributor license agreements. See the NOTICE file
3
// distributed with this work for additional information
4
// regarding copyright ownership. The SFC licenses this file
5
// to you under the Apache License, Version 2.0 (the
6
// "License"); you may not use this file except in compliance
7
// with the License. You may obtain a copy of the License at
8
//
9
// http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing,
12
// software distributed under the License is distributed on an
13
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
// KIND, either express or implied. See the License for the
15
// specific language governing permissions and limitations
16
// under the License.
17
18
package org.openqa.selenium;
19
20
import java.util.Objects;
21
import org.jspecify.annotations.NullMarked;
22
import org.jspecify.annotations.Nullable;
23
24
/** Similar to Point - implement locally to avoid depending on GWT. */
25
@NullMarked
26
public class Dimension {
27
public final int width;
28
public final int height;
29
30
public Dimension(int width, int height) {
31
this.width = width;
32
this.height = height;
33
}
34
35
public int getWidth() {
36
return width;
37
}
38
39
public int getHeight() {
40
return height;
41
}
42
43
@Override
44
public boolean equals(@Nullable Object o) {
45
if (!(o instanceof Dimension)) {
46
return false;
47
}
48
49
Dimension other = (Dimension) o;
50
return other.width == width && other.height == height;
51
}
52
53
@Override
54
public int hashCode() {
55
return Objects.hash(width, height);
56
}
57
58
@Override
59
public String toString() {
60
return String.format("(%d, %d)", width, height);
61
}
62
}
63
64