| 1 | package StateML::State ; | ||||||||||
| 2 | |||||||||||
| 3 | 3 | ▶ | use strict ; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 3 | ▶ | use Carp ; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 3 | ▶ | use base qw(StateML::Object ) ; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | =head1 DESCRIPTION | ||||||||||
| 8 | |||||||||||
| 9 | =head1 METHODS | ||||||||||
| 10 | |||||||||||
| 11 | TODO: Complete the docs. | ||||||||||
| 12 | |||||||||||
| 13 | See L<StateML::Object|StateML::Object> for methods available to all objects. | ||||||||||
| 14 | |||||||||||
| 15 | =over | ||||||||||
| 16 | |||||||||||
| 17 | =cut | ||||||||||
| 18 | |||||||||||
| 19 | 5 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 20 | 5 | return shift()->SUPER::new( | |||||||||
| 21 | ENTRY_HANDLERS => [], | ||||||||||
| 22 | EXIT_HANDLERS => [], | ||||||||||
| 23 | @_ | ||||||||||
| 24 | ) ; | ||||||||||
| 25 | } | ||||||||||
| 26 | |||||||||||
| 27 | |||||||||||
| 28 | 0 | ▶ | sub handlers { | ||||||||
|
Subroutine
handlers: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 29 | 0 | my $self = shift ; | |||||||||
| 30 | 0 | ▶ | $self->{API} = shift if @_ ; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | 0 | return $self->{API} ; | |||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | |||||||||||
| 35 | 0 | ▶ | sub number { | ||||||||
|
Subroutine
number: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 36 | 0 | my $self = shift ; | |||||||||
| 37 | 0 | ▶ | confess "Cannot set a state's number." if @_ ; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 38 | 0 | return $self->{ORDER} ; | |||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | |||||||||||
| 42 | 0 | ▶ | sub description { | ||||||||
|
Subroutine
description: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 43 | 0 | my $self = shift ; | |||||||||
| 44 | 0 | ▶ | $self->{DESCRIPTION} = shift if @_ ; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 45 | 0 | return $self->{DESCRIPTION}; | |||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | |||||||||||
| 49 | 0 | ▶ | sub entry_handlers { | ||||||||
|
Subroutine
entry_handlers: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 50 | 0 | my $self = shift ; | |||||||||
| 51 | 0 | my $all = $self->machine->state_by_id( "#ALL" ) ; | |||||||||
| 52 | 0 | ▶ | return @{$self->{ENTRY_HANDLERS}}, $all ? @{$all->{ENTRY_HANDLERS}} : () ; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 53 | } | ||||||||||
| 54 | |||||||||||
| 55 | |||||||||||
| 56 | 0 | ▶ | sub exit_handlers { | ||||||||
|
Subroutine
exit_handlers: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 57 | 0 | my $self = shift ; | |||||||||
| 58 | 0 | my $all = $self->machine->state_by_id( "#ALL" ) ; | |||||||||
| 59 | 0 | ▶ | return $all ? @{$all->{EXIT_HANDLERS}} : (), @{$self->{EXIT_HANDLERS}} ; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 60 | } | ||||||||||
| 61 | |||||||||||
| 62 | |||||||||||
| 63 | 3 | ▶ | sub _set_number { | ||||||||
|
Subroutine
_set_number: called CC=1 SCAR=0.0
| |||||||||||
| 64 | 3 | my $self = shift ; | |||||||||
| 65 | 3 | $self->{ORDER} = shift ; | |||||||||
| 66 | 3 | return ; | |||||||||
| 67 | } | ||||||||||
| 68 | |||||||||||
| 69 | =item arcs_from | ||||||||||
| 70 | |||||||||||
| 71 | Returns a list of arcs out of this state. | ||||||||||
| 72 | |||||||||||
| 73 | This is a convenience method for template generation. | ||||||||||
| 74 | |||||||||||
| 75 | =cut | ||||||||||
| 76 | |||||||||||
| 77 | 1 | ▶ | sub arcs_from { | ||||||||
|
Subroutine
arcs_from: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 78 | 1 | my $self = shift; | |||||||||
| 79 | 1 | my $id = $self->id; | |||||||||
| 80 | 1 | grep $_->from eq $id, $self->machine->arcs; | |||||||||
| 81 | } | ||||||||||
| 82 | |||||||||||
| 83 | =item arcs_to | ||||||||||
| 84 | |||||||||||
| 85 | Returns a list of arcs into this state. | ||||||||||
| 86 | |||||||||||
| 87 | This is a convenience method for template generation. | ||||||||||
| 88 | |||||||||||
| 89 | =cut | ||||||||||
| 90 | |||||||||||
| 91 | 1 | ▶ | sub arcs_to { | ||||||||
|
Subroutine
arcs_to: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 92 | 1 | my $self = shift; | |||||||||
| 93 | 1 | my $id = $self->id; | |||||||||
| 94 | 1 | grep $_->to eq $id, $self->machine->arcs; | |||||||||
| 95 | } | ||||||||||
| 96 | |||||||||||
| 97 | =back | ||||||||||
| 98 | |||||||||||
| 99 | =head1 LIMITATIONS | ||||||||||
| 100 | |||||||||||
| 101 | =head1 COPYRIGHT | ||||||||||
| 102 | |||||||||||
| 103 | Copyright 2003, R. Barrie Slaymaker, Jr., All Rights Reserved | ||||||||||
| 104 | |||||||||||
| 105 | =head1 LICENSE | ||||||||||
| 106 | |||||||||||
| 107 | You may use this module under the terms of the BSD, Artistic, or GPL licenses, | ||||||||||
| 108 | any version. | ||||||||||
| 109 | |||||||||||
| 110 | =head1 AUTHOR | ||||||||||
| 111 | |||||||||||
| 112 | Barrie Slaymaker <barries@slaysys.com> | ||||||||||
| 113 | |||||||||||
| 114 | =cut | ||||||||||
| 115 | |||||||||||
| 116 | 3 | 1 ; | |||||||||