-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinterface.go
47 lines (41 loc) · 1.31 KB
/
interface.go
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
40
41
42
43
44
45
46
47
package measure
// ByIndex estimates the cost of going from one index to another.
type ByIndex interface {
// Cost estimates the cost of going from one index to another.
Cost(from, to int) float64
}
// DependentByIndex estimates the cost of going from one index to another
// taking a point in time into account.
type DependentByIndex interface {
TimeDependent() bool
Cost(
from,
to int,
data *VehicleData,
) float64
}
// ByPoint estimates the cost of going from one point to another.
type ByPoint interface {
// Cost estimates the cost of going from one point to another.
Cost(from, to Point) float64
}
// Triangular indicates that the triangle inequality holds for every
// measure that implements it.
type Triangular interface {
Triangular() bool
}
// IsTriangular returns true if the triangle inequality holds for the provided
// measure.
func IsTriangular(m any) bool {
if t, ok := m.(Triangular); ok {
return t.Triangular()
}
return false
}
// Times holds the estimated time of arrival (ETA), estimated time of when
// service starts (ETS) and estimated time of departure (ETD).
type Times struct {
EstimatedArrival []int `json:"estimated_arrival,omitempty"`
EstimatedServiceStart []int `json:"estimated_service_start,omitempty"`
EstimatedDeparture []int `json:"estimated_departure,omitempty"`
}