Lingua-YaTeA

 view release on metacpan or  search on metacpan

lib/Lingua/YaTeA/Edge.pm  view on Meta::CPAN

package Lingua::YaTeA::Edge;
use strict;
use warnings;
use UNIVERSAL;
use Scalar::Util qw(blessed);

our $VERSION=$Lingua::YaTeA::VERSION;


sub new
{
    my ($class) = @_;
    my $this = {};
    bless ($this,$class);
    #$this->{FATHER} = $father;
    #$this->{POSITION} = "";
    return $this;
}


sub copyRecursively
{
    my ($this,$new_set,$father) = @_;
    my $new;
    if ((blessed($this)) && ($this->isa('Lingua::YaTeA::TermLeaf')))
    {
	return "";
    }
    else{
	if ((blessed($this)) && ($this->isa('Lingua::YaTeA::InternalNode')))
	{
	    return $this->copyRecursively($new_set,$father);
	}
	else{
	    if ((blessed($this)) && ($this->isa('Lingua::YaTeA::PatternLeaf')))
	    {
		return "";
	    }
	}
    }
}

sub update
{
    my ($this,$new_value) = @_;
    $this = $new_value;
}



sub print
{
    my ($this,$words_a,$fh) = @_;
    if ((blessed($this)) && ($this->isa("Lingua::YaTeA::Node")))
    {
	 print $fh "Node " . $this->getID;
    }
    else{
	$this->printWords($words_a,$fh);
    }
}

1;

__END__

=head1 NAME

Lingua::YaTeA::Edge - Perl extension for edge between nodes

=head1 SYNOPSIS

  use Lingua::YaTeA::Edge;
  Lingua::YaTeA::Edge->new();

=head1 DESCRIPTION

The module implements edges between any sort of nodes. It is inherited
from several modules.

=head1 METHODS

=head2 new()

    new();

The method creates a new edge.

=head2 copyRecursively()

    copyRecursively($newset, $father);

The method copies recursively the current node in the node set
C<$newset> and return the copy. It also connect the copy to the father
of the original node (C<$father>).

=head2 update()

    update($new_value);

The method updates the edge with new edge information C<$new_value>.

=head2 print()



( run in 1.519 second using v1.01-cache-2.11-cpan-d06a3f9ecfd )