MAGE::...:Array(3pm)

πŸ’– NAME πŸ’–

Bio::MAGE::Array::Array β€” bestie, this is a Class for the MAGE-OM API. That's the whole vibe. It's from the User Contributed Perl Documentation manual, section 3pm (iykyk 🫢).


✨ SYNOPSIS ✨

Okay so here's how you actually use her. No cap, this is the exact tea:

use Bio::MAGE::Array::Array

# creating an empty instance
my $array = Bio::MAGE::Array::Array->new();

# creating an instance with existing data
my $array = Bio::MAGE::Array::Array->new(
      arrayXOrigin=>$arrayxorigin_val,
      name=>$name_val,
      arrayYOrigin=>$arrayyorigin_val,
      identifier=>$identifier_val,
      arrayIdentifier=>$arrayidentifier_val,
      originRelativeTo=>$originrelativeto_val,
      arrayGroup=>$arraygroup_ref,
      arrayDesign=>$arraydesign_ref,
      information=>$arraymanufacture_ref,
      auditTrail=>\@audit_list,
      propertySets=>\@namevaluetype_list,
      descriptions=>\@description_list,
      security=>$security_ref,
      arrayManufactureDeviations=>\@arraymanufacturedeviation_list,
);

# 'arrayXOrigin' attribute
my $arrayXOrigin_val = $array->arrayXOrigin(); # getter
$array->arrayXOrigin($value); # setter

# 'name' attribute
my $name_val = $array->name(); # getter
$array->name($value); # setter

# 'arrayYOrigin' attribute
my $arrayYOrigin_val = $array->arrayYOrigin(); # getter
$array->arrayYOrigin($value); # setter

# 'identifier' attribute
my $identifier_val = $array->identifier(); # getter
$array->identifier($value); # setter

# 'arrayIdentifier' attribute
my $arrayIdentifier_val = $array->arrayIdentifier(); # getter
$array->arrayIdentifier($value); # setter

# 'originRelativeTo' attribute
my $originRelativeTo_val = $array->originRelativeTo(); # getter
$array->originRelativeTo($value); # setter

# 'arrayGroup' association
my $arraygroup_ref = $array->arrayGroup(); # getter
$array->arrayGroup($arraygroup_ref); # setter

# 'arrayDesign' association
my $arraydesign_ref = $array->arrayDesign(); # getter
$array->arrayDesign($arraydesign_ref); # setter

# 'information' association
my $arraymanufacture_ref = $array->information(); # getter
$array->information($arraymanufacture_ref); # setter

# 'auditTrail' association
my $audit_array_ref = $array->auditTrail(); # getter
$array->auditTrail(\@audit_list); # setter

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

# 'descriptions' association
my $description_array_ref = $array->descriptions(); # getter
$array->descriptions(\@description_list); # setter

# 'security' association
my $security_ref = $array->security(); # getter
$array->security($security_ref); # setter

# 'arrayManufactureDeviations' association
my $arraymanufacturedeviation_array_ref = $array->arrayManufactureDeviations(); # getter
$array->arrayManufactureDeviations(\@arraymanufacturedeviation_list); # setter

🌸 DESCRIPTION 🌸

Straight from the MAGE-OM documentation for the "Array" class, and I'm quoting her word for word:

The physical substrate along with its features and their annotation

Periodt. That's the whole concept. The physical thing, plus its features, plus the annotation on top. Gorgeous. πŸ’…


πŸ¦‹ INHERITANCE πŸ¦‹

Bio::MAGE::Array::Array has exactly one superclass, and it's giving very main-character:

  • Bio::MAGE::Identifiable

πŸ‘‘ CLASS METHODS πŸ‘‘

Okay bestie, here's the glow-up: every single one of these can be called without making an instance first. Just hit her with the class name, like Bio::MAGE::Array::Array->methodname(). Slay.

πŸ’œ new()

πŸ’œ new(%args)

