MAGE::...nDelta(3pm)
π NAME π
Bio::MAGE::Array::PositionDelta β bestie, it's a class for the MAGE-OM API π§¬β¨
This page lives in the User Contributed Perl Documentation section, manual page MAGE::...nDelta(3pm). (Yeah the header is a little cryptic, we don't make the rules π )
β¨ SYNOPSIS β¨
Okay so here's the whole vibe of how you actually use this thing:
use Bio::MAGE::Array::PositionDelta
# creating an empty instance
my $positiondelta = Bio::MAGE::Array::PositionDelta->new();
# creating an instance with existing data
my $positiondelta = Bio::MAGE::Array::PositionDelta->new(
deltaX=>$deltax_val,
deltaY=>$deltay_val,
propertySets=>\@namevaluetype_list,
distanceUnit=>$distanceunit_ref,
);
# 'deltaX' attribute
my $deltaX_val = $positiondelta->deltaX(); # getter
$positiondelta->deltaX($value); # setter
# 'deltaY' attribute
my $deltaY_val = $positiondelta->deltaY(); # getter
$positiondelta->deltaY($value); # setter
# 'propertySets' association
my $namevaluetype_array_ref = $positiondelta->propertySets(); # getter
$positiondelta->propertySets(\@namevaluetype_list); # setter
# 'distanceUnit' association
my $distanceunit_ref = $positiondelta->distanceUnit(); # getter
$positiondelta->distanceUnit($distanceunit_ref); # setter
Getter, setter, getter, setter β the little back-and-forth that runs the whole world π
π¦ DESCRIPTION π¦
Straight from the MAGE-OM documentation for the PositionDelta class, and I quote, no cap:
The delta the feature was actually printed on the array from the position specified for the feature in the array design.
So basically: you said the feature goes here, the printer put it there, and this class holds the lil' difference. The tea ββ¨
π INHERITANCE π
Bio::MAGE::Array::PositionDelta has the following superclasses:
Bio::MAGE::Extendable
Yes queen, it inherits. It's giving generational wealth π
π CLASS METHODS π
All of these can be called without having an instance first, using the
Bio::MAGE::Array::PositionDelta->methodname()
syntax. Class methods, no object required, we love a low-commitment moment π«Ά
new()
new(%args)
The object constructor new() accepts the following optional named-value style arguments:
deltaXβ Sets the value of thedeltaXattributedeltaYβ Sets the value of thedeltaYattributepropertySetsβ Sets the value of thepropertySetsassociation (this association was inherited from classBio::MAGE::Extendable).
The value must be of type: array of Bio::MAGE::NameValueType.
distanceUnitβ Sets the value of thedistanceUnitassociation
The value must be of type: instance of Bio::MAGE::Measurement::DistanceUnit.
Type checks are real, bestie, don't try to sneak a random scalar in there π
$obj = class->new(%parameters)
The new() method is the class constructor. The main character of this whole page, honestly π
- Parameters: if given a list of name/value parameters the corresponding slots, attributes, or associations will have their initial values set by the constructor.
- Return value: It returns a reference to an object of the class.
- Side effects: It invokes the
initialize()method if it is defined by the class.
@names = class->get_slot_names()
The get_slot_names() method is used to retrieve the name of all slots defined in a given class.
NOTE: the list of names does not include attribute or association names. So don't come for me when your attribute isn't in there, it's literally by design π
- Return value: A list of the names of all slots defined for this class.
- Side effects: none (a rare and blessed occurrence β¨)
@name_list = get_attribute_names()
returns the list of attribute data members for this class.
@name_list = get_association_names()
returns the list of association data members for this class.
@class_list = get_superclasses()
returns the list of superclasses for this class.
@class_list = get_subclasses()
returns the list of subclasses for this class.
$name = class_name()
Returns the full class name for this class. Full government name, no nicknames π
$package_name = package_name()
Returns the base package name (i.e. no 'namespace::') of the package that contains this class.
%assns = associations()
returns the association meta-information in a hash where the keys are the association names and the values are Association objects that provide the meta-information for the association.
Meta-information about your associations. Very meta. Very iconic. π
π INSTANCE METHODS π
okay bestie, these are the methods you actually call on an object (as opposed to the class methods we already talked about). the way these justβ¦ work? obsessed. π
$obj_copy = $obj->new()β when you callnew()on an existing object reference instead of on a class name, it lowkey acts as a copy constructor. like, the new object's initial values get set to the values of the object you're copying. slay.
Parameters: nope, no input parameters are used in the copy constructor β the initial values are taken directly from the object being copied. β¨
Return value: it hands you back a reference to an object of the class. π
Side effects: it invokes the initialize() method if the class defines one. so heads up, that's happening whether you asked or not.
$obj->set_slots(%parameters)$obj->set_slots(\@name_list, \@value_list)βset_slots()sets a whole bunch of slots at the same time, because doing them one by one is giving β not today. it has two different ways to be invoked: the first takes a named parameter list, and the second takes two array references.
Return value: none. it's giving nothing, and that's fine. π
Side effects: it will call croak() if a slot_name is used that the class does not define. so like⦠don't do that.
@obj_list = $obj->get_slots(@name_list)βget_slots()grabs the values of a number of slots all at once. efficiency queen. π
Return value: a list of instance objects.
Side effects: none. clean. iconic.
$val = $obj->set_slot($name,$val)βset_slot()sets the slot $name to the value $val.
Return value: the new value of the slot, i.e. $val. it echoes back at you.
Side effects: none.
$val = $obj->get_slot($name)βget_slot()is used to get the values of a number of slots at the same time. (yes fr fr, that's what the docs say πΈ)
Return value: a single slot value, or undef if the slot has not been initialized.
Side effects: none.
π¦ ATTRIBUTES π¦
so, 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. one for setting, one for getting, no sharing, no merging. boundaries. π
Bio::MAGE::Array::PositionDelta has the following attribute accessor methods:
πΈ deltaX πΈ
methods for the deltaX attribute.
from the MAGE-OM documentation:
Deviation from the y coordinate of this feature's position.
(yes, it says y. we don't ask questions, we just copy it faithfully bestie π«Ά)
$val = $positiondelta->setDeltaX($val)β the restricted setter method for thedeltaXattribute.
Input parameters: the value to which the deltaX attribute will be set.
Return value: the current value of the deltaX attribute.
Side effects: none.
Exceptions: will call croak() if no input parameters are specified, or if too many input parameters are specified. so like, exactly one. goldilocks vibes. π»
$val = $positiondelta->getDeltaX()β the restricted getter method for thedeltaXattribute.
Input parameters: none.
Return value: the current value of the deltaX attribute.
Side effects: none.
Exceptions: will call croak() if any input parameters are specified. it wants zero. it's an only child. π
π deltaY π
methods for the deltaY attribute.
from the MAGE-OM documentation:
Deviation from the y coordinate of this feature's position.
$val = $positiondelta->setDeltaY($val)β the restricted setter method for thedeltaYattribute.
Input parameters: the value to which the deltaY attribute will be set.
Return value: the current value of the deltaY attribute.
Side effects: none.
Exceptions: will call croak() if no input parameters are specified, or if too many input parameters are specified.
$val = $positiondelta->getDeltaY()β the restricted getter method for thedeltaYattribute.
Input parameters: none.
Return value: the current value of the deltaY attribute.
Side effects: none.
Exceptions: will call croak() if any input parameters are specified.
π₯ ASSOCIATIONS π₯
associations are references to other classes. in MAGE-OM they have a cardinality that determines the minimum and maximum number of instances of the 'other' class that may be included in the association. think of it like a situationship contract, but with numbers. π
- there must be exactly one item in the association, i.e. this is a mandatory data field.
- 0..1 β there may be one item in the association, i.e. this is an optional data field.
- 1..N β there must be one or more items in the association, i.e. this is a mandatory data field, with list cardinality.
- 0..N β there may be one or more items in the association, i.e. this is an optional data field, with list cardinality.
Bio::MAGE::Array::PositionDelta has the following association accessor methods:
β propertySets β
methods for the 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.
$array_ref = $positiondelta->setPropertySets($array_ref)β the restricted setter method for thepropertySetsassociation.
Input parameters: the value to which the propertySets association will be set : a reference to an array of objects of type Bio::MAGE::NameValueType
Return value: the current value of the propertySets association : a reference to an array of objects of type Bio::MAGE::NameValueType
Side effects: none.
Exceptions: will call croak() if no input parameters are specified, or if too many input parameters are specified, or if $array_ref is not a reference to an array class Bio::MAGE::NameValueType instances. triple threat of complaints fr fr. π
$array_ref = $positiondelta->getPropertySets()β the restricted getter method for thepropertySetsassociation.
Input parameters: none.
Return value: the current value of the propertySets association : a reference to an array of objects of type Bio::MAGE::NameValueType
Side effects: none.
Exceptions: will call croak() if any input parameters are specified.
$val = $positiondelta->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. it's the "+1 more" button. π
Input parameters: the list of values @vals to add to the propertySets association. NOTE: submitting a single value is permitted.
Return value: the number of items stored in the slot after adding @vals.
Side effects: none.
Exceptions: will call croak() if no input parameters are specified, or if any of the objects in @vals is not an instance of class Bio::MAGE::NameValueType.
π§ distanceUnit π§
methods for the distanceUnit association.
from the MAGE-OM documentation:
The unit for the attributes.
$val = $positiondelta->setDistanceUnit($val)β the restricted setter method for thedistanceUnitassociation.
Input parameters: the value to which the distanceUnit association will be set : one of the accepted enumerated values.
Return value: the current value of the distanceUnit association : one of the accepted enumerated values.
Side effects: none.
Exceptions: will call croak() if no input parameters are specified, or if too many input parameters are specified, or if $val is not an instance of class Bio::MAGE::Measurement::DistanceUnit. picky picky picky. π
$val = $positiondelta->getDistanceUnit()β the restricted getter method for thedistanceUnitassociation.
Input parameters: none.
Return value: the current value of the distanceUnit association : an instance of type Bio::MAGE::Measurement::DistanceUnit.
Side effects: none.
Exceptions: will call croak() if any input parameters are specified.
and then there's this lil guy, just hanging out at the end of the section like the main character he is π
sub initialize {
my $self = shift;
return 1;
}
β¨ SLOTS, ATTRIBUTES, AND ASSOCIATIONS β¨
okay bestie so in the Perl implementation of MAGE-OM classes, there are three types of class data members and you gotta know the difference or you'll be lost: slots, attributes, and associations. π
πΈ SLOTS πΈ
so this API uses the word slot to mean a data member of the class that wasn't in the UML model at all, and it's used for mainly internal purposes. translation: only touch these if you understand the inner workings of the API, fr fr. most of the time slots get used by generic methods, like the ones hanging out in the XML writing and reading classes. π§
slots are implemented with unified getter/setter methods:
$var = $obj->slot_name();β grabs the current value of the slot, that's it, that's the whole job π$new_var = $obj->slot_name($new_var);β stores$new_varin the slot β and the return value is also$new_var(it gives it right back to you, cute) π@names = $obj->get_slot_names()β returns the list of all slots in the class π
DATA CHECKING: no data type checking is made for these methods. none. zero. she does not check. π
π¦ ATTRIBUTES AND ASSOCIATIONS π¦
now, the terms attribute and association mean data members of the class that were specified directly from the UML model β so these are the legit, official ones, not the internal gremlins.
in the Perl implementation of MAGE-OM classes, association and attribute accessors are implemented using three separate methods. three. a lil trio. π
β get*
retrieves the current value. simple. iconic. main character energy. β¨
NOTE: for associations, if the association has list cardinality, an array reference is returned.
DATA CHECKING: ensure that no argument is provided. don't hand her anything, she didn't ask. π
β set*
sets the current value, replacing any existing value. the old one? gone. no notes. π
NOTE: for associations, if the association has list cardinality, the argument must be an array reference. and because of thatβ¦ you probably should be using the add* methods instead, bestie, just saying. π«Ά
DATA CHECKING: for attributes, ensure that a single value is provided as the argument. for associations, if the association has list cardinality, ensure that the argument is a reference to an array of instances of the correct MAGE-OM class; otherwise, ensure that there is a single argument of the correct MAGE-OM class. yes that's a lot of words, but she's thorough and we love her for it. πΈ
β add*
NOTE: only present in associations with list cardinality. if it's not there, that's why. π€·
appends a list of objects to any values that may already be stored in the association β it adds, it does not replace. growth mindset. π±
DATA CHECKING: ensure that all arguments are of the correct MAGE-OM class. every single one. she will know. π
π GENERIC METHODS π
the unified base class of all MAGE-OM classes, Bio::MAGE::Base, provides a whole set of generic methods that will operate on slots, attributes, and associations. one class to serve them all, periodt. π
$val = $obj->get_slot($name)
\@list_ref = $obj->get_slots(@name_list);
$val = $obj->set_slot($name,$val)
$obj->set_slots(%parameters)
$obj->set_slots(\@name_list, \@value_list)
see elsewhere in this page for a detailed description of these methods β they got their own moment earlier, go look bestie. π
π BUGS π
found a bug? please send bug reports to the project mailing list: (mged-mage 'at' lists 'dot' sf 'dot' net) β they wanna hear from you, no cap. π¬
π AUTHOR π
Jason E. Stewart β (jasons 'at' cpan 'dot' org)
the icon. the legend. the author. π
π SEE ALSO π
perl(1).β go read it, it's giving foundation πΈ
π POD ERRORS π
hey! the above document had some coding errors, which are explained below. not me reading the linter's receipts π:
- Around line
308:'=item' outside of any '=over'π
- Around line
393:- you forgot a
'=back'before a'=head2'π
- you forgot a
- Around line
565:- expected
'=item 2'β¨
- expected
- Around line
570:- expected
'=item 3'β¨
- expected
- Around line
575:- expected
'=item 4'β¨
- expected
and that's a wrap on the whole page, bestie!! this came to you from the User Contributed Perl Documentation, running on perl v5.32.0, dated 2020-11-27, and the page is MAGE::...nDelta(3pm). go forth and slay your MAGE-OM classes, ily π«Άπβ¨
π¦ where this page comes from
- debian bookworm: libbio-mage-perl 20030502.3-6 Β· MIT
- debian trixie: libbio-mage-perl 20030502.3-6 Β· MIT
- ubuntu jammy: libbio-mage-perl 20030502.3-6 Β· MIT
- ubuntu noble: libbio-mage-perl 20030502.3-6 Β· MIT
- ubuntu resolute: libbio-mage-perl 20030502.3-6 Β· MIT
- ubuntu stonking: libbio-mage-perl 20030502.3-6 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms