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) Execute(initialVec ...Vector) Process
- 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) TransitionSeq() Label
- func (m *Model) UnzipUrl(url string, filename string) (obj string, ok bool)
- func (m *Model) ZipUrl(path ...string) (url 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 StateMachine
- func (sm *StateMachine) Fire(op Op) (ok bool, msg string, out Vector)
- func (sm *StateMachine) GetState() Vector
- func (sm *StateMachine) Inhibited(op Op) (inhibited bool, msg string)
- func (sm *StateMachine) TestFire(op Op) (flag bool, msg string, out Vector)
- func (sm *StateMachine) TokenCount(label string) int64
- 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 ¶ added in v1.0.0
type ArcListDefinition ¶ added in v1.0.0
type ArcListDefinition []ArcDefinition
type Declaration ¶
type Declaration interface { Cell(...func(p *Place)) Node Fn(...func(t *Transition)) Node }
REVIEW: should we expose Role here also?
type DeclarationObject ¶ added in v1.0.0
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 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) GetViewPort ¶ added in v1.0.1
func (*Model) TransitionSeq ¶
TransitionSeq generate unique labels for transitions
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 m elements
type PetriNet ¶
type PetriNet struct { Schema string `json:"schema"` 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 ¶ added in v1.0.0
type PlaceMapDefinition ¶ added in v1.0.0
type PlaceMapDefinition map[string]PlaceDefinition
type StateMachine ¶
type StateMachine struct {
// contains filtered or unexported fields
}
func (*StateMachine) GetState ¶
func (sm *StateMachine) GetState() Vector
func (*StateMachine) Inhibited ¶
func (sm *StateMachine) Inhibited(op Op) (inhibited bool, msg string)
func (*StateMachine) TestFire ¶
func (sm *StateMachine) TestFire(op Op) (flag bool, msg string, out Vector)
func (*StateMachine) TokenCount ¶
func (sm *StateMachine) TokenCount(label string) int64
type SubnetNode ¶ added in v1.0.0
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 ¶ added in v1.0.0
type TransitionMap ¶
type TransitionMap = map[string]*Transition
type TransitionMapDefinition ¶ added in v1.0.0
type TransitionMapDefinition map[string]TransitionDefinition
Click to show internal directories.
Click to hide internal directories.