The object constructor "new()" takes these optional named-value style arguments. Every single one, no skipping:

  • arrayXOrigin β€” Sets the value of the "arrayXOrigin" attribute
  • name β€” Sets the value of the "name" attribute (and heads up, this attribute was inherited from class "Bio::MAGE::Identifiable")
  • arrayYOrigin β€” Sets the value of the "arrayYOrigin" attribute
  • identifier β€” Sets the value of the "identifier" attribute (inherited from class "Bio::MAGE::Identifiable", just so you know)
  • arrayIdentifier β€” Sets the value of the "arrayIdentifier" attribute
  • originRelativeTo β€” Sets the value of the "originRelativeTo" attribute
  • arrayGroup β€” Sets the value of the "arrayGroup" association. The value must be of type: instance of "Bio::MAGE::Array::ArrayGroup".
  • arrayDesign β€” Sets the value of the "arrayDesign" association. The value must be of type: instance of "Bio::MAGE::ArrayDesign::ArrayDesign".
  • auditTrail β€” Sets the value of the "auditTrail" association (inherited from class "Bio::MAGE::Describable"). The value must be of type: array of "Bio::MAGE::AuditAndSecurity::Audit".
  • information β€” Sets the value of the "information" association. The value must be of type: instance of "Bio::MAGE::Array::ArrayManufacture".
  • propertySets β€” Sets the value of the "propertySets" association (inherited from class "Bio::MAGE::Extendable"). The value must be of type: array of "Bio::MAGE::NameValueType".
  • descriptions β€” Sets the value of the "descriptions" association (inherited from class "Bio::MAGE::Describable"). The value must be of type: array of "Bio::MAGE::Description::Description".
  • security β€” Sets the value of the "security" association (inherited from class "Bio::MAGE::Describable"). The value must be of type: instance of "Bio::MAGE::AuditAndSecurity::Security".
  • arrayManufactureDeviations β€” Sets the value of the "arrayManufactureDeviations" association. The value must be of type: array of "Bio::MAGE::Array::ArrayManufactureDeviation".

πŸŽ€ $obj = class->new(%parameters)

The "new()" method is the class constructor. She's the one who builds the whole thing.

  • Parameters: if you hand her a list of name/value parameters, the corresponding slots, attributes, or associations will get their initial values set by the constructor.
  • Return value: a reference to an object of the class. 🫢
  • Side effects: it invokes the "initialize()" method, but only if the class defines one.

πŸŽ€ @names = class->get_slot_names()

The "get_slot_names()" method is how you grab the names of all the slots defined in a given class.

NOTE: the list of names does not include attribute or association names. Don't @ me, that's just what it says.
  • 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. That's it, that's the whole method. πŸ’–

πŸŽ€ @name_list = get_association_names()

Returns the list of association data members for this class. Iconic behaviour.

πŸŽ€ @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. The whole government name.

πŸŽ€ $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 you invoke her with an existing object reference and not a class name, the "new()" method switches into copy-constructor mode β€” the new object's initial values get set to be exactly those of the existing object. Clone behaviour, but make it cute. 🧚

  • Parameters: no input parameters are used in the copy constructor, the initial values are taken directly from the object to be copied.
  • Return value: 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 sets a bunch of slots all at once. She has two totally different invocation methods: the first takes a named parameter list, and the second takes two array references. Pick your fighter.

  • 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 gets the values of a bunch of slots at the same time. Batch mode, bestie.

  • 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

πŸ’œ 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. Two methods per attribute, every time. No shortcuts. πŸ™ˆ

"Bio::MAGE::Array::Array" has the following attribute accessor methods:

🌸 arrayXOrigin

Methods for the "arrayXOrigin" attribute.

From the MAGE-OM documentation:

This can indicate the x position on a slide, chip, etc. of the first Feature and is usually specified relative to the fiducial.

$val = $array->setArrayXOrigin($val)

The restricted setter method for the "arrayXOrigin" attribute.

  • Input parameters: the value to which the "arrayXOrigin" attribute will be set
  • Return value: the current value of the "arrayXOrigin" attribute
  • Side effects: none
  • Exceptions: will call "croak()" if no input parameters are specified, or if too many input parameters are specified

$val = $array->getArrayXOrigin()

The restricted getter method for the "arrayXOrigin" attribute.

  • Input parameters: none
  • Return value: the current value of the "arrayXOrigin" attribute
  • Side effects: none
  • Exceptions: will call "croak()" if any input parameters are specified

🌸 name

Methods for the "name" attribute.

From the MAGE-OM documentation:

The potentially ambiguous common identifier.

$val = $array->setName($val)

The restricted setter method for the "name" attribute.

  • Input parameters: the value to which the name attribute will be set πŸ’–
  • Return value: the current value of the name attribute
  • Side effects: none
  • Exceptions: will call croak() if no input parameters are specified, or if too many input parameters are specified 😀
  • $val = $array->getName() β€” the restricted getter for the name attribute, bestie ✨
    • Input parameters: none
    • Return value: the current value of the name attribute
    • Side effects: none
    • Exceptions: will call croak() if any input parameters are specified πŸ™…β€β™€οΈ

arrayYOrigin 🌸

Methods for the arrayYOrigin attribute, no cap.

From the MAGE-OM documentation:

