-
Notifications
You must be signed in to change notification settings - Fork 1
/
model_statistics.go
63 lines (51 loc) · 1.85 KB
/
model_statistics.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package nextroute
import (
"github.com/nextmv-io/sdk/connect"
"github.com/nextmv-io/sdk/nextroute/common"
)
// NewModelStatistics creates a new ModelStatistics instance.
func NewModelStatistics(model Model) ModelStatistics {
connect.Connect(con, &newModelStatistics)
return newModelStatistics(model)
}
// NewVehicleStatistics creates a new VehicleStatistics instance.
func NewVehicleStatistics(vehicle ModelVehicle) VehicleStatistics {
connect.Connect(con, &newVehicleStatistics)
return newVehicleStatistics(vehicle)
}
// ModelStatistics provides statistics for a model.
type ModelStatistics interface {
// FirstLocations returns the number of unique locations that are first
// locations of a vehicle.
FirstLocations() int
// LastLocations returns the number of unique locations that are last
// locations of a vehicle.
LastLocations() int
// Locations returns the number of unique locations excluding first and last
// locations of a vehicle.
Locations() int
// PlanUnits returns the number of plan units.
PlanUnits() int
// Report returns a report of the statistics.
Report() string
// Stops returns the number of stops.
Stops() int
// VehicleTypes returns the number of vehicle types.
VehicleTypes() int
// Vehicles returns the number of vehicles.
Vehicles() int
}
// VehicleStatistics provides statistics for a vehicle.
type VehicleStatistics interface {
// FirstToLastSeconds returns the travel time from the first location to the
// last location of a vehicle.
FirstToLastSeconds() float64
// FromFirstSeconds returns the travel time in seconds from the first
// location to all stops as statistics.
FromFirstSeconds() common.Statistics
// Report returns a report of the statistics.
Report() string
// ToLastSeconds returns the travel time in seconds from all stops to the
// last location as statistics.
ToLastSeconds() common.Statistics
}