aboutsummaryrefslogtreecommitdiff
path: root/page.go
blob: 93aecabfc4c2084e5f33324e8d00abb0d22bce71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package sws

import (
	"fmt"
	"sort"
	"time"
)

type Page struct {
	SiteID        int       `json:"site_id"`
	Path          string    `json:"path"`
	Title         *string   `json:"title,omitempty"`
	LastVisitedAt time.Time `json:"last_visited_at"`
	hitSet        *HitSet
	// TODO
	Site *Site `json:"-"`
}

func (p Page) YMax() int {
	return p.hitSet.YMax()
}
func (p Page) XSeries() []*bucket {
	p.hitSet.Fill(nil, nil)
	sort.Sort(p.hitSet)
	fmt.Printf("page begin: %s end: %s\n", p.hitSet.Begin(), p.hitSet.End())
	return p.hitSet.XSeries()
}

func (p Page) Count() int {
	return p.hitSet.Count()
}

func (p Page) Label() string {
	return p.Path
}

func (p Page) YValue() int {
	return p.hitSet.Count()
}