MAGE::...osition(3pm)

๐Ÿฆ‹ MAGE::...osition(3pm) ๐Ÿฆ‹

okay bestie, so this is the user-contributed Perl documentation for the man page Bio::MAGE::DesignElement::Position(3pm) โ€” yes the header is literally squished like that, no that's not a typo, that's just man pages being man pages ๐Ÿ’…


โœจ NAME โœจ

Bio::MAGE::DesignElement::Position โ€” it's the class for the MAGE-OM API. that's it, that's the whole name section. iconic brevity ๐ŸŽ€


๐ŸŒธ SYNOPSIS ๐ŸŒธ

here's the vibe, in code, exactly as written:

use Bio::MAGE::DesignElement::Position

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

# creating an instance with existing data
my $position = Bio::MAGE::DesignElement::Position->new(
      x=>$x_val,
      y=>$y_val,
      propertySets=>\@namevaluetype_list,
      distanceUnit=>$distanceunit_ref,
);

# 'x' attribute
my $x_val = $position->x(); # getter
$position->x($value); # setter

# 'y' attribute
my $y_val = $position->y(); # getter
$position->y($value); # setter

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

# 'distanceUnit' association
my $distanceunit_ref = $position->distanceUnit(); # getter
$position->distanceUnit($distanceunit_ref); # setter

so like, you can make a blank one, or one that's already loaded with data. either way, slay ๐Ÿซถ


๐Ÿ’– DESCRIPTION ๐Ÿ’–

straight from the MAGE-OM documentation for the Position class, and I quote:

Specifies a position on an array.

that's the whole thing. it specifies a position. on an array. no notes, honestly. ๐ŸŽฏ


๐Ÿ‘‘ INHERITANCE ๐Ÿ‘‘

Bio::MAGE::DesignElement::Position has the following superclasses, and yes it's a whole family tree situation:

  • Bio::MAGE::Extendable

so it's got that Bio::MAGE::Extendable bloodline, iykyk ๐Ÿงฌ


๐Ÿ”ฅ CLASS METHODS ๐Ÿ”ฅ

the way these methods are all class methods โ€” meaning you can call every single one of them without ever making an instance first, just by going Bio::MAGE::DesignElement::Position->methodname(). no object required, main character energy, we love a class that's lowkey self-sufficient ๐Ÿ’…

๐ŸŒˆ new()

๐ŸŒˆ new(%args)

the object constructor new() takes these optional named-value style arguments, so you can pass them like key => value and it just gets it:

  • x โ€” sets the value of the x attribute
  • y โ€” sets the value of the y attribute
  • propertySets โ€” sets the value of the propertySets association. and bestie, heads up: this association was inherited from class Bio::MAGE::Extendable. the value must be of type: array of Bio::MAGE::NameValueType
  • distanceUnit โ€” sets the value of the distanceUnit association. the value must be of type: instance of Bio::MAGE::Measurement::DistanceUnit

๐Ÿงš $obj = class->new(%parameters)

new() is the class constructor. the big one. the moment. โœจ

  • Parameters: if you hand it a list of name/value parameters, the corresponding slots, attributes, or associations get their initial values set by the constructor.
  • Return value: it returns a reference to an object of the class. a whole new baby object ๐Ÿฃ
  • Side effects: it invokes the initialize() method if it's defined by the class.

๐Ÿ“ @names = class->get_slot_names()

get_slot_names() retrieves the name of all slots defined in a given class.

NOTE: the list of names does not include attribute or association names. like, it's slots only. don't come for me, that's just how it is ๐Ÿ˜ญ
  • Return value: a list of the names of all slots defined for this class.
  • Side effects: none. zero. zilch. so chill. ๐ŸŒธ

โญ @name_list = get_attribute_names()

returns the list of attribute data members for this class. that's the whole gig ๐Ÿ’ซ


โญ @name_list = get_association_names()

returns the list of association data members for this class. bestie behaviour, honestly ๐Ÿซถ


๐ŸŒŸ @class_list = get_superclasses()

returns the list of superclasses for this class. the ancestors. the lineage. ๐Ÿ‘‘


๐ŸŒŸ @class_list = get_subclasses()

