Documentation ¶
Index ¶
- Constants
- func VectorToBytes(v Vector) []byte
- type Arc
- type ArcDefinition
- type ArcListDefinition
- type Declaration
- type DeclarationObject
- type Editor
- type Event
- type Guard
- type GuardMap
- type Label
- type MetaModel
- type Model
- func (m *Model) Arc(source Node, target Node, weight int64)
- func (m *Model) Cell(def ...func(p *Place)) Node
- func (m *Model) Define(def ...func(declaration Declaration)) MetaModel
- func (m *Model) Edit() Editor
- func (m *Model) Fn(def ...func(t *Transition)) Node
- func (m *Model) GetViewPort() (x1 int, y1 int, width int, height int)
- func (m *Model) Graph() Editor
- func (m *Model) Guard(source Node, target Node, weight int64)
- func (m *Model) Index() Editor
- func (m *Model) Net() *PetriNet
- func (m *Model) Node(oid string) Node
- func (m *Model) PlaceSeq() Label
- func (m *Model) ToDeclaration() ([]byte, bool)
- func (m *Model) ToDeclarationObject() DeclarationObject
- func (m *Model) TransitionSeq() Label
- func (m *Model) UnpackFromUrl(url string) (sourceJson string, ok bool)
- func (m *Model) ZipUrl(path ...string) (urlString string, ok bool)
- type Node
- type Op
- type PetriNet
- type Place
- type PlaceDefinition
- type PlaceMap
- type PlaceMapDefinition
- type Position
- type Process
- type Role
- type RoleMap
- type SubnetNode
- type Transition
- type TransitionDefinition
- type TransitionMap
- type TransitionMapDefinition
- type Vector
Constants ¶
View Source
const ( BadInhibitorSource = "inhibitor source must be a place" BadInhibitorTarget = "inhibitor target must be a transition" BadWeight = "arc weight must be positive integer" BadMultiple = "multiple must be positive integer" BadArcTransition = "source and target are both transitions" BadArcPlace = "source and target are both places" UnknownAction = "unknown action" Underflow = "output cannot be negative" Overflow = "output exceeds capacity" FailedRoleAssertion = "role assertion failed" ExpectedTransition = "element was expected to be a transition" ExpectedPlace = "element was expected to be a place" InhibitedTransition = "transition is inhibited by place %s" UnexpectedArguments = "expected %v arguments got %v" OK = "OK" )
Variables ¶
This section is empty.
Functions ¶
func VectorToBytes ¶
Types ¶
type ArcDefinition ¶
type ArcListDefinition ¶
type ArcListDefinition []ArcDefinition
type Declaration ¶
type Declaration interface { Cell(...func(p *Place)) Node Fn(...func(t *Transition)) Node }
type DeclarationObject ¶
type DeclarationObject struct { ModelType string `json:"modelType"` Version string `json:"version"` Places PlaceMapDefinition `json:"places"` Transitions TransitionMapDefinition `json:"transitions"` Arcs ArcListDefinition `json:"arcs"` }
type Guard ¶
type Guard struct { Label string `json:"label"` Delta Vector `json:"delta"` Inverted bool `json:"inverted"` }
Guard attributes inhibit a transition
type MetaModel ¶
type MetaModel interface { Net() *PetriNet Define(...func(Declaration)) MetaModel Edit() Editor Node(oid string) Node UnpackFromUrl(url string) (obj string, ok bool) ZipUrl(...string) (url string, ok bool) GetViewPort() (int, int, int, int) ToDeclaration() (obj []byte, ok bool) ToDeclarationObject() DeclarationObject }
type Model ¶
type Model struct {
*PetriNet
}
func (*Model) Arc ¶
Arc connects places and transitions at runtime Arcs are indexed as adjacency matrix by converting Arcs to vectors
func (*Model) Define ¶
func (m *Model) Define(def ...func(declaration Declaration)) MetaModel
func (*Model) Fn ¶
func (m *Model) Fn(def ...func(t *Transition)) Node
Fn declares a new transition element
func (*Model) ToDeclaration ¶
func (*Model) ToDeclarationObject ¶
func (m *Model) ToDeclarationObject() DeclarationObject
func (*Model) TransitionSeq ¶
TransitionSeq generate unique labels for transitions
func (*Model) UnpackFromUrl ¶
type Node ¶
type Node interface { Tx(weight int64, target Node) Node Guard(weight int64, target Node) Node IsPlace() bool IsTransition() bool GetPlace() *Place GetTransition() *Transition Label(string) Node Position(x int64, y int64, z ...int64) Node Initial(int64) Node Capacity(int64) Node Role(string) Node }
Node is an interstitial interface used when composing model elements
type PetriNet ¶
type PetriNet struct { ModelType string `json:"modelType"` Places PlaceMap `json:"places"` Transitions TransitionMap `json:"transitions"` Arcs []Arc `json:"-"` Roles RoleMap `json:"-"` Path string `json:"path"` Cid string `json:"cid"` }
func (*PetriNet) CapacityVector ¶
func (*PetriNet) EmptyVector ¶
func (*PetriNet) InitialVector ¶
type Place ¶
type Place struct { Label string `json:"label"` Offset int64 `json:"offset"` Position `json:"position"` Initial int64 `json:"initial"` Capacity int64 `json:"capacity"` }
Place elements contain tokens
type PlaceDefinition ¶
type PlaceMapDefinition ¶
type PlaceMapDefinition map[string]PlaceDefinition
type SubnetNode ¶
type Transition ¶
type Transition struct { Label string `json:"label"` Position `json:"position"` Role Role `json:"role"` Delta Vector `json:"delta"` Guards GuardMap `json:"guards"` AllowReentry bool `json:"allowReentry"` *SubnetNode `json:"subNet"` }
Transition defines a token transfer action
type TransitionDefinition ¶
type TransitionMap ¶
type TransitionMap = map[string]*Transition
type TransitionMapDefinition ¶
type TransitionMapDefinition map[string]TransitionDefinition
Click to show internal directories.
Click to hide internal directories.