petrinet

package
v0.0.0-...-f5b08e1 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InputArc

type InputArc struct {
	FromPlaceID    PlaceID      `json:"from_id"`
	ToTransitionID TransitionID `json:"to_id"`
	Expr           string       `json:"expr"`
}

func (*InputArc) String

func (ia *InputArc) String() string

type Net

type Net struct {
	Places      []Place      `json:"places"`
	Transitions []Transition `json:"transitions"`
	InputArcs   []InputArc   `json:"input_arcs"`
	OutputArcs  []OutputArc  `json:"output_arcs"`
	Tokens      []Token      `json:"tokens"`
}

type OutputArc

type OutputArc struct {
	FromTransitionID TransitionID `json:"from_id"`
	ToPlaceID        PlaceID      `json:"to_id"`
	Expr             string       `json:"expr"`
}

func (*OutputArc) String

func (oa *OutputArc) String() string

type Place

type Place struct {
	ID PlaceID `json:"id"`
}

type PlaceID

type PlaceID string

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

func NewRunner

func NewRunner(n *Net) (*Runner, error)

func (*Runner) Enabled

func (r *Runner) Enabled() []*Transition

func (*Runner) Fire

func (r *Runner) Fire(id TransitionID) error

func (*Runner) FireAny

func (r *Runner) FireAny() error

func (*Runner) InputArcs

func (r *Runner) InputArcs() []InputArc

func (*Runner) Net

func (r *Runner) Net() Net

func (*Runner) OutputArcs

func (r *Runner) OutputArcs() []OutputArc

func (*Runner) Places

func (r *Runner) Places() []Place

func (*Runner) Tokens

func (r *Runner) Tokens() []Token

func (*Runner) Transitions

func (r *Runner) Transitions() []Transition

type Token

type Token struct {
	ID        TokenID `json:"id"`
	OnPlaceID PlaceID `json:"place_id"`
	Color     any     `json:"color"`
}

type TokenID

type TokenID string

type Transition

type Transition struct {
	ID TransitionID `json:"id"`
}

type TransitionID

type TransitionID string

Jump to

Keyboard shortcuts

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