returns the list of subclasses for this class. the descendants, the little ones, the legacy ๐Ÿ›


๐Ÿ’œ $name = class_name()

returns the full class name for this class. the whole government name, no nicknames ๐Ÿ’…


๐Ÿ’œ $package_name = package_name()

returns the base package name โ€” and by that I mean no namespace:: prefix โ€” of the package that contains this class. so like, the short version ๐ŸŽ€


๐Ÿ”ฎ %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. a whole little lookup table of association lore, we love to see it ๐ŸŒˆ


more of this page is coming, bestie โ€” don't go anywhere ๐Ÿ’œ

โœจ INSTANCE METHODS โœจ

๐Ÿ’ซ $obj_copy = $obj->new()

okay so when you call new() on an existing object reference instead of a class name, it does double duty as a copy constructor ๐Ÿซถ โ€” the new object's starting values get set to whatever the existing object has.

  • Parameters: no input parameters are used in the copy constructor, bestie. the initial values are taken directly from the object you're copying. periodt.
  • 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.

๐Ÿ’ซ $obj->set_slots(%parameters) and $obj->set_slots(\@name_list, \@value_list)

set_slots() is the "set a bunch of slots at once" method, and it's lowkey versatile because it has two different invocation styles. the first one takes a named parameter list, the second takes two array references.

  • Return value: none
  • Side effects: it will call croak() if you use a slot_name that the class does not define ๐Ÿ’€

๐Ÿ’ซ @obj_list = $obj->get_slots(@name_list)

get_slots() grabs the values of a bunch of slots all at the same time. very efficient of it โœจ

  • Return value: a list of instance objects
  • Side effects: none

๐Ÿ’ซ $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
  • 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.

  • Return value: a single slot value, or undef if the slot has not been initialized
  • Side effects: none

๐ŸŽ€ ATTRIBUTES ๐ŸŽ€

so attributes are these simple little 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 built out of separate setter and getter methods for each attribute โ€” one for each, no sharing, main character energy for every single one ๐Ÿ‘‘

Bio::MAGE::DesignElement::Position has the following attribute accessor methods:

๐ŸŒธ x โ€” methods for the x attribute ๐ŸŒธ

straight from the MAGE-OM documentation:

The horizontal distance from the upper left corner of the array.
  • $val = $position->setX($val) โ€” the restricted setter method for the x attribute.
    • Input parameters: the value to which the x attribute will be set
    • Return value: the current value of the x attribute
    • Side effects: none
    • Exceptions: will call croak() if no input parameters are specified, or if too many input parameters are specified
  • $val = $position->getX() โ€” the restricted getter method for the x attribute.
    • Input parameters: none
    • Return value: the current value of the x attribute
    • Side effects: none
    • Exceptions: will call croak() if any input parameters are specified

๐ŸŒธ y โ€” methods for the y attribute ๐ŸŒธ

also straight from the MAGE-OM documentation:

The vertical distance from the upper left corner of the array.
  • $val = $position->setY($val) โ€” the restricted setter method for the y attribute.
    • Input parameters: the value to which the y attribute will be set
    • Return value: the current value of the y attribute
    • Side effects: none
    • Exceptions: will call croak() if no input parameters are specified, or if too many input parameters are specified
  • $val = $position->getY() โ€” the restricted getter method for the y attribute.
    • Input parameters: none
    • Return value: the current value of the y attribute
    • Side effects: none
    • Exceptions: will call croak() if any input parameters are specified

๐Ÿฆ‹ ASSOCIATIONS ๐Ÿฆ‹

associations are references to other classes. and bestie, associations in MAGE-OM have a thing called cardinality, which decides the minimum and maximum number of instances of the 'other' class that may be included in the association:

  1. there must be exactly one item in the association, i.e. this is a mandatory data field.
  2. 0..1 โ€” there may be one item in the association, i.e. this is an optional data field.
  3. 1..N โ€” there must be one or more items in the association, i.e. this is a mandatory data field, with list cardinality.
  4. 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::DesignElement::Position has the following association accessor methods:

๐Ÿ’œ propertySets โ€” methods for the propertySets association ๐Ÿ’œ

from the MAGE-OM documentation, no cap:

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 = $position->setPropertySets($array_ref) โ€” the restricted setter method for the propertySets association.
    • 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
  • $array_ref = $position->getPropertySets() โ€” the restricted getter method for the propertySets association.
    • 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 = $position->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 @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 units of the x, y positions.
  • $val = $position->setDistanceUnit($val) โ€” the restricted setter method for the distanceUnit association.
    • 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
  • $val = $position->getDistanceUnit() โ€” the restricted getter method for the distanceUnit association.
    • 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
sub initialize {

  my $self = shift;
  return 1;

}

๐ŸŒˆ SLOTS, ATTRIBUTES, AND ASSOCIATIONS ๐ŸŒˆ

in the Perl implementation of MAGE-OM classes there are three types of class data members: slots, attributes, and associations. three flavours, one iconique little family ๐Ÿซถ

โญ SLOTS โญ

this API uses the term "slot" to mean a data member of the class that wasn't present in the UML model and exists mainly for internal purposes โ€” so like, only touch this if you actually understand the inner workings of the API, bestie ๐Ÿ™ˆ. most of the time slots get used by generic methods, like the ones in the XML writing and reading classes.

slots are implemented with unified getter/setter methods:

  • $var = $obj->slot_name(); โ€” retrieves the current value of the slot.
  • $new_var = $obj->slot_name($new_var); โ€” stores $new_var in the slot, and the return value is also $new_var.
  • @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. it simply does not check ๐Ÿ’€

โญ ATTRIBUTES AND ASSOCIATIONS โญ

the terms "attribute" and "association" mean data members of the class that were specified directly from the UML model.

in the Perl implementation of MAGE-OM classes, association and attribute accessors are implemented with three separate methods:

  • get* โ€” retrieves the current value.
    • NOTE: for associations, if the association has list cardinality, an array reference is returned.
    • DATA CHECKING: ensure that no argument is provided.
  • set* โ€” sets the current value, replacing any existing value.
    • NOTE: for associations, if the association has list cardinality, the argument must be an array reference. because of this, you probably should be using the add* methods.
    • 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.
  • add* โ€” appends a list of objects to any values that may already be stored in the association.
    • NOTE: only present in associations with list cardinality.
    • DATA CHECKING: ensure that all arguments are of the correct MAGE-OM class.

โญ 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:

$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 on this page for a detailed description of these methods ๐Ÿ’–

๐Ÿ› BUGS ๐Ÿ›

okay bestie, found something cursed? ๐Ÿ’€ don't suffer in silence, spill it to the project mailing list:

  • mged-mage 'at' lists 'dot' sf 'dot' net

that's the address, and yes you gotta de-obfuscate it yourself (swap the 'at' and 'dot' for the real symbols, you got this ๐Ÿ’…). tell them everything. they wanna know. ๐Ÿซถ


๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

this whole thing was brought to you by:

  • Jason E. Stewart โ€” jasons 'at' cpan 'dot' org

living legend, honestly. main character energy fr fr. ๐ŸŒˆโœจ


๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

that's it. that's the whole list. go read your perl manpage if you wanna understand the language underneath all this. iykyk ๐Ÿ“š๐Ÿ’–


๐Ÿšจ POD ERRORS ๐Ÿšจ

okay so ๐Ÿ’€ the document above had some coding errors while it was being formatted, and they're all explained right here. not us being messy, just... the pod being messy. it's giving "we tried". here's the full receipts:

Around line 308: '=item' outside of any '=over'
Around line 393: You forgot a '=back' before '=head2'
Around line 565: Expected '=item 2'
Around line 570: Expected '=item 3'
Around line 575: Expected '=item 4'

so yeah, five little pod oopsies, all documented, nothing hidden. lowkey iconic that they told on themselves. ๐Ÿ™ˆโœจ


that's a wrap on the whole page bestie!! ๐ŸŽ€ this one's from perl v5.32.0, dated 2020-11-27, filed under MAGE::...osition(3pm) in the User Contributed Perl Documentation. go forth and position your MAGE stuff with confidence. slay. periodt. ๐Ÿ’–๐Ÿฆ‹๐Ÿ‘‘

๐Ÿ“ฆ where this page comes from