MAGE::Array(3pm)

MAGE::Array(3pm) πŸ’–βœ¨ β€” bestie, you found the page for Bio::MAGE::Array, and it's lowkey the container module for the Array package. No cap.

✨ NAME ✨

Bio::MAGE::Array β€” Container module for classes in the MAGE package: Array. periodt.

🌸 SYNOPSIS 🌸

use Bio::MAGE::Array;

πŸ¦‹ DESCRIPTION πŸ¦‹

This is a package module that encapsulates a number of classes in the Bio::MAGE hierarchy. These classes belong to the Array package of the MAGE-OM object model. it's giving very structured, very MAGE-OM. 🧚

πŸ‘‘ CLASSES πŸ‘‘

The Bio::MAGE::Array module contains the following Bio::MAGE classes:

  • Array
  • FeatureDefect
  • ArrayGroup
  • ArrayManufacture
  • ArrayManufactureDeviation
  • Fiducial
  • ManufactureLIMS
  • ManufactureLIMSBiomaterial
  • PositionDelta
  • ZoneDefect

πŸ’… CLASS METHODS πŸ’…

  • @class_list = Bio::MAGE::Array::classes(); β€” This method returns a list of non-fully qualified class names (i.e. they do not have 'Bio::MAGE::' as a prefix) in this package. slay.
  • $obj = class->new(%parameters) β€” The "new()" method is the class constructor.
    • 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.
  • Return value: A list of the names of all slots defined for this class.
  • Side effects: none
  • @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.
  • $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.

πŸŽ€ INSTANCE METHODS πŸŽ€

  • $obj_copy = $obj->new() β€” When invoked with an existing object reference and not a class name, the "new()" method acts as a copy constructor - with the new object's initial values set to be those of the existing object.
    • Parameters: No input parameters are used in the copy constructor, the initial values are taken directly from the object to be copied.
    • 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.
  • $obj->set_slots(%parameters) / $obj->set_slots(\@name_list, \@value_list) β€” The "set_slots()" method is used to set a number of slots at the same time. It has two different invocation methods. The first takes a named parameter list, and the second takes two array references.
    • Return value: none
    • Side effects: will call "croak()" if a slot_name is used that the class does not define.
  • @obj_list = $obj->get_slots(@name_list) β€” The "get_slots()" method is used to get the values of a number of slots at the same time.
    • Return value: a list of instance objects
    • Side effects: none
  • $val = $obj->set_slot($name,$val) β€” The "set_slot()" method 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) β€” The "get_slot()" method 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
  • $val = $array->xml_lists() / $inval = $array->xml_lists($inval) β€” This is the unified setter/getter method for the xml_lists slot.
    • If $inval is specified, the setter method is invoked, with no parameters, the getter method is invoked.
    • Input parameters: the optional $inval will invoke the setter method.
    • Return value: for both setter and getter the current value of the xml_lists slot
    • Side effects: none
    • Exceptions: none
  • $val = $array->tagname() / $inval = $array->tagname($inval) β€” This is the unified setter/getter method for the tagname slot.
    • If $inval is specified, the setter method is invoked, with no parameters, the getter method is invoked.
    • Input parameters: the optional $inval will invoke the setter method.
    • Return value: for both setter and getter the current value of the tagname slot
    • Side effects: none
    • Exceptions: none
  • $val = $array->arraygroup_list() / $inval = $array->arraygroup_list($inval) β€” This is the unified setter/getter method for the arraygroup_list slot.
    • If $inval is specified, the setter method is invoked, with no parameters, the getter method is invoked.
    • Input parameters: the optional $inval will invoke the setter method.
    • Return value: for both setter and getter the current value of the arraygroup_list slot
    • Side effects: none
    • Exceptions: none
  • $val = $array->array_list() / $inval = $array->array_list($inval) β€” This is the unified setter/getter method for the array_list slot.
    • If $inval is specified, the setter method is invoked, with no parameters, the getter method is invoked.
    • Input parameters: the optional $inval will invoke the setter method.
    • Return value: for both setter and getter the current value of the array_list slot
    • Side effects: none
    • Exceptions: none
  • $val = $array->arraymanufacture_list() / $inval = $array->arraymanufacture_list($inval) β€” This is the unified setter/getter method for the arraymanufacture_list slot.
    • If $inval is specified, the setter method is invoked, with no parameters, the getter method is invoked.
    • Input parameters: the optional $inval will invoke the setter method.
    • Return value: for both setter and getter the current value of the arraymanufacture_list slot
    • Side effects: none
    • Exceptions: none
  • $array_ref = $array->getArrayGroup_list() β€” This method handles the list for the "Bio::MAGE::Array::ArrayGroup" class. It returns a reference to an array of the class objects that have been associated with the package instance.
    • This is useful when retrieving data from parsed MAGE-ML file.
  • $array->addArrayGroup(@vals) β€” This method is an interface for adding "Bio::MAGE::Array::ArrayGroup" objects to the "arraygroup_list" list. It is generally used by generic methods such as those in the XMLWriter.
    • Input parameters: the list of values @vals to add to the owner association. NOTE: submitting a single value is permitted.
    • Return value: none
    • Side effects: none
    • Exceptions: will call "croak()" if no input parameters are specified , or if any of the objects in @vals is not a subclass of class "Bio::MAGE::Array::ArrayGroup"
  • $array_ref = $array->getArray_list() β€” This method handles the list for the "Bio::MAGE::Array::Array" class. It returns a reference to an array of the class objects that have been associated with the package instance.
    • This is useful when retrieving data from parsed MAGE-ML file.
  • $array->addArray(@vals) β€” This method is an interface for adding "Bio::MAGE::Array::Array" objects to the "array_list" list. It is generally used by generic methods such as those in the XMLWriter.
    • Input parameters: the list of values @vals to add to the owner association. NOTE: submitting a single value is permitted.
    • Return value: none
    • Side effects: none
    • Exceptions: will call "croak()" if no input parameters are specified , or if any of the objects in @vals is not a subclass of class "Bio::MAGE::Array::Array"
  • $array_ref = $array->getArrayManufacture_list() β€” This method handles the list for the "Bio::MAGE::Array::ArrayManufacture" class. It returns a reference to an array of the class objects that have been associated with the package instance.
    • This is useful when retrieving data from parsed MAGE-ML file.
  • $array->addArrayManufacture(@vals) β€” This method is an interface for adding "Bio::MAGE::Array::ArrayManufacture" objects to the "arraymanufacture_list" list. It is generally used by generic methods such as those in the XMLWriter.
    • Input parameters: the list of values @vals to add to the owner association. NOTE: submitting a single value is permitted.
    • Return value: none
    • Side effects: none
    • Exceptions: will call "croak()" if no input parameters are specified , or if any of the objects in @vals is not a subclass of class "Bio::MAGE::Array::ArrayManufacture"
  • $array->obj2xml($writer) β€” Write out this object, and all sub-objects, as XML using the supplied $writer to actually do the XML formatting.
    • Input parameters: $writer must be an XML writer, e.g. an instance of Bio::MAGE::XML::Writer. It must have methods: write_start_tag(), write_end_tag(), and obj2xml().
    • Return value: none
    • Side effects: all writing is delegated to the $writer - it's write_start_tag() and write_end_tag() methods are invoked with the appropriate data, and all class sub-objects of the "Bio::MAGE::Array" instance will have their obj2xml() methods invoked in turn. By allowing the $writer to do the actual formatting of the output XML, it enables the user to precisely control the format.
    • Exceptions: will call "croak()" if no identifier has been set for the "Bio::MAGE::Array" instance.
  • $array->register($obj) β€” Store an object for later writing as XML.
    • Input parameters: object to be added to the list of registered objects.
    • Return value: none
    • Side effects: if $obj needs to be stored by this class, a reference will be stored in the correct XML list for this class.
    • Exceptions: none

✨ SLOTS, ATTRIBUTES, AND ASSOCIATIONS ✨

okay bestie so here's the tea 🍡 β€” in the Perl implementation of MAGE-OM classes, there are literally three types of class data members, and you gotta know which is which:

  • slots
  • attributes
  • associations

🧚 SLOTS

So the term "slot" in this API means a data member of the class that was NOT in the UML model β€” it's there for mainly internal purposes. Translation: use only if you understand the inner workings of the API, fr fr. Most often slots get used by generic methods, like the ones in the XML writing and reading classes. iykyk πŸ’…

Slots are implemented using unified getter/setter methods:

  • $var = $obj->slot_name(); β€” grabs the current value of the slot. that's it, that's the whole vibe 🫢
  • $new_var = $obj->slot_name($new_var); β€” stores $new_var in the slot, and the return value is also $new_var (yes, it hands it right back to you, iconic behavior ✨)
  • @names = $obj->get_slot_names() β€” returns the list of all slots in the class. the full roster, no gatekeeping πŸ‘‘
DATA CHECKING: nope, no data type checking is made for these methods. zero vibe checks here 😭

🌸 ATTRIBUTES AND ASSOCIATIONS

The terms "attribute" and "association" mean data members of the class that were specified directly from the UML model. so these are the official ones, not the internal gremlins.

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

  • get* β€” retrieves the current value.
NOTE: for associations, if the association has list cardinality, an array reference is returned. so expect a ref, not a plain list, bestie πŸŽ€
DATA CHECKING: ensure that no argument is provided.
  • set* β€” sets the current value, replacing any existing value. out with the old, in with the new πŸ’…
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. 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 the argument is a reference to an array of instances of the correct MAGE-OM class; otherwise ensure there's a single argument of the correct MAGE-OM class. the type check is real and it will catch you 😀
  • 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. if you don't see it, that's why πŸ¦‹
DATA CHECKING: ensure that all arguments are of the correct MAGE-OM class. every single one. no stragglers 🚨

πŸ‘‘ GENERIC METHODS

The unified base class of all MAGE-OM classes, Bio::MAGE::Base, provides a set of generic methods that will operate on slots, attributes, and associations β€” all of them, no favorites πŸ’–:

$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. (yes, it's giving "go read the other section" but that's literally what it says 🫠)


πŸ› BUGS

Please send bug reports to the project mailing list: (mged-mage 'at' lists 'dot' sf 'dot' net)

like, actually send them. don't just suffer in silence, bestie 😭


πŸ’œ AUTHOR

Jason E. Stewart (jasons 'at' cpan 'dot' org)

the blueprint. the moment. the icon πŸŽ€


🌈 SEE ALSO


and that's the whole page, bestie!! πŸ’–βœ¨ you made it to the end, so proud of you 🫢 this was MAGE::Array(3pm), from perl v5.32.0, dated 2020-11-27 β€” go forth and slay your MAGE-OM classes πŸ‘‘πŸ’