This can indicate the y position on a slide, chip, etc. of the first Feature and is usually specified relative to the fiducial. 🧚
  • $val = $array->setArrayYOrigin($val) β€” the restricted setter for the arrayYOrigin attribute
    • Input parameters: the value to which the arrayYOrigin attribute will be set
    • Return value: the current value of the arrayYOrigin attribute
    • Side effects: none
    • Exceptions: will call croak() if no input parameters are specified, or if too many input parameters are specified πŸ’€
  • $val = $array->getArrayYOrigin() β€” the restricted getter for the arrayYOrigin attribute
    • Input parameters: none
    • Return value: the current value of the arrayYOrigin attribute
    • Side effects: none
    • Exceptions: will call croak() if any input parameters are specified

identifier πŸŽ€

Methods for the identifier attribute.

From the MAGE-OM documentation:

An identifier is an unambiguous string that is unique within the scope (i.e. a document, a set of related documents, or a repository) of its use. πŸ‘‘
  • $val = $array->setIdentifier($val) β€” the restricted setter for the identifier attribute
    • Input parameters: the value to which the identifier attribute will be set
    • Return value: the current value of the identifier attribute
    • Side effects: none
    • Exceptions: will call croak() if no input parameters are specified, or if too many input parameters are specified 😭
  • $val = $array->getIdentifier() β€” the restricted getter for the identifier attribute
    • Input parameters: none
    • Return value: the current value of the identifier attribute
    • Side effects: none
    • Exceptions: will call croak() if any input parameters are specified

arrayIdentifier πŸ¦‹

Methods for the arrayIdentifier attribute.

From the MAGE-OM documentation:

An identifying string, e.g. a barcode. 🏷️
  • $val = $array->setArrayIdentifier($val) β€” the restricted setter for the arrayIdentifier attribute
    • Input parameters: the value to which the arrayIdentifier attribute will be set
    • Return value: the current value of the arrayIdentifier attribute
    • Side effects: none
    • Exceptions: will call croak() if no input parameters are specified, or if too many input parameters are specified πŸ’…
  • $val = $array->getArrayIdentifier() β€” the restricted getter for the arrayIdentifier attribute
    • Input parameters: none
    • Return value: the current value of the arrayIdentifier attribute
    • Side effects: none
    • Exceptions: will call croak() if any input parameters are specified

originRelativeTo 🌈

Methods for the originRelativeTo attribute.

From the MAGE-OM documentation:

What the array origin is relative to, e.g. upper left corner, fiducial, etc. πŸ“
  • $val = $array->setOriginRelativeTo($val) β€” the restricted setter for the originRelativeTo attribute
    • Input parameters: the value to which the originRelativeTo attribute will be set
    • Return value: the current value of the originRelativeTo attribute
    • Side effects: none
    • Exceptions: will call croak() if no input parameters are specified, or if too many input parameters are specified 🫠
  • $val = $array->getOriginRelativeTo() β€” the restricted getter for the originRelativeTo attribute
    • Input parameters: none
    • Return value: the current value of the originRelativeTo attribute
    • Side effects: none
    • Exceptions: will call croak() if any input parameters are specified

ASSOCIATIONS πŸ”—βœ¨

Okay so associations are references to other classes, like the whole social graph of MAGE-OM. Every association has a cardinality that decides the min and max number of instances of the other class that can be in there. The vibe check:

  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::Array::Array has the following association accessor methods, and yes we're going through all of them:

arrayGroup 🧬

Methods for the arrayGroup association.

From the MAGE-OM documentation:

Association between an ArrayGroup and its Arrays, typically the ArrayGroup will represent a slide and the Arrays will be the manufactured so that they may be hybridized separately on that slide. πŸ”¬
  • $val = $array->setArrayGroup($val) β€” the restricted setter for the arrayGroup association
    • Input parameters: the value to which the arrayGroup association will be set : one of the accepted enumerated values.
    • Return value: the current value of the arrayGroup 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::Array::ArrayGroup 😀
  • $val = $array->getArrayGroup() β€” the restricted getter for the arrayGroup association
    • Input parameters: none
    • Return value: the current value of the arrayGroup association : an instance of type Bio::MAGE::Array::ArrayGroup.
    • Side effects: none
    • Exceptions: will call croak() if any input parameters are specified

arrayDesign πŸ§ͺ

Methods for the arrayDesign association.

From the MAGE-OM documentation:

The association of a physical array with its array design. 🎯
  • $val = $array->setArrayDesign($val) β€” the restricted setter for the arrayDesign association
    • Input parameters: the value to which the arrayDesign association will be set : one of the accepted enumerated values.
    • Return value: the current value of the arrayDesign 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::ArrayDesign::ArrayDesign πŸ’€
  • $val = $array->getArrayDesign() β€” the restricted getter for the arrayDesign association
    • Input parameters: none
    • Return value: the current value of the arrayDesign association : an instance of type Bio::MAGE::ArrayDesign::ArrayDesign.
    • Side effects: none
    • Exceptions: will call croak() if any input parameters are specified

auditTrail πŸ“œ

Methods for the auditTrail association.

From the MAGE-OM documentation:

A list of Audit instances that track changes to the instance of Describable. πŸ‘€
  • $array_ref = $array->setAuditTrail($array_ref) β€” the restricted setter for the auditTrail association
    • Input parameters: the value to which the auditTrail association will be set : a reference to an array of objects of type Bio::MAGE::AuditAndSecurity::Audit
    • Return value: the current value of the auditTrail association : a reference to an array of objects of type Bio::MAGE::AuditAndSecurity::Audit
    • 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::AuditAndSecurity::Audit instances 😭
  • $array_ref = $array->getAuditTrail() β€” the restricted getter for the auditTrail association
    • Input parameters: none
    • Return value: the current value of the auditTrail association : a reference to an array of objects of type Bio::MAGE::AuditAndSecurity::Audit
    • Side effects: none
    • Exceptions: will call croak() if any input parameters are specified
  • $val = $array->addAuditTrail(@vals) β€” because the auditTrail association has list cardinality, it may store more than one value. This method adds the current list of objects in the auditTrail association. πŸ’–
    • Input parameters: the list of values @vals to add to the auditTrail 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::AuditAndSecurity::Audit 🚫

information 🌟

Methods for the information association.

From the MAGE-OM documentation:

Association between the manufactured array and the information on that manufacture. 🏭
  • $val = $array->setInformation($val) β€” the restricted setter for the information association
    • Input parameters: the value to which the information association will be set : one of the accepted enumerated values.

so anyway, back to what setInformation actually hands back to you: πŸ’«

  • Return value: the current value of the information association β€” one of the accepted enumerated values.
  • Side effects: none. truly none. it's giving chill ✨
  • Exceptions: it 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::Array::ArrayManufacture.

$val = $array->getInformation()

The restricted getter for the information association. Look but don't touch, bestie. πŸ‘€

  • Input parameters: none
  • Return value: the current value of the information association β€” an instance of type Bio::MAGE::Array::ArrayManufacture. πŸ‘‘
  • Side effects: none
  • Exceptions: will call croak() if any input parameters are specified

πŸŽ€ 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 = $array->setPropertySets($array_ref)

The restricted setter 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 = $array->getPropertySets()

The restricted getter 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 = $array->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. (yes, one is enough, we love a flexible queen πŸ’…)
  • 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

πŸ¦‹ descriptions πŸ¦‹

Methods for the descriptions association.

From the MAGE-OM documentation:

Free hand text descriptions. Makes available the associations of Description to an instance of Describable.

$array_ref = $array->setDescriptions($array_ref)

The restricted setter for the descriptions association.

  • Input parameters: the value to which the descriptions association will be set β€” a reference to an array of objects of type Bio::MAGE::Description::Description
  • Return value: the current value of the descriptions association β€” a reference to an array of objects of type Bio::MAGE::Description::Description
  • 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::Description::Description instances

$array_ref = $array->getDescriptions()

The restricted getter for the descriptions association.

  • Input parameters: none
  • Return value: the current value of the descriptions association β€” a reference to an array of objects of type Bio::MAGE::Description::Description
  • Side effects: none
  • Exceptions: will call croak() if any input parameters are specified

$val = $array->addDescriptions(@vals)

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

  • Input parameters: the list of values @vals to add to the descriptions 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::Description::Description

πŸ”’ security πŸ”’

Methods for the security association.

From the MAGE-OM documentation:

Information on the security for the instance of the class.

$val = $array->setSecurity($val)

The restricted setter for the security association.

  • Input parameters: the value to which the security association will be set β€” one of the accepted enumerated values.
  • Return value: the current value of the security 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::AuditAndSecurity::Security

$val = $array->getSecurity()

The restricted getter for the security association.

  • Input parameters: none
  • Return value: the current value of the security association β€” an instance of type Bio::MAGE::AuditAndSecurity::Security.
  • Side effects: none
  • Exceptions: will call croak() if any input parameters are specified

🧚 arrayManufactureDeviations 🧚

Methods for the arrayManufactureDeviations association.

From the MAGE-OM documentation:

Association to classes to describe deviations from the ArrayDesign.

$array_ref = $array->setArrayManufactureDeviations($array_ref)

The restricted setter for the arrayManufactureDeviations association.

  • Input parameters: the value to which the arrayManufactureDeviations association will be set β€” a reference to an array of objects of type Bio::MAGE::Array::ArrayManufactureDeviation
  • Return value: the current value of the arrayManufactureDeviations association β€” a reference to an array of objects of type Bio::MAGE::Array::ArrayManufactureDeviation
  • 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::Array::ArrayManufactureDeviation instances

$array_ref = $array->getArrayManufactureDeviations()

The restricted getter for the arrayManufactureDeviations association.

  • Input parameters: none
  • Return value: the current value of the arrayManufactureDeviations association β€” a reference to an array of objects of type Bio::MAGE::Array::ArrayManufactureDeviation
  • Side effects: none
  • Exceptions: will call croak() if any input parameters are specified

$val = $array->addArrayManufactureDeviations(@vals)

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

  • Input parameters: the list of values @vals to add to the arrayManufactureDeviations 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::Array::ArrayManufactureDeviation

and here's initialize, straight from the source, no notes, just vibes 🌈:

sub initialize {

  my $self = shift;
  return 1;

}

🌈 SLOTS, ATTRIBUTES, AND ASSOCIATIONS 🌈

okay bestie listen up, because in the Perl implementation of MAGE-OM classes there are literally three kinds of class data members and you have to know all of them: "slots", "attributes", and "associations". that's the trio. no cap. πŸ’…

πŸŽ€ SLOTS πŸŽ€

so this API uses the word "slot" to mean a data member of the class that was not present in the UML model β€” it's used for mainly internal purposes, so pls pls pls only touch it if you genuinely understand the inner workings of the API. πŸ™ˆ most often 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(); β€” gets you the current value of the slot. that's it, that's the vibe. ✨
  • $new_var = $obj->slot_name($new_var); β€” stores $new_var in the slot, and the return value is also $new_var. so it gives you back exactly what you handed it, iconic behaviour honestly.
  • @names = $obj->get_slot_names() β€” returns the list of all slots in the class. the whole roster. πŸ‘‘
DATA CHECKING: No data type checking is made for these methods. zero. none. it does not check, it does not care, it just vibes. 🫢

πŸ¦‹ ATTRIBUTES AND ASSOCIATIONS πŸ¦‹

the terms "attribute" and "association" are for data members of the class that were specified directly from the UML model. so these ones are the real ones, the main characters. 🌟

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. yes, a reference. not the list itself. 🫠
    • DATA CHECKING: Ensure that no argument is provided. like, don't pass it anything. it said what it said. πŸ’€
  • set* β€” Sets the current value, replacing any existing value. old value? gone. replaced. bye. πŸ‘‹
    • 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. lowkey that's the whole tea. 🍡
    • 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. so yes, the class has to be right. no imposter syndrome classes allowed. πŸ™…
  • add* β€” NOTE: Only present in associations with list cardinality. it doesn't exist anywhere else bestie, don't go looking. πŸ”
    • Appends a list of objects to any values that may already be stored in the association. it's adding to the pile, not replacing the pile. 🧺
    • DATA CHECKING: Ensure that all arguments are of the correct MAGE-OM class. ALL of them. every single one. 😀

🌸 GENERIC METHODS 🌸

the unified base class of all MAGE-OM classes, Bio::MAGE::Base, hands you a set of generic methods that will operate on slots, attributes, and associations. one class to rule them all fr fr:

$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 β€” the details are over there, go look, i'm not retyping the whole thing. 😌


πŸ’€ BUGS πŸ’€

pls send bug reports to the project mailing list: (mged-mage 'at' lists 'dot' sf 'dot' net). we're not scary, we promise. 🫢

πŸ‘‘ AUTHOR πŸ‘‘

Jason E. Stewart (jasons 'at' cpan 'dot' org). the legend. the blueprint. the moment. ✨

🌈 SEE ALSO 🌈


πŸŽ€ POD ERRORS πŸŽ€

hey! so the above document had some coding errors, and they're explained below. not me exposing the typos but okay, transparency era. 😭

  • Around line 484:
    • '=item' outside of any '=over'
  • Around line 569:
    • You forgot a '=back' before '=head2'
  • Around line 1029:
    • Expected '=item 2'
  • Around line 1034:
    • Expected '=item 3'
  • Around line 1039:
    • Expected '=item 4'

and that's a wrap on this page bestie πŸŽ€ this was perl v5.32.0, dated 2020-11-27, straight from the MAGE::...:Array(3pm) manual page. go forth and slay your objects, mwah πŸ’–