Bio-MAGE

 view release on metacpan or  search on metacpan

MAGE/DesignElement/FeatureLocation.pm  view on Meta::CPAN

##############################
#
# Bio::MAGE::DesignElement::FeatureLocation
#
##############################
# C O P Y R I G H T   N O T I C E
#  Copyright (c) 2001-2006 by:
#    * The MicroArray Gene Expression Database Society (MGED)
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.



package Bio::MAGE::DesignElement::FeatureLocation;
use strict;
use Carp;

use base qw(Bio::MAGE::Extendable);

use Bio::MAGE::Association;

use vars qw($__ASSOCIATIONS
	    $__CLASS_NAME
	    $__PACKAGE_NAME
	    $__SUBCLASSES
	    $__SUPERCLASSES
	    $__ATTRIBUTE_NAMES
	    $__ASSOCIATION_NAMES
	   );


=head1 NAME

Bio::MAGE::DesignElement::FeatureLocation - Class for the MAGE-OM API

=head1 SYNOPSIS

  use Bio::MAGE::DesignElement::FeatureLocation

  # creating an empty instance
  my $featurelocation = Bio::MAGE::DesignElement::FeatureLocation->new();

  # creating an instance with existing data
  my $featurelocation = Bio::MAGE::DesignElement::FeatureLocation->new(
        row=>$row_val,
        column=>$column_val,
        propertySets=>\@namevaluetype_list,
  );


  # 'row' attribute
  my $row_val = $featurelocation->row(); # getter
  $featurelocation->row($value); # setter

  # 'column' attribute
  my $column_val = $featurelocation->column(); # getter
  $featurelocation->column($value); # setter


  # 'propertySets' association
  my $namevaluetype_array_ref = $featurelocation->propertySets(); # getter
  $featurelocation->propertySets(\@namevaluetype_list); # setter



=head1 DESCRIPTION

From the MAGE-OM documentation for the C<FeatureLocation> class:

Specifies where a feature is located relative to a grid.



=cut

=head1 INHERITANCE


Bio::MAGE::DesignElement::FeatureLocation has the following superclasses:

=over


=item * Bio::MAGE::Extendable


=back



=cut

BEGIN {
  $__CLASS_NAME        = q[Bio::MAGE::DesignElement::FeatureLocation];
  $__PACKAGE_NAME      = q[DesignElement];
  $__SUBCLASSES        = [];
  $__SUPERCLASSES      = ['Bio::MAGE::Extendable'];
  $__ATTRIBUTE_NAMES   = ['row', 'column'];
  $__ASSOCIATION_NAMES = ['propertySets'];
  $__ASSOCIATIONS      = []

}

=head1 CLASS METHODS

The following methods can all be called without first having an
instance of the class via the Bio::MAGE::DesignElement::FeatureLocation->methodname() syntax.

=over

=item new()

=item new(%args)


The object constructor C<new()> accepts the following optional
named-value style arguments:

=over

=item * row

MAGE/DesignElement/FeatureLocation.pm  view on Meta::CPAN

#
# code for get_slots() inherited from Base.pm
#

=item $val = $obj->set_slot($name,$val)

The C<set_slot()> method sets the slot C<$name> to the value C<$val>

B<Return value>: the new value of the slot, i.e. C<$val>

B<Side effects>: none

=cut

#
# code for set_slot() inherited from Base.pm
#

=item $val = $obj->get_slot($name)

The C<get_slot()> method is used to get the values of a number of
slots at the same time.

B<Return value>: a single slot value, or undef if the slot has not been
initialized.

B<Side effects>: none

=cut

#
# code for get_slot() inherited from Base.pm
#


=head2 ATTRIBUTES

Attributes are simple data types that belong to a single instance of a
class. In the Perl implementation of the MAGE-OM classes, the
interface to attributes is implemented using separate setter and
getter methods for each attribute.

C<Bio::MAGE::DesignElement::FeatureLocation> has the following attribute accessor methods:

=over


=item row

Methods for the C<row> attribute.


From the MAGE-OM documentation:

row position in the Zone


=over


=item $val = $featurelocation->setRow($val)

The restricted setter method for the C<row> attribute.


Input parameters: the value to which the C<row> attribute will be set 

Return value: the current value of the C<row> attribute 

Side effects: none

Exceptions: will call C<croak()> if no input parameters are specified, or
if too many input parameters are specified

=cut


sub setRow {
  my $self = shift;
  croak(__PACKAGE__ . "::setRow: no arguments passed to setter")
    unless @_;
  croak(__PACKAGE__ . "::setRow: too many arguments passed to setter")
    if @_ > 1;
  my $val = shift;
  
  return $self->{__ROW} = $val;
}


=item $val = $featurelocation->getRow()

The restricted getter method for the C<row> attribute.

Input parameters: none

Return value: the current value of the C<row> attribute 

Side effects: none

Exceptions: will call C<croak()> if any input parameters are specified

=cut


sub getRow {
  my $self = shift;
  croak(__PACKAGE__ . "::getRow: arguments passed to getter")
    if @_;
  my $val = shift;
  return $self->{__ROW};
}





=back


=item column

Methods for the C<column> attribute.


From the MAGE-OM documentation:

column position in the Zone.


=over


=item $val = $featurelocation->setColumn($val)

The restricted setter method for the C<column> attribute.


Input parameters: the value to which the C<column> attribute will be set 

