| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Lingua::YaTeA::InternalNode; | 
| 2 | 5 |  |  | 5 |  | 44 | use strict; | 
|  | 5 |  |  |  |  | 7 |  | 
|  | 5 |  |  |  |  | 122 |  | 
| 3 | 5 |  |  | 5 |  | 21 | use warnings; | 
|  | 5 |  |  |  |  | 7 |  | 
|  | 5 |  |  |  |  | 102 |  | 
| 4 | 5 |  |  | 5 |  | 2524 | use Lingua::YaTeA::Node; | 
|  | 5 |  |  |  |  | 12 |  | 
|  | 5 |  |  |  |  | 56 |  | 
| 5 | 5 |  |  | 5 |  | 155 | use Lingua::YaTeA::Edge; | 
|  | 5 |  |  |  |  | 10 |  | 
|  | 5 |  |  |  |  | 24 |  | 
| 6 | 5 |  |  | 5 |  | 88 | use UNIVERSAL; | 
|  | 5 |  |  |  |  | 11 |  | 
|  | 5 |  |  |  |  | 13 |  | 
| 7 | 5 |  |  | 5 |  | 105 | use Scalar::Util qw(blessed); | 
|  | 5 |  |  |  |  | 8 |  | 
|  | 5 |  |  |  |  | 1729 |  | 
| 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 | 163 | my ($class,$level) = @_; | 
| 16 | 83 |  |  |  |  | 211 | my $this = $class->SUPER::new($level); | 
| 17 | 83 |  |  |  |  | 153 | $this->{FATHER} = (); | 
| 18 | 83 |  |  |  |  | 118 | bless ($this,$class); | 
| 19 | 83 |  |  |  |  | 159 | return $this; | 
| 20 |  |  |  |  |  |  | } | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | sub setFather | 
| 23 |  |  |  |  |  |  | { | 
| 24 | 64 |  |  | 64 | 1 | 135 | my ($this,$father) = @_; | 
| 25 | 64 |  |  |  |  | 141 | $this->{FATHER} = $father; | 
| 26 |  |  |  |  |  |  | } | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | sub getFather | 
| 29 |  |  |  |  |  |  | { | 
| 30 | 42 |  |  | 42 | 1 | 55 | my ($this) = @_; | 
| 31 | 42 |  |  |  |  | 134 | return $this->{FATHER}; | 
| 32 |  |  |  |  |  |  | } | 
| 33 |  |  |  |  |  |  |  | 
| 34 |  |  |  |  |  |  | sub updateLevel | 
| 35 |  |  |  |  |  |  | { | 
| 36 | 111 |  |  | 111 | 1 | 170 | my ($this,$new_level) = @_; | 
| 37 | 111 |  |  |  |  | 157 | $this->{LEVEL} = $new_level++; | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | #     warn "Debug: Level in updateLevel: $new_level \n"; | 
| 40 |  |  |  |  |  |  |  | 
| 41 | 111 | 50 |  |  |  | 168 | if ($new_level < 50) { # Temporary added by Thierry Hamon 02/02/2007 | 
| 42 | 111 | 100 | 66 |  |  | 203 | if ((blessed($this->getLeftEdge)) && ($this->getLeftEdge->isa('Lingua::YaTeA::InternalNode'))) | 
| 43 |  |  |  |  |  |  | { | 
| 44 | 10 |  |  |  |  | 23 | $this->getLeftEdge->updateLevel($new_level); | 
| 45 |  |  |  |  |  |  | } | 
| 46 | 111 | 100 | 66 |  |  | 245 | if ((blessed($this->getRightEdge)) && ($this->getRightEdge->isa('Lingua::YaTeA::InternalNode'))) | 
| 47 |  |  |  |  |  |  | { | 
| 48 | 37 |  |  |  |  | 68 | $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 | 24 | my ($this) = @_; | 
| 58 | 14 | 100 | 66 |  |  | 32 | if ((blessed($this->getFather)) && ($this->getFather->isa('Lingua::YaTeA::RootNode'))) | 
| 59 |  |  |  |  |  |  | { | 
| 60 | 10 |  |  |  |  | 21 | return $this->getFather; | 
| 61 |  |  |  |  |  |  | } | 
| 62 |  |  |  |  |  |  |  | 
| 63 | 4 |  |  |  |  | 10 | 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__ |