The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Bio::Phylo::Mediators::TaxaMediator - Mediator class to manage links between objects.

SYNOPSIS

# no direct usage

DESCRIPTION

This module manages links between taxon objects and other objects linked to them. It is an implementation of the Mediator design pattern (e.g. see Relationship Manager Pattern, Mediator, Mediator Design Pattern).

Methods defined in this module are meant only for internal usage by Bio::Phylo.

METHODS

CONSTRUCTOR

new()
Type    : Constructor
Title   : new
Usage   : my $mediator = Bio::Phylo::Taxa::TaxaMediator->new;
Function: Instantiates a Bio::Phylo::Taxa::TaxaMediator
          object.
Returns : A Bio::Phylo::Taxa::TaxaMediator object (singleton).
Args    : None.

METHODS

register()
Type    : Method
Title   : register
Usage   : $mediator->register( $obj );
Function: Stores an object in mediator's cache
Returns : $self
Args    : An object, $obj
Comments: This method is called every time an object is instantiated.
unregister()
Type    : Method
Title   : unregister
Usage   : $mediator->unregister( $obj );
Function: Cleans up mediator's cache of $obj and $obj's relations
Returns : $self
Args    : An object, $obj
Comments: This method is called every time an object is destroyed.
set_link()
Type    : Method
Title   : set_link
Usage   : $mediator->set_link( -one => $obj1, -many => $obj2 );
Function: Creates link between objects
Returns : $self
Args    : -one  => $obj1 (source of a one-to-many relationship)
          -many => $obj2 (target of a one-to-many relationship)
Comments: This method is called from within, for example, set_taxa
          method calls. A call like $taxa->set_matrix( $matrix ),
          and likewise a call like $matrix->set_taxa( $taxa ), are 
          both internally rerouted to:

          $mediator->set_link( 
               -one  => $taxa, 
               -many => $matrix 
          );
get_link()
Type    : Method
Title   : get_link
Usage   : $mediator->get_link( 
              -source => $obj, 
              -type   => _CONSTANT_,
          );
Function: Retrieves link between objects
Returns : Linked object
Args    : -source => $obj (required, the source of the link)
          -type   => a constant from Bio::Phylo::Util::CONSTANT

          (-type is optional, used to filter returned results in 
          one-to-many query).

Comments: This method is called from within, for example, get_taxa
          method calls. A call like $matrix->get_taxa()
          and likewise a call like $forest->get_taxa(), are 
          both internally rerouted to:

          $mediator->get_link( 
              -source => $self # e.g. $matrix or $forest           
          );

          A call like $taxa->get_matrices() is rerouted to:

          $mediator->get_link( -source => $taxa, -type => _MATRIX_ );
remove_link()
Type    : Method
Title   : remove_link
Usage   : $mediator->remove_link( -one => $obj1, -many => $obj2 );
Function: Creates link between objects
Returns : $self
Args    : -one  => $obj1 (source of a one-to-many relationship)
          -many => $obj2 (target of a one-to-many relationship)

          (-many argument is optional)

Comments: This method is called from within, for example, 
          unset_taxa method calls. A call like $matrix->unset_taxa() 
          is rerouted to:

          $mediator->remove_link( -many => $matrix );

          A call like $taxa->unset_matrix( $matrix ); is rerouted to:

          $mediator->remove_link( -one => $taxa, -many => $matrix );

SEE ALSO

Bio::Phylo::Manual

Also see the manual: Bio::Phylo::Manual.

FORUM

CPAN hosts a discussion forum for Bio::Phylo. If you have trouble using this module the discussion forum is a good place to start posting questions (NOT bug reports, see below): http://www.cpanforum.com/dist/Bio-Phylo

BUGS

Please report any bugs or feature requests to bug-bio-phylo@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Bio-Phylo. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. Be sure to include the following in your request or comment, so that I know what version you're using:

$Id: TaxaMediator.pm 3386 2007-03-24 16:22:25Z rvosa $

AUTHOR

Rutger A. Vos,

email: rvosa@sfu.ca
web page: http://www.sfu.ca/~rvosa/

ACKNOWLEDGEMENTS

The author would like to thank Jason Stajich for many ideas borrowed from BioPerl http://www.bioperl.org, and CIPRES http://www.phylo.org and FAB* http://www.sfu.ca/~fabstar for comments and requests.

COPYRIGHT & LICENSE

Copyright 2005 Rutger A. Vos, All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.