| 1 | ## -*- Mode: CPerl -*- | ||
| 2 | ## | ||
| 3 | ## File: DTA::CAB::Analyzer::Automaton::Gfsm.pm | ||
| 4 | ## Author: Bryan Jurish <moocow@cpan.org> | ||
| 5 | ## Description: generic analysis automaton API: Gfsm automata | ||
| 6 | |||
| 7 | package DTA::CAB::Analyzer::Automaton::Gfsm; | ||
| 8 | use DTA::CAB::Analyzer::Automaton; | ||
| 9 | use Gfsm; | ||
| 10 | use Encode qw(encode decode); | ||
| 11 | use IO::File; | ||
| 12 | use Carp; | ||
| 13 | |||
| 14 | use strict; | ||
| 15 | |||
| 16 | ##============================================================================== | ||
| 17 | ## Globals | ||
| 18 | ##============================================================================== | ||
| 19 | |||
| 20 | our @ISA = qw(DTA::CAB::Analyzer::Automaton); | ||
| 21 | |||
| 22 | ##============================================================================== | ||
| 23 | ## Constructors etc. | ||
| 24 | ##============================================================================== | ||
| 25 | |||
| 26 | ## $obj = CLASS_OR_OBJ->new(%args) | ||
| 27 | ## + object structure: see DTA::CAB::Analyzer::Automaton | ||
| 28 | sub new { | ||
| 29 | my $that = shift; | ||
| 30 | my $aut = $that->SUPER::new( | ||
| 31 | ##-- analysis objects | ||
| 32 | fst=>undef, #Gfsm::Automaton->new, | ||
| 33 | lab=>undef, #Gfsm::Alphabet->new, | ||
| 34 | #result=>undef, #Gfsm::Automaton->new, | ||
| 35 | |||
| 36 | ##-- user args | ||
| 37 | @_ | ||
| 38 | ); | ||
| 39 | return $aut; | ||
| 40 | } | ||
| 41 | |||
| 42 | ##============================================================================== | ||
| 43 | ## Methods: Generic | ||
| 44 | ##============================================================================== | ||
| 45 | |||
| 46 | ## $class = $aut->fstClass() | ||
| 47 | ## + default FST class for loadFst() method | ||
| 48 | sub fstClass { return 'Gfsm::Automaton'; } | ||
| 49 | |||
| 50 | ## $class = $aut->labClass() | ||
| 51 | ## + default labels class for loadLabels() method | ||
| 52 | sub labClass { return 'Gfsm::Alphabet'; } | ||
| 53 | |||
| 54 | ## $bool = $aut->fstOk() | ||
| 55 | ## + should return false iff fst is undefined or "empty" | ||
| 56 | sub fstOk { return defined($_[0]{fst}) && $_[0]{fst}->n_states>0; } | ||
| 57 | |||
| 58 | ## $bool = $aut->labOk() | ||
| 59 | ## + should return false iff label-set is undefined or "empty" | ||
| 60 | sub labOk { return defined($_[0]{lab}) && $_[0]{lab}->size>0; } | ||
| 61 | |||
| 62 | ## $bool = $aut->dictOk() | ||
| 63 | ## + should return false iff dict is undefined or "empty" | ||
| 64 | ##(inherited) | ||
| 65 | |||
| 66 | ##============================================================================== | ||
| 67 | ## Methods: other | ||
| 68 | ## + inherited from DTA::CAB::Analyzer::Automaton | ||
| 69 | ##============================================================================== | ||
| 70 | |||
| 71 | |||
| 72 | |||
| 73 | 1; ##-- be happy | ||
| 74 | |||
| 75 | __END__ |