• 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/NativeMethods.java
1
/*
2
 * Copyright 2017-2019, 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;
17

18
import com.uber.h3core.util.LatLng;
19
import java.util.ArrayList;
20
import java.util.List;
21

22
/**
23
 * Interface to native code. Implementation of these functions is in <code>
24
 * src/main/c/h3-java/src/jniapi.c</code>.
25
 */
26
final class NativeMethods {
27
  NativeMethods() {
1✔
28
    // Only H3CoreLoader is expected to instantiate
29
  }
1✔
30

31
  native long cellToChildrenSize(long h3, int childRes);
32

33
  native void cellToChildren(long h3, int childRes, long[] results);
34

35
  native long cellToCenterChild(long h3, int childRes);
36

37
  native boolean isValidCell(long h3);
38

39
  native int getBaseCellNumber(long h3);
40

41
  native boolean isPentagon(long h3);
42

43
  native long latLngToCell(double lat, double lon, int res);
44

45
  native void cellToLatLng(long h3, double[] verts);
46

47
  native int cellToBoundary(long h3, double[] verts);
48

49
  native long maxGridDiskSize(int k);
50

51
  native void gridDisk(long h3, int k, long[] results);
52

53
  native void gridDiskDistances(long h3, int k, long[] results, int[] distances);
54

55
  native void gridDiskUnsafe(long h3, int k, long[] results);
56

57
  native void gridRingUnsafe(long h3, int k, long[] results);
58

59
  native long gridDistance(long a, long b);
60

61
  native void cellToLocalIj(long origin, long h3, int[] coords);
62

63
  native long localIjToCell(long origin, int i, int j);
64

65
  native long gridPathCellsSize(long start, long end);
66

67
  native void gridPathCells(long start, long end, long[] results);
68

69
  native long maxPolygonToCellsSize(
70
      double[] verts, int[] holeSizes, double[] holeVerts, int res, int flags);
71

72
  native void polygonToCells(
73
      double[] verts, int[] holeSizes, double[] holeVerts, int res, int flags, long[] results);
74

75
  native void cellsToLinkedMultiPolygon(long[] h3, ArrayList<List<List<LatLng>>> results);
76

77
  native void compactCells(long[] h3, long[] results);
78

79
  native long uncompactCellsSize(long[] h3, int res);
80

81
  native void uncompactCells(long[] h3, int res, long[] results);
82

83
  native double cellAreaRads2(long h3);
84

85
  native double cellAreaKm2(long h3);
86

87
  native double cellAreaM2(long h3);
88

89
  native double greatCircleDistanceRads(double lat1, double lon1, double lat2, double lon2);
90

91
  native double greatCircleDistanceKm(double lat1, double lon1, double lat2, double lon2);
92

93
  native double greatCircleDistanceM(double lat1, double lon1, double lat2, double lon2);
94

95
  native double edgeLengthRads(long h3);
96

97
  native double edgeLengthKm(long h3);
98

99
  native double edgeLengthM(long h3);
100

101
  native double getHexagonAreaAvgKm2(int res);
102

103
  native double getHexagonAreaAvgM2(int res);
104

105
  native double getHexagonEdgeLengthAvgKm(int res);
106

107
  native double getHexagonEdgeLengthAvgM(int res);
108

109
  native long getNumCells(int res);
110

111
  native void getRes0Cells(long[] indexes);
112

113
  native void getPentagons(int res, long[] h3);
114

115
  native boolean areNeighborCells(long a, long b);
116

117
  native long cellsToDirectedEdge(long a, long b);
118

119
  native boolean isValidDirectedEdge(long h3);
120

121
  native long getDirectedEdgeOrigin(long h3);
122

123
  native long getDirectedEdgeDestination(long h3);
124

125
  native void directedEdgeToCells(long h3, long[] results);
126

127
  native void originToDirectedEdges(long h3, long[] results);
128

129
  native int directedEdgeToBoundary(long h3, double[] verts);
130

131
  native int maxFaceCount(long h3);
132

133
  native void getIcosahedronFaces(long h3, int[] faces);
134

135
  native long cellToVertex(long h3, int vertexNum);
136

137
  native void cellToVertexes(long h3, long[] results);
138

139
  native void vertexToLatLng(long h3, double[] latLng);
140

141
  native boolean isValidVertex(long h3);
142

143
  native long cellToChildPos(long child, int parentRes);
144

145
  native long childPosToCell(long childPos, long parent, int childRes);
146
}
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