Documentation ¶
Index ¶
- type Edge
- type Map
- func (m *Map) CellAdjacency(id uint64) []uint64
- func (m *Map) CellGet(id uint64) *Vertex
- func (m *Map) CellHas(id uint64) bool
- func (m *Map) Load(in io.Reader) error
- func (m *Map) LoadJSON(in string) error
- func (m *Map) PathNextStep(src, dst uint64) (uint64, error)
- func (m *Map) RoadHas(src, dst uint64) bool
- type SetOfEdges
- func (s *SetOfEdges) Add(a *Edge)
- func (s SetOfEdges) Check() error
- func (s SetOfEdges) CheckThenFail()
- func (s SetOfEdges) First(at uint64) int
- func (s SetOfEdges) Get(f0 uint64, f1 uint64) *Edge
- func (s SetOfEdges) Has(f0 uint64, f1 uint64) bool
- func (s SetOfEdges) Len() int
- func (s SetOfEdges) Less(i, j int) bool
- func (s *SetOfEdges) Remove(a *Edge)
- func (s *SetOfEdges) RemovePK(f0 uint64, f1 uint64)
- func (s SetOfEdges) Slice(m0 uint64, m1 uint64, max uint32) []*Edge
- func (s SetOfEdges) Swap(i, j int)
- type SetOfMaps
- func (s *SetOfMaps) Add(a *Map)
- func (s SetOfMaps) Check() error
- func (s SetOfMaps) CheckThenFail()
- func (s SetOfMaps) Get(id string) *Map
- func (s SetOfMaps) Has(id string) bool
- func (s SetOfMaps) Len() int
- func (s SetOfMaps) Less(i, j int) bool
- func (s *SetOfMaps) Remove(a *Map)
- func (s *SetOfMaps) RemovePK(pk string)
- func (s SetOfMaps) Slice(marker string, max uint32) []*Map
- func (s SetOfMaps) Swap(i, j int)
- type SetOfVertices
- func (s *SetOfVertices) Add(a *Vertex)
- func (s SetOfVertices) Check() error
- func (s SetOfVertices) CheckThenFail()
- func (s SetOfVertices) Get(id uint64) *Vertex
- func (s SetOfVertices) Has(id uint64) bool
- func (s SetOfVertices) Len() int
- func (s SetOfVertices) Less(i, j int) bool
- func (s *SetOfVertices) Remove(a *Vertex)
- func (s *SetOfVertices) RemovePK(pk uint64)
- func (s SetOfVertices) Slice(marker uint64, max uint32) []*Vertex
- func (s SetOfVertices) Swap(i, j int)
- type Vertex
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Edge ¶
type Edge struct { // Unique identifier of the source Cell S uint64 `json:"src"` // Unique identifier of the destination Cell D uint64 `json:"dst"` }
Edge is ... an edge of the transportation directed graph
type Map ¶
type Map struct { // The unique name of the map ID string `json:"id"` Cells SetOfVertices `json:"sites"` Roads SetOfEdges `json:"roads"` // contains filtered or unexported fields }
Map is a directed graph destined to be used as a transport network, organised as an adjacency list.
func (*Map) CellAdjacency ¶
CellAdjacency returns the adjacency list of the cell with the given ID, in other words, an array of the ID of the target of the roads leaving the given cell.
func (*Map) Load ¶
Load consumes a mapclient.MapRaw from os.Stdin and populates the current Map accordingly.
func (*Map) PathNextStep ¶
PathNextStep computes the next step on the path from the source (given by src) to the destination (given by dst).
type SetOfEdges ¶
type SetOfEdges []*Edge
func (*SetOfEdges) Add ¶
func (s *SetOfEdges) Add(a *Edge)
func (SetOfEdges) Check ¶
func (s SetOfEdges) Check() error
func (SetOfEdges) CheckThenFail ¶
func (s SetOfEdges) CheckThenFail()
func (SetOfEdges) First ¶
func (s SetOfEdges) First(at uint64) int
func (SetOfEdges) Len ¶
func (s SetOfEdges) Len() int
func (SetOfEdges) Less ¶
func (s SetOfEdges) Less(i, j int) bool
func (*SetOfEdges) Remove ¶
func (s *SetOfEdges) Remove(a *Edge)
func (*SetOfEdges) RemovePK ¶
func (s *SetOfEdges) RemovePK(f0 uint64, f1 uint64)
func (SetOfEdges) Swap ¶
func (s SetOfEdges) Swap(i, j int)
type SetOfMaps ¶
type SetOfMaps []*Map
func (SetOfMaps) CheckThenFail ¶
func (s SetOfMaps) CheckThenFail()
type SetOfVertices ¶
type SetOfVertices []*Vertex
func (*SetOfVertices) Add ¶
func (s *SetOfVertices) Add(a *Vertex)
func (SetOfVertices) Check ¶
func (s SetOfVertices) Check() error
func (SetOfVertices) CheckThenFail ¶
func (s SetOfVertices) CheckThenFail()
func (SetOfVertices) Get ¶
func (s SetOfVertices) Get(id uint64) *Vertex
func (SetOfVertices) Has ¶
func (s SetOfVertices) Has(id uint64) bool
func (SetOfVertices) Len ¶
func (s SetOfVertices) Len() int
func (SetOfVertices) Less ¶
func (s SetOfVertices) Less(i, j int) bool
func (*SetOfVertices) Remove ¶
func (s *SetOfVertices) Remove(a *Vertex)
func (*SetOfVertices) RemovePK ¶
func (s *SetOfVertices) RemovePK(pk uint64)
func (SetOfVertices) Swap ¶
func (s SetOfVertices) Swap(i, j int)
type Vertex ¶
type Vertex struct { // The unique identifier of the current cell. ID uint64 `json:"id"` // Location of the Cell on the map. Used for rendering X uint64 `json:"x"` Y uint64 `json:"y"` // Should the current location carry a city when the region starts, // and if yes, what should be the name of that city. City string `json:"city,omitempty"` }
Vertex is a vertex in the transportation directed graph
Click to show internal directories.
Click to hide internal directories.