File Coverage

blib/lib/Lingua/YaTeA/TestifiedTermMark.pm
Criterion Covered Total %
statement 42 44 95.4
branch 6 8 75.0
condition n/a
subroutine 10 10 100.0
pod 7 7 100.0
total 65 69 94.2


line stmt bran cond sub pod time code
1             package Lingua::YaTeA::TestifiedTermMark;
2 3     3   17 use strict;
  3         6  
  3         69  
3 3     3   14 use warnings;
  3         4  
  3         58  
4 3     3   12 use Lingua::YaTeA::AnnotationMark;
  3         4  
  3         13  
5              
6              
7             our @ISA = qw(Lingua::YaTeA::AnnotationMark);
8             our $VERSION=$Lingua::YaTeA::VERSION;
9              
10             sub new
11             {
12 6     6 1 12 my ($class,$form) = @_;
13 6         13 my ($frontier_id,$testified_id,$type) = $class->parse($form);
14 6         33 my $this = $class->SUPER::new($form,$frontier_id,$type);
15 6         8 bless ($this,$class);
16 6         11 $this->{TESTIFIED_ID} = $testified_id;
17 6         10 $this->{START} = (); # should be 0
18 6         9 $this->{END} = (); # should be 0
19 6         12 return $this;
20             }
21              
22              
23             sub getTestifiedID
24             {
25 3     3 1 8 my ($this) = @_;
26 3         10 return $this->{TESTIFIED_ID};
27             }
28              
29             sub isOpener
30             {
31 12     12 1 15 my ($this) = @_;
32 12 100       28 if ($this->getType eq "opener")
33             {
34 6         18 return 1;
35             }
36 6         15 return 0;
37             }
38              
39             sub isCloser
40             {
41 6     6 1 11 my ($this) = @_;
42 6 50       11 if ($this->getType eq "closer")
43             {
44 6         18 return 1;
45             }
46 0         0 return 0;
47             }
48              
49             sub parse
50             {
51 6     6 1 11 my ($class,$form) = @_;
52 6         11 my $frontier_id;
53             my $testified_id;
54 6         0 my $type;
55              
56             # opening testified term frontier
57 6 100       16 if ($form =~ /^\
58             {
59 3         16 $frontier_id = $1;
60 3         6 $testified_id = $2;
61 3         6 $type = "opener";
62             }
63             # closing testified term frontier
64             else
65             {
66 3 50       20 if ($form =~ /^\<\/FRONTIER ID=([0-9]+) TT=([0-9]+)/)
67             {
68 3         8 $frontier_id = $1;
69 3         5 $testified_id = $2;
70 3         5 $type = "closer";
71             }
72             else
73             {
74 0         0 die "balise invalide :" . $form;
75             }
76             }
77 6         18 return ($frontier_id,$testified_id,$type);
78             }
79              
80             sub getStart
81             {
82 3     3 1 7 my ($this) = @_;
83 3         6 return $this->{START};
84             }
85              
86             sub getEnd
87             {
88 9     9 1 13 my ($this) = @_;
89 9         31 return $this->{END};
90             }
91              
92             1;
93              
94             __END__