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   17 use strict;
  3         4  
  3         70  
3 3     3   11 use warnings;
  3         6  
  3         58  
4 3     3   978 use Lingua::YaTeA::Document;
  3         7  
  3         28  
5 3     3   1066 use Lingua::YaTeA::WordFromCorpus;
  3         4  
  3         25  
6              
7             our $VERSION=$Lingua::YaTeA::VERSION;
8              
9             sub new
10             {
11 3     3 1 8 my ($class) = @_;
12 3         6 my $this = {};
13 3         7 bless ($this,$class);
14 3         11 $this->{DOCUMENTS} = [];
15 3         12 $this->addDefaultDocument;
16 3         7 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 6 my ($this,$word) = @_;
29 3         6 push @{$this->{DOCUMENTS}}, Lingua::YaTeA::Document->newDefault;
  3         20  
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 27 my ($this)= @_;
50 20         44 return $this->{DOCUMENTS}[-1];
51             }
52              
53             sub getDocumentNumber
54             {
55 2     2 1 5 my ($this) = @_;
56 2         5 return scalar @{$this->{DOCUMENTS}};
  2         5  
57             }
58              
59             1;
60              
61             __END__