• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

uber / h3-java / #405

11 Aug 2024 08:49PM CUT coverage: 98.805%. Remained the same
#405

push

github

web-flow
update pom.xml to a valid email address (#145)

496 of 502 relevant lines covered (98.8%)

0.99 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/main/java/com/uber/h3core/util/LatLng.java
1
/*
2
 * Copyright 2017-2018, 2022 Uber Technologies, Inc.
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *         http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
package com.uber.h3core.util;
17

18
import java.util.Objects;
19

20
/** Immutable two-dimensional spherical coordinates, in degrees. */
21
public class LatLng {
22
  /** Latitude (north-south) coordinate in degrees */
23
  public final double lat;
24
  /** Longitude (east-west) coordinate in degrees */
25
  public final double lng;
26

27
  /**
28
   * Construct with latitude and longitude
29
   *
30
   * @param lat Latitude coordinate
31
   * @param lng Longitude coordinate
32
   */
33
  public LatLng(double lat, double lng) {
1✔
34
    this.lat = lat;
1✔
35
    this.lng = lng;
1✔
36
  }
1✔
37

38
  @Override
39
  public boolean equals(Object o) {
40
    if (this == o) return true;
1✔
41
    if (o == null || getClass() != o.getClass()) return false;
1✔
42
    LatLng coord = (LatLng) o;
1✔
43
    return Double.compare(coord.lat, lat) == 0 && Double.compare(coord.lng, lng) == 0;
1✔
44
  }
45

46
  @Override
47
  public int hashCode() {
48
    return Objects.hash(lat, lng);
1✔
49
  }
50

51
  @Override
52
  public String toString() {
53
    return String.format("LatLng{lat=%f, lng=%f}", lat, lng);
1✔
54
  }
55
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc