pnml

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2021 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DOCTYPE for the generated PNML file
	DOCTYPE = `<?xml version="1.0" encoding="UTF-8"?>` + "\n"
)

Variables

This section is empty.

Functions

func Write

func Write(w io.Writer, name string, pl []Place, tr []Trans) error

Write prints a P/T net in PNML format on an io.Writer

Types

type Arc

type Arc struct {
	Place *Place
	Mult  int
}

Arc is a pair of a place and a multiplicity. This is used to build arcs in the unfolding of a hlnet.

type Net

type Net struct {
	Thetype string `xml:"type,attr"`
	ID      string `xml:"id,attr"`
	NAME    string `xml:"name>text"`
	PAGE    Page   `xml:"page"`
}

Net is the type of PNML net, without graphical information, where all information is written in a single page.

type PT

type PT struct {
	XMLName xml.Name `xml:"http://www.pnml.org/version-2009/grammar/pnml pnml"`
	WNET    Net      `xml:"net"`
}

PT is the type of PNML for a P/T net without graphical information

type Page

type Page struct {
	ID     string  `xml:"id,attr"`
	PLACES []Place `xml:"place"`
	TRANS  []Trans `xml:"transition"`
}

Page is the unit for defining a P/T net inside a PNML file.

type Place

type Place struct {
	Name  string
	Label string
	Init  int
}

Place is the type used to marshal places.

func (Place) MarshalXML

func (v Place) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML encodes the receiver as zero or more XML elements. This makes Place a xml.Marshaller

type Trans

type Trans struct {
	Name    string
	Label   string
	In, Out []Arc
}

Trans is the type used to marshal transitions. We keep a pointer to the net so that we can find references to the arcs. We do not support inhibitor arcs.

func (Trans) MarshalXML

func (v Trans) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML encodes the receiver as zero or more XML elements. This makes Trans a xml.Marshaller

Jump to

Keyboard shortcuts

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