model

package
v0.0.0-...-c2eefbb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActorType

type ActorType byte

ActorType kind

const (
	Warehouses ActorType = iota
	CargoUnits
)

type Coordinate

type Coordinate struct {
	// X, Y axis
	X, Y int
}

Coordinate where something is possessed

type Graph

type Graph struct {
	Nodes []GraphNode
	Edges []GraphEdge
	sync.Mutex
}

Graph model

func NewGraph

func NewGraph() *Graph

NewGraph instance

func (*Graph) AddEdge

func (g *Graph) AddEdge(edge GraphEdge)

AddEdge to the graph

func (*Graph) AddNode

func (g *Graph) AddNode(node GraphNode)

AddNode to the graph

func (*Graph) FindNodesByLocation

func (g *Graph) FindNodesByLocation(coordinate Coordinate, nodeType any) *GraphNode

FindNodesByLocation node in given coordinate

func (*Graph) GetConnectedNodes

func (g *Graph) GetConnectedNodes(nodeID uint, nodeType any) []*GraphNode

GetConnectedNodes returns a slice of connected nodes of the given type to the node with the specified ID

func (*Graph) GetNodeByID

func (g *Graph) GetNodeByID(nodeID uint) *GraphNode

GetNodeByID returns the node with the specified ID, or nil if it is not found

func (*Graph) GetNodesByType

func (g *Graph) GetNodesByType(nodeType any) []*GraphNode

GetNodesByType returns a slice of nodes with the specified type

type GraphEdge

type GraphEdge struct {
	Source uint
	Target uint
}

GraphEdge ...

type GraphNode

type GraphNode struct {
	ID        uint
	Name      string
	Connected bool
	Type      any
	Metadata  any
	*Coordinate
}

GraphNode ...

type Operation

type Operation struct {
	Name string
	A    uint64
	B    uint64

	sync.Mutex
}

Operation kind

func (*Operation) AddA

func (o *Operation) AddA()

AddA safe incrementation

func (*Operation) AddB

func (o *Operation) AddB()

AddB safe incrementation

type Statistics

type Statistics struct {
	Operation []*Operation
	ExecTime  time.Time
}

Statistics about world operations

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL