Bio-MAGE
view release on metacpan or search on metacpan
MAGE/Measurement/ConcentrationUnit.pm view on Meta::CPAN
use constant UNITNAMECV_ML_PER_L => 'mL_per_L';
use constant UNITNAMECV_MM => 'mM';
use constant UNITNAMECV_G_PER_L => 'g_per_L';
use constant UNITNAMECV_FM => 'fM';
use constant UNITNAMECV_PM => 'pM';
use constant UNITNAMECV_MG_PER_ML => 'mg_per_mL';
use constant UNITNAMECV_OTHER => 'other';
use constant UNITNAMECV_UM => 'uM';
use constant UNITNAMECV_M => 'M';
use constant UNITNAMECV_MASS_PER_VOLUME_PERCENT => 'mass_per_volume_percent';
use constant UNITNAMECV_GRAM_PERCENT => 'gram_percent';
use constant UNITNAMECV_MASS_PER_MASS_PERCENT => 'mass_per_mass_percent';
use constant UNITNAMECV_NM => 'nM';
=head1 NAME
Bio::MAGE::Measurement::ConcentrationUnit - Class for the MAGE-OM API
=head1 SYNOPSIS
use Bio::MAGE::Measurement::ConcentrationUnit
MAGE/Measurement/ConcentrationUnit.pm view on Meta::CPAN
=over
=item $val = $concentrationunit->setUnitNameCV($val)
The restricted setter method for the C<unitNameCV> attribute.
C<unitNameCV> is an B<enumerated> attribute - it can only be set to C<undef> or one of the following values: M mM uM nM pM fM mg_per_mL mL_per_L g_per_L gram_percent mass_per_volume_percent mass_per_mass_percent other
Input parameters: the value to which the C<unitNameCV> attribute will be set
Return value: the current value of the C<unitNameCV> attribute
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<$val> is not one of the accepted enumeration values: M mM uM nM pM fM mg_per_mL mL_per_L g_per_L gram_percent mass_per_volume_percent mass_per_mass_percent other
=cut
sub setUnitNameCV {
my $self = shift;
croak(__PACKAGE__ . "::setUnitNameCV: no arguments passed to setter")
unless @_;
croak(__PACKAGE__ . "::setUnitNameCV: too many arguments passed to setter")
if @_ > 1;
my $val = shift;
croak(__PACKAGE__ . "::setUnitNameCV: expected one of enum values : M mM uM nM pM fM mg_per_mL mL_per_L g_per_L gram_percent mass_per_volume_percent mass_per_mass_percent other, got $val")
unless (not defined $val) or (grep {$val eq $_} qw(M mM uM nM pM fM mg_per_mL mL_per_L g_per_L gram_percent mass_per_volume_percent mass_per_mass_percent other));
return $self->{__UNITNAMECV} = $val;
}
=item $val = $concentrationunit->getUnitNameCV()
The restricted getter method for the C<unitNameCV> attribute.
Input parameters: none
Return value: the current value of the C<unitNameCV> attribute : an instance of type C<M mM uM nM pM fM mg_per_mL mL_per_L g_per_L gram_percent mass_per_volume_percent mass_per_mass_percent other>.
Side effects: none
Exceptions: will call C<croak()> if any input parameters are specified
=cut
sub getUnitNameCV {
my $self = shift;
'id' => 'S.240',
'package' => 'QuantitationType',
'name' => 'StandardQuantitationType'
},
'ConcentrationUnit' => {
'parent' => 'Unit',
'documentation' => 'Concentration',
'attrs' => [
{
'id' => 'S.210',
'type' => 'enum {M,mM,uM,nM,pM,fM,mg/mL,mL/L,g/L,gram_percent,mass/volume_percent, mass/mass_percent,other}',
'name' => 'unitNameCV'
}
],
'associations' => [],
'abstract' => 'false',
'methods' => [],
'id' => 'S.209',
'package' => 'Measurement',
'name' => 'ConcentrationUnit'
},
t/ConcentrationUnit.t view on Meta::CPAN
'unitNameCV accepts mL_per_L');
# test setter accepts enumerated value: g_per_L
eval {$concentrationunit->setUnitNameCV('g_per_L')};
ok((not $@ and $concentrationunit->getUnitNameCV() eq 'g_per_L'),
'unitNameCV accepts g_per_L');
# test setter accepts enumerated value: gram_percent
eval {$concentrationunit->setUnitNameCV('gram_percent')};
ok((not $@ and $concentrationunit->getUnitNameCV() eq 'gram_percent'),
'unitNameCV accepts gram_percent');
# test setter accepts enumerated value: mass_per_volume_percent
eval {$concentrationunit->setUnitNameCV('mass_per_volume_percent')};
ok((not $@ and $concentrationunit->getUnitNameCV() eq 'mass_per_volume_percent'),
'unitNameCV accepts mass_per_volume_percent');
# test setter accepts enumerated value: mass_per_mass_percent
eval {$concentrationunit->setUnitNameCV('mass_per_mass_percent')};
ok((not $@ and $concentrationunit->getUnitNameCV() eq 'mass_per_mass_percent'),
'unitNameCV accepts mass_per_mass_percent');
# test setter accepts enumerated value: other
eval {$concentrationunit->setUnitNameCV('other')};
ok((not $@ and $concentrationunit->getUnitNameCV() eq 'other'),
'unitNameCV accepts other');
( run in 0.410 second using v1.01-cache-2.11-cpan-709fd43a63f )