/usr/lib/perl5/ALTree/Nanova.pm is in altree 1.3.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | package ALTree::Nanova;
use strict;
BEGIN {
use Exporter ();
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
# set the version for version checking
#$VERSION = 1.00;
# if using RCS/CVS, this may be preferred
#$VERSION = do { my @r = (q$Revision: 153 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; # must be all one line, for MakeMaker
@ISA = qw(Exporter);
@EXPORT = qw(); #(&func1 &func2 &func4);
%EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
# your exported package globals go here,
# as well as any optionally exported functions
@EXPORT_OK = qw();
}
use vars @EXPORT_OK;
use ALTree::Utils qw(erreur);
use Data::Dumper;
# This function transforms the tree structure into the matrix used by the library NAnova
sub Tree2mat
{
my $present_node = shift;
my @vect=(); # dernier chenin parcouru
my @mat;
my $height=$present_node->{"height"};
print STDERR "heigh=", $present_node->{"height"}, "\n";
for (my $i=0; $i<$height; $i++) {
push(@vect, -1);
}
my $tree2mat;
$tree2mat = sub {
my $present_node = shift;
if ($present_node->NbChildren()==0) {
for (my $i=$present_node->{"level"}; $i<$height; $i++) {
$vect[$i]++;
}
my @tab=@vect;
push (@mat, \@tab);
} else {
for my $child ($present_node->GetChildrenList()) {
$vect[$present_node->{"level"}]++;
$tree2mat->($child);
}
}
};
$tree2mat->($present_node);
return \@mat;
}
# Fille the various tabular necessary for NAnaova
sub FillTableaux
{
my $present_node = shift;
my $values = shift;
my $groups = shift;
my $nb_term = shift;
print "Node: ", $present_node->Name(), " ", Dumper($values);
print "\n";
if ($present_node->NbChildren()==0) {
print "list: ", Dumper($present_node->GetQuantiList()), "\n";
push @{$values}, @{$present_node->GetQuantiListValues()};
push @{$groups}, $present_node->NbQuanti();
$nb_term++;
} else {
for my $child ($present_node->GetChildrenList()) {
FillTableaux($child, $values, $groups, $nb_term);
}
}
}
sub WriteMat
{
my $mat = shift;
#print STDERR Dumper($mat);
#return;
for (my $i=0; $i<=$#$mat; $i++) {
foreach my $elem (@{$mat->[$i]}) {
print $elem, "\t";
}
print "\n";
}
}
1;
|