FoscParentage

Returns a FoscParentage.


Description

Parentage of a component.

!!!TODO: incomplete


Attributes Summary

Instance Properties

component The component from which the selection was derived.
components Gets components.
depth Length of proper parentage of component.
isOrphan Is true when component has no parent. Otherwise false.
parent Gets parent. Returns nil when component has no parent.
prolation Gets prolation.
root Root is last component in parentage.
scoreIndex Gets score index.
tupletDepth DEPRECATED

Instance Methods

firstInstanceOf (abjad: get_first)
logicalVoice Gets logical voice of items.


Usage

  1. Example

    a = FoscNote(60, 1/4);
    b = FoscVoice([a]);
    p = FoscParentage(a);
    p.components;
    [ FoscNote(FoscPitch("C4"), FoscDuration(1, 4)), FoscVoice([  ], 'Voice', false) ]


Instance Properties


component

The component from which the selection was derived.

Returns component.

  1. Example

    a = FoscNote(60, 1/4);
    b = FoscVoice([a]);
    p = FoscParentage(a);
    p.component == a;   // true
    true


components

Gets components.

Returns array.

  1. Example

    a = FoscNote(60, 1/4);
    b = FoscVoice([a]);
    p = FoscParentage(a);
    p.components;
    [ FoscNote(FoscPitch("C4"), FoscDuration(1, 4)), FoscVoice([  ], 'Voice', false) ]


depth

Length of proper parentage of component.

Returns integer.

  1. FIXME ERROR: FoscRhythm::new: bad value: FoscNote(C4, 1/1).

    a = FoscNote(60, 1);
    b = FoscContainer([FoscRhythm([3, 4], [a, 2, 1])]);
    p = FoscParentage(a);
    p.depth;


isOrphan

Is true when component has no parent. Otherwise false.

Returns true or false.

  1. Example

    a = FoscNote(60, 1);
    b = FoscVoice([a]);
    p = FoscParentage(a);
    p.isOrphan;         // false
    false
    a = FoscNote(60, 1);
    p = FoscParentage(a);
    p.isOrphan;         // true
    true


parent

Gets parent. Returns nil when component has no parent.

Returns component or nil.

  1. Example

    a = FoscNote(60, 1);
    b = FoscVoice([a]);
    p = FoscParentage(a);
    p.parent === b;     // true
    true
    a = FoscNote(60, 1);
    p = FoscParentage(a);
    p.parent;           // nil


prolation

Gets prolation.

Returns multiplier.

  1. Example

    a = FoscTuplet(2/3, [FoscNote(60, 1/4)]);
    a[0].prGetParentage.prolation.str;
    2/3


root

Root is last component in parentage.

Returns component.

  1. Example

    a = FoscNote(60, 1);
    b = FoscVoice([a]);
    p = FoscParentage(a);
    p.root == b;
    true


scoreIndex

Gets score index.

Returns array of zero or more nonnegative integers.

  1. Example

    a = FoscNote(60, 1);
    b = FoscScore([FoscStaff([FoscVoice([a])])]);
    p = FoscParentage(a);
    p.scoreIndex;
    [ 0, 0, 0 ]
    a.prGetParentage.scoreIndex
    [ 0, 0, 0 ]


tupletDepth

DEPRECATED

  1. Example

    a = FoscNote(60, 1);
    b = FoscRhythm([3, 4], [1, FoscRhythm(3, [1, 2, a])]);
    p = FoscParentage(a);
    p.tupletDepth;


Instance Methods


firstInstanceOf

(abjad: get_first)

Gets first instance of prototype in parentage.

Returns component or none.

  1. FIXME ERROR: Message add not understood.

    a = FoscNote(60, 1);
    b = FoscContainer([c = FoscRhythm([3, 4], [a, 2, 1])]);
    p = FoscParentage(a);
    
    p.firstInstanceOf(FoscNote) === a;          // true
    p.firstInstanceOf(FoscRhythm) === c;        // true
    p.firstInstanceOf(FoscContainer) === b;     // true
    p.firstInstanceOf(FoscRest);                // nil


logicalVoice

Gets logical voice of items.

  1. Example

    a = FoscLeafMaker().(#[60,62,64,65], [1/4]);
    b = FoscVoice(a);
    c = FoscStaff([b], name: 'bar');
    d = FoscScore([c], name: 'foo');
    p = FoscParentage(b[0]);
    l = p.logicalVoice;
    ( 'staff_group': "", 'voice': "FoscVoice-2125999743", 'staff': "FoscStaff-bar", 'score': "FoscScore-foo" )