Skip to content

Commit

Permalink
feat: remove unnecessary Size function
Browse files Browse the repository at this point in the history
  • Loading branch information
noandrea committed Jun 29, 2024
1 parent e02278d commit 7c03154
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 10 deletions.
1 change: 0 additions & 1 deletion db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import "errors"

type TzDBIndex interface {
Lookup(lat, lon float64) (string, error)
Size() int
}

var (
Expand Down
7 changes: 0 additions & 7 deletions db/rtree.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
type Geo2TzRTreeIndex struct {
land rtree.RTreeG[timezoneGeo]
sea rtree.RTreeG[timezoneGeo]
size int
}

// IsOcean checks if the timezone is for oceans
Expand All @@ -25,7 +24,6 @@ func IsOcean(label string) bool {

// Insert adds a new timezone bounding box to the index
func (g *Geo2TzRTreeIndex) Insert(min, max [2]float64, element timezoneGeo) {
g.size++
if IsOcean(element.Name) {
g.sea.Insert(min, max, element)
return
Expand Down Expand Up @@ -117,11 +115,6 @@ func (g *Geo2TzRTreeIndex) Lookup(lat, lng float64) (tzID string, err error) {
return
}

// Size returns the number of timezones in the index
func (g *Geo2TzRTreeIndex) Size() int {
return g.size
}

// isPointInPolygonPIP checks if a point is inside a polygon using the Point in Polygon algorithm
func isPointInPolygonPIP(point vertex, polygon polygon) bool {
oddNodes := false
Expand Down
2 changes: 0 additions & 2 deletions db/rtree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ func TestGeo2TzTreeIndex_LookupZone(t *testing.T) {
// load the database
gsi, err := NewGeo2TzRTreeIndexFromGeoJSON("../tzdata/timezones.zip")
assert.NoError(t, err)
assert.NotEmpty(t, gsi.Size())

// load the coordinates
err = helpers.LoadJSON("testdata/coordinates.json", &tests)
Expand All @@ -46,7 +45,6 @@ func BenchmarkGeo2TzTreeIndex_LookupZone(b *testing.B) {
// load the database
gsi, err := NewGeo2TzRTreeIndexFromGeoJSON("../tzdata/timezones.zip")
assert.NoError(b, err)
assert.NotEmpty(b, gsi.Size())

// load the coordinates
var tests []struct {
Expand Down

0 comments on commit 7c03154

Please sign in to comment.