File Coverage

blib/lib/Lingua/YaTeA/InternalNode.pm
Criterion Covered Total %
statement 38 41 92.6
branch 7 8 87.5
condition 6 9 66.6
subroutine 11 12 91.6
pod 6 6 100.0
total 68 76 89.4


line stmt bran cond sub pod time code
1             package Lingua::YaTeA::InternalNode;
2 5     5   36 use strict;
  5         11  
  5         149  
3 5     5   28 use warnings;
  5         10  
  5         128  
4 5     5   3043 use Lingua::YaTeA::Node;
  5         20  
  5         81  
5 5     5   224 use Lingua::YaTeA::Edge;
  5         11  
  5         38  
6 5     5   111 use UNIVERSAL;
  5         10  
  5         22  
7 5     5   130 use Scalar::Util qw(blessed);
  5         12  
  5         2180  
8              
9             our @ISA = qw(Lingua::YaTeA::Node Lingua::YaTeA::Edge);
10              
11             our $VERSION=$Lingua::YaTeA::VERSION;
12              
13             sub new
14             {
15 83     83 1 243 my ($class,$level) = @_;
16 83         263 my $this = $class->SUPER::new($level);
17 83         221 $this->{FATHER} = ();
18 83         145 bless ($this,$class);
19 83         186 return $this;
20             }
21              
22             sub setFather
23             {
24 64     64 1 153 my ($this,$father) = @_;
25 64         215 $this->{FATHER} = $father;
26             }
27              
28             sub getFather
29             {
30 42     42 1 78 my ($this) = @_;
31 42         188 return $this->{FATHER};
32             }
33              
34             sub updateLevel
35             {
36 111     111 1 237 my ($this,$new_level) = @_;
37 111         224 $this->{LEVEL} = $new_level++;
38              
39             # warn "Debug: Level in updateLevel: $new_level \n";
40              
41 111 50       247 if ($new_level < 50) { # Temporary added by Thierry Hamon 02/02/2007
42 111 100 66     290 if ((blessed($this->getLeftEdge)) && ($this->getLeftEdge->isa('Lingua::YaTeA::InternalNode')))
43             {
44 10         58 $this->getLeftEdge->updateLevel($new_level);
45             }
46 111 100 66     343 if ((blessed($this->getRightEdge)) && ($this->getRightEdge->isa('Lingua::YaTeA::InternalNode')))
47             {
48 37         95 $this->getRightEdge->updateLevel($new_level);
49             }
50             } else {
51 0         0 warn "updateLevel: Going out a deep recursive method call (more than 50 calls)\n";
52             }
53             }
54              
55             sub searchRoot
56             {
57 14     14 1 39 my ($this) = @_;
58 14 100 66     56 if ((blessed($this->getFather)) && ($this->getFather->isa('Lingua::YaTeA::RootNode')))
59             {
60 10         26 return $this->getFather;
61             }
62            
63 4         17 return $this->getFather->searchRoot;
64             }
65              
66              
67              
68              
69             sub printFather
70             {
71 0     0 1   my ($this,$fh) = @_;
72 0           print $fh "\t\tfather: " . $this->getFather->getID . "\n";
73             }
74              
75             1;
76              
77             __END__