NAME

Graph::PetriNet::PlaceAble - Trait for Petri net data nodes

SYNOPSIS

  # create your own data nodes with this trait
  {
    package My::Place::TimeDepend;
    use Class::Trait qw(Graph::PetriNet::PlaceAble);

    sub new {
	my $class = shift;
	return bless { ..., ... }, $class;
    }
    sub .... {
        ...
    }
  }

DESCRIPTION

Petri net data nodes are supposed to carry the information within the Petri net. What information this is, the Petri net does not care.

The default behavior implemented here is the classical interpretation of every node having tokens. Accordingly there is a method to set/read the number of tokens and one method to increment/decrement that.

If your transitions do something completely different, then you will implement your own data nodes without importing any of the functionality here.

TRAIT

Methods

tokens

Getter/setter method for the number of tokens in this node.

incr_tokens

This method expects one integer parameter (positive or negative). Its value is added to the number of tokens. The result will be corrected to zero.

SEE ALSO

Graph::PetriNet

AUTHOR

Robert Barta, <drrho@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2009 by Robert Barta

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.