File Coverage

blib/lib/Lingua/YaTeA/DocumentSet.pm
Criterion Covered Total %
statement 26 34 76.4
branch 0 2 0.0
condition n/a
subroutine 8 10 80.0
pod 6 6 100.0
total 40 52 76.9


line stmt bran cond sub pod time code
1             package Lingua::YaTeA::DocumentSet;
2 3     3   20 use strict;
  3         7  
  3         85  
3 3     3   16 use warnings;
  3         7  
  3         73  
4 3     3   1218 use Lingua::YaTeA::Document;
  3         9  
  3         35  
5 3     3   1281 use Lingua::YaTeA::WordFromCorpus;
  3         9  
  3         31  
6              
7             our $VERSION=$Lingua::YaTeA::VERSION;
8              
9             sub new
10             {
11 3     3 1 10 my ($class) = @_;
12 3         8 my $this = {};
13 3         9 bless ($this,$class);
14 3         15 $this->{DOCUMENTS} = [];
15 3         16 $this->addDefaultDocument;
16 3         11 return $this;
17             }
18              
19              
20             sub getDocuments
21             {
22 0     0 1 0 my ($this) = @_;
23 0         0 return $this->{DOCUMENTS};
24             }
25              
26             sub addDefaultDocument
27             {
28 3     3 1 12 my ($this,$word) = @_;
29 3         7 push @{$this->{DOCUMENTS}}, Lingua::YaTeA::Document->newDefault;
  3         29  
30             }
31              
32             sub addDocument
33             {
34 0     0 1 0 my ($this,$word) = @_;
35 0 0       0 if($Lingua::YaTeA::WordFromCorpus::counter==1)
36             {
37 0         0 $this->getCurrent->update($word);
38             }
39             else{
40 0         0 $Lingua::YaTeA::Document::counter++;
41 0         0 push @{$this->{DOCUMENTS}}, Lingua::YaTeA::Document->new($word);
  0         0  
42             }
43              
44             }
45              
46              
47             sub getCurrent
48             {
49 20     20 1 40 my ($this)= @_;
50 20         68 return $this->{DOCUMENTS}[-1];
51             }
52              
53             sub getDocumentNumber
54             {
55 2     2 1 7 my ($this) = @_;
56 2         5 return scalar @{$this->{DOCUMENTS}};
  2         8  
57             }
58              
59             1;
60              
61             __END__