This is an automated email from the ASF dual-hosted git repository. alsay pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/datasketches-go.git
commit a26c7f327bb2dd04772af9570c9abcf0c5859952 Author: Pierre Lacave <[email protected]> AuthorDate: Thu Dec 21 13:44:24 2023 +0100 More cleanup --- frequencies/longs_sketch_test.go | 4 ++-- frequencies/row.go | 10 +++++++--- frequencies/utils.go | 4 ++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/frequencies/longs_sketch_test.go b/frequencies/longs_sketch_test.go index 895c18b..e70d86c 100644 --- a/frequencies/longs_sketch_test.go +++ b/frequencies/longs_sketch_test.go @@ -408,9 +408,9 @@ func TestGetFrequentItems1(t *testing.T) { assert.Equal(t, row.item, int64(1)) assert.Equal(t, row.lb, int64(1)) assert.Equal(t, row.ub, int64(1)) - newRow := NewRow(row.item, row.est+1, row.ub, row.lb) + newRow := newRow(row.item, row.est+1, row.ub, row.lb) assert.NotEqual(t, row, newRow) - newRow = NewRow(row.item, row.est, row.ub, row.lb) + newRow = newRow(row.item, row.est, row.ub, row.lb) assert.Equal(t, row, newRow) } diff --git a/frequencies/row.go b/frequencies/row.go index 696193d..d9625cc 100644 --- a/frequencies/row.go +++ b/frequencies/row.go @@ -29,7 +29,7 @@ type Row struct { lb int64 } -func NewRow(item int64, estimate int64, ub int64, lb int64) *Row { +func newRow(item int64, estimate int64, ub int64, lb int64) *Row { return &Row{ item: item, est: estimate, @@ -42,6 +42,10 @@ func (r *Row) String() string { return fmt.Sprintf(" %20d%20d%20d %d", r.est, r.ub, r.lb, r.item) } +func (r *Row) GetItem() int64 { + return r.item +} + func (r *Row) GetEstimate() int64 { return r.est } @@ -72,7 +76,7 @@ func sortItems(sk *LongsSketch, threshold int64, errorType ErrorType) ([]*Row, e return nil, err } if ub >= threshold { - row := NewRow(iter.getKey(), est, ub, lb) + row := newRow(iter.getKey(), est, ub, lb) rowList = append(rowList, row) } } @@ -91,7 +95,7 @@ func sortItems(sk *LongsSketch, threshold int64, errorType ErrorType) ([]*Row, e return nil, err } if lb >= threshold { - row := NewRow(iter.getKey(), est, ub, lb) + row := newRow(iter.getKey(), est, ub, lb) rowList = append(rowList, row) } } diff --git a/frequencies/utils.go b/frequencies/utils.go index 2778032..5386317 100644 --- a/frequencies/utils.go +++ b/frequencies/utils.go @@ -36,12 +36,12 @@ type ErrorType struct { Name string } -type ErrorTypes struct { +type errorTypes struct { NO_FALSE_POSITIVES ErrorType NO_FALSE_NEGATIVES ErrorType } -var ErrorTypeEnum = &ErrorTypes{ +var ErrorTypeEnum = &errorTypes{ NO_FALSE_POSITIVES: ErrorType{ id: 1, Name: "NO_FALSE_POSITIVES", --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