Return value: the current value of the C<column> attribute 

Side effects: none

Exceptions: will call C<croak()> if no input parameters are specified, or
if too many input parameters are specified

=cut


sub setColumn {
  my $self = shift;
  croak(__PACKAGE__ . "::setColumn: no arguments passed to setter")
    unless @_;
  croak(__PACKAGE__ . "::setColumn: too many arguments passed to setter")
    if @_ > 1;
  my $val = shift;
  
  return $self->{__COLUMN} = $val;
}


=item $val = $featurelocation->getColumn()

The restricted getter method for the C<column> attribute.

Input parameters: none

Return value: the current value of the C<column> attribute 

Side effects: none

Exceptions: will call C<croak()> if any input parameters are specified

=cut


sub getColumn {
  my $self = shift;
  croak(__PACKAGE__ . "::getColumn: arguments passed to getter")
    if @_;
  my $val = shift;
  return $self->{__COLUMN};
}





=back


=back


=head2 ASSOCIATIONS

Associations are references to other classes. Associations in MAGE-OM have a cardinality that determines the minimum and
maximum number of instances of the 'other' class that maybe included
in the association:

=over

=item 1

There B<must> be exactly one item in the association, i.e. this is a
mandatory data field.

=item 0..1

There B<may> be one item in the association, i.e. this is an optional
data field.

=item 1..N

There B<must> be one or more items in the association, i.e. this is a
mandatory data field, with list cardinality.

=item 0..N

There B<may> be one or more items in the association, i.e. this is an
optional data field, with list cardinality.

=back

Bio::MAGE::DesignElement::FeatureLocation has the following association accessor methods:

=over


=item propertySets

Methods for the C<propertySets> association.


From the MAGE-OM documentation:

Allows specification of name/value pairs.  Meant to primarily help in-house, pipeline processing of instances by providing a place for values that aren't part of the specification proper.


=over


=item $array_ref = $featurelocation->setPropertySets($array_ref)

The restricted setter method for the C<propertySets> association.


Input parameters: the value to which the C<propertySets> association will be set : a reference to an array of objects of type C<Bio::MAGE::NameValueType>

Return value: the current value of the C<propertySets> association : a reference to an array of objects of type C<Bio::MAGE::NameValueType>

Side effects: none

Exceptions: will call C<croak()> if no input parameters are specified, or
if too many input parameters are specified, or if C<$array_ref> is not a reference to an array class C<Bio::MAGE::NameValueType> instances

=cut


sub setPropertySets {
  my $self = shift;
  croak(__PACKAGE__ . "::setPropertySets: no arguments passed to setter")
    unless @_;
  croak(__PACKAGE__ . "::setPropertySets: too many arguments passed to setter")
    if @_ > 1;
  my $val = shift;
    croak(__PACKAGE__ . "::setPropertySets: expected array reference, got $self")
    unless (not defined $val) or UNIVERSAL::isa($val,'ARRAY');
  if (defined $val) {
    foreach my $val_ent (@{$val}) {
      croak(__PACKAGE__ . "::setPropertySets: wrong type: " . ref($val_ent) . " expected Bio::MAGE::NameValueType")
        unless UNIVERSAL::isa($val_ent,'Bio::MAGE::NameValueType');
    }
  }

  return $self->{__PROPERTYSETS} = $val;
}


=item $array_ref = $featurelocation->getPropertySets()

The restricted getter method for the C<propertySets> association.

Input parameters: none

Return value: the current value of the C<propertySets> association : a reference to an array of objects of type C<Bio::MAGE::NameValueType>

Side effects: none

Exceptions: will call C<croak()> if any input parameters are specified

=cut


sub getPropertySets {
  my $self = shift;
  croak(__PACKAGE__ . "::getPropertySets: arguments passed to getter")
    if @_;
  my $val = shift;
  return $self->{__PROPERTYSETS};
}




=item $val = $featurelocation->addPropertySets(@vals)

Because the propertySets association has list cardinality, it may store more
than one value. This method adds the current list of objects in the propertySets association.

Input parameters: the list of values C<@vals> to add to the propertySets association. B<NOTE>: submitting a single value is permitted.

Return value: the number of items stored in the slot B<after> adding C<@vals>

Side effects: none

Exceptions: will call C<croak()> if no input parameters are specified, or if any of the objects in @vals is not an instance of class C<Bio::MAGE::NameValueType>

=cut


sub addPropertySets {
  my $self = shift;
  croak(__PACKAGE__ . "::addPropertySets: no arguments passed to adder")
    unless @_;
  my @vals = @_;
    foreach my $val (@vals) {
    croak(__PACKAGE__ . "::addPropertySets: wrong type: " . ref($val) . " expected Bio::MAGE::NameValueType")
      unless UNIVERSAL::isa($val,'Bio::MAGE::NameValueType');
  }

  return push(@{$self->{__PROPERTYSETS}},@vals);
}





=back


sub initialize {


  my $self = shift;
  return 1;


}

=back


=cut


=head1 SLOTS, ATTRIBUTES, AND ASSOCIATIONS

In the Perl implementation of MAGE-OM classes, there are
three types of class data members: C<slots>, C<attributes>, and
C<associations>.

=head2 SLOTS

This API uses the term C<slot> to indicate a data member of the class
that was not present in the UML model and is used for mainly internal



( run in 1.355 second using v1.01-cache-2.11-cpan-71847e10f99 )