NoteHeadList

digraph InheritanceGraph { graph [bgcolor=transparent, color=lightsteelblue2, fontname=Arial, fontsize=10, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, splines=spline, style="dashed, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=10, height=0, penwidth=2, shape=box, style="filled, rounded", width=0]; edge [color=lightslategrey, penwidth=1]; subgraph "cluster_abjad.core" { graph [label="abjad.core"]; node [color=1]; "abjad.core.NoteHeadList.NoteHeadList" [URL="../api/abjad/core/NoteHeadList.html#abjad.core.NoteHeadList.NoteHeadList", color=black, fontcolor=white, label="Note\nHead\nList", target=_top]; } subgraph "cluster_abjad.system" { graph [label="abjad.system"]; node [color=2]; "abjad.system.AbjadObject.AbjadObject" [URL="../api/abjad/core/../system/AbjadObject.html#abjad.system.AbjadObject.AbjadObject", label="Abjad\nObject", target=_top]; } subgraph "cluster_abjad.utilities" { graph [label="abjad.utilities"]; node [color=3]; "abjad.utilities.TypedCollection.TypedCollection" [URL="../api/abjad/core/../utilities/TypedCollection.html#abjad.utilities.TypedCollection.TypedCollection", label="Typed\nCollection", shape=oval, style=bold, target=_top]; "abjad.utilities.TypedList.TypedList" [URL="../api/abjad/core/../utilities/TypedList.html#abjad.utilities.TypedList.TypedList", label="Typed\nList", target=_top]; "abjad.utilities.TypedCollection.TypedCollection" -> "abjad.utilities.TypedList.TypedList"; } subgraph cluster_builtins { graph [label=builtins]; node [color=4]; "builtins.object" [URL="https://docs.python.org/3.6/library/functions.html#object", label=object, target=_top]; } subgraph "cluster_collections.abc" { graph [label="collections.abc"]; node [color=5]; "collections.abc.Collection" [URL="https://docs.python.org/3.6/library/collections.abc.html#collections.abc.Collection", label=Collection, shape=oval, style=bold, target=_top]; "collections.abc.Container" [URL="https://docs.python.org/3.6/library/collections.abc.html#collections.abc.Container", label=Container, shape=oval, style=bold, target=_top]; "collections.abc.Iterable" [URL="https://docs.python.org/3.6/library/collections.abc.html#collections.abc.Iterable", label=Iterable, shape=oval, style=bold, target=_top]; "collections.abc.MutableSequence" [URL="https://docs.python.org/3.6/library/collections.abc.html#collections.abc.MutableSequence", label="Mutable\nSequence", shape=oval, style=bold, target=_top]; "collections.abc.Reversible" [URL="https://docs.python.org/3.6/library/collections.abc.html#collections.abc.Reversible", label=Reversible, shape=oval, style=bold, target=_top]; "collections.abc.Sequence" [URL="https://docs.python.org/3.6/library/collections.abc.html#collections.abc.Sequence", label=Sequence, shape=oval, style=bold, target=_top]; "collections.abc.Sized" [URL="https://docs.python.org/3.6/library/collections.abc.html#collections.abc.Sized", label=Sized, shape=oval, style=bold, target=_top]; "collections.abc.Collection" -> "collections.abc.Sequence"; "collections.abc.Container" -> "collections.abc.Collection"; "collections.abc.Iterable" -> "collections.abc.Collection"; "collections.abc.Iterable" -> "collections.abc.Reversible"; "collections.abc.Reversible" -> "collections.abc.Sequence"; "collections.abc.Sequence" -> "collections.abc.MutableSequence"; "collections.abc.Sized" -> "collections.abc.Collection"; } "abjad.system.AbjadObject.AbjadObject" -> "abjad.utilities.TypedCollection.TypedCollection"; "abjad.utilities.TypedList.TypedList" -> "abjad.core.NoteHeadList.NoteHeadList"; "builtins.object" -> "abjad.system.AbjadObject.AbjadObject"; "builtins.object" -> "collections.abc.Container"; "builtins.object" -> "collections.abc.Iterable"; "builtins.object" -> "collections.abc.Sized"; "collections.abc.MutableSequence" -> "abjad.utilities.TypedList.TypedList"; }

class abjad.core.NoteHeadList.NoteHeadList(items=None, client=None)

Note-head list.

>>> chord = abjad.Chord([0, 1, 4], (1, 4))
>>> note_heads = abjad.NoteHeadList(
...     client=chord,
...     items=[11, 10, 9],
...     )
>>> abjad.f(note_heads)
abjad.NoteHeadList(
    [
        abjad.NoteHead(
            written_pitch=abjad.NamedPitch("a'"),
            ),
        abjad.NoteHead(
            written_pitch=abjad.NamedPitch("bf'"),
            ),
        abjad.NoteHead(
            written_pitch=abjad.NamedPitch("b'"),
            ),
        ]
    )

Attributes Summary

client Gets client.
extend Extends note-heads.
get Gets note-head by pitch.
pop Pops note-head i.
remove Removes item.

Special methods

(TypedCollection).__contains__(item)

Is true when typed collection contains item.

Returns true or false.

(TypedList).__delitem__(i)

Aliases list.__delitem__().

Returns none.

(TypedCollection).__eq__(argument)

Is true when argument is a typed collection with items that compare equal to those of this typed collection.

Returns true or false.

(AbjadObject).__format__(format_specification='')

Formats Abjad object.

Set format_specification to '' or 'storage'. Interprets '' equal to 'storage'.

Returns string.

(TypedList).__getitem__(argument)

Gets item or slice identified by argument.

Returns item or slice.

(TypedCollection).__hash__()

Hashes typed collection.

Redefined in tandem with __eq__.

(TypedList).__iadd__(argument)

Adds argument in place to typed list.

>>> dynamic_list = abjad.TypedList(item_class=abjad.Dynamic)
>>> dynamic_list.append('ppp')
>>> dynamic_list += ['p', 'mp', 'mf', 'fff']
>>> abjad.f(dynamic_list)
abjad.TypedList(
    [
        abjad.Dynamic('ppp'),
        abjad.Dynamic('p'),
        abjad.Dynamic('mp'),
        abjad.Dynamic('mf'),
        abjad.Dynamic('fff'),
        ],
    item_class=abjad.Dynamic,
    )

Returns typed list.

(TypedCollection).__iter__()

Iterates typed collection.

Returns generator.

(TypedCollection).__len__()

Gets length of typed collection.

Returns nonnegative integer.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.

(TypedList).__reversed__()

Aliases list.__reversed__().

Returns generator.

(TypedList).__setitem__(i, argument)

Sets item i equal to argument.

Sets item:

>>> pitch_list = abjad.TypedList(
...     item_class=abjad.NamedPitch,
...     )
>>> pitch_list.append(0)
>>> pitch_list.append("d'")
>>> pitch_list.append(('e', 4))
>>> pitch_list.append(abjad.NamedPitch("f'"))
>>> pitch_list[-1] = 'gqs,'
>>> abjad.f(pitch_list)
abjad.TypedList(
    [
        abjad.NamedPitch("c'"),
        abjad.NamedPitch("d'"),
        abjad.NamedPitch("e'"),
        abjad.NamedPitch('gqs,'),
        ],
    item_class=abjad.NamedPitch,
    )

Sets slice:

>>> pitch_list[-1:] = ["f'", "g'", "a'", "b'", "c''"]
>>> abjad.f(pitch_list)
abjad.TypedList(
    [
        abjad.NamedPitch("c'"),
        abjad.NamedPitch("d'"),
        abjad.NamedPitch("e'"),
        abjad.NamedPitch("f'"),
        abjad.NamedPitch("g'"),
        abjad.NamedPitch("a'"),
        abjad.NamedPitch("b'"),
        abjad.NamedPitch("c''"),
        ],
    item_class=abjad.NamedPitch,
    )

Returns none.


Methods

(TypedList).append(item)

Appends item to typed list.

>>> integer_list = abjad.TypedList(item_class=int)
>>> integer_list.append('1')
>>> integer_list.append(2)
>>> integer_list.append(3.4)
>>> integer_list[:]
[1, 2, 3]

Returns none.

(MutableSequence).clear() → None -- remove all items from S
(TypedList).count(item)

Gets count of item in typed list.

>>> integer_list = abjad.TypedList(item_class=int)
>>> integer_list.extend([0, 0., '0', 99])
>>> integer_list.count(0)
3
>>> integer_list.count(1)
0
>>> integer_list.count(99)
1

Returns nonnegative integer.

extend(items)

Extends note-heads.

>>> chord = abjad.Chord("<ef'>")
>>> abjad.show(chord) 
>>> note_heads = []
>>> note_head = abjad.NoteHead("cs''")
>>> note_head.tweaks.color = 'blue'
>>> note_heads.append(note_head)
>>> note_head = abjad.NoteHead("f''")
>>> note_head.tweaks.color = 'green'
>>> note_heads.append(note_head)
>>> chord.note_heads.extend(note_heads)
>>> abjad.show(chord) 

Returns note-head.

get(pitch)

Gets note-head by pitch.

Gets note-head by pitch name:

>>> chord = abjad.Chord("<e' cs'' f''>4")
>>> abjad.show(chord) 
>>> note_head = chord.note_heads.get("e'")
>>> note_head.tweaks.color = 'red'
>>> abjad.show(chord) 

Gets note-head by pitch number:

>>> chord = abjad.Chord("<e' cs'' f''>4")
>>> abjad.show(chord) 
>>> note_head = chord.note_heads.get(4)
>>> note_head.tweaks.color = 'red'
>>> abjad.show(chord) 

Raises missing note-head error when chord contains no note-head with pitch.

Raises extra note-head error when chord contains more than one note-head with pitch.

Returns note-head.

(TypedList).index(item)

Gets index of item in typed list.

>>> pitch_list = abjad.TypedList(
...     item_class=abjad.NamedPitch,
...     )
>>> pitch_list.extend(['cqf', "as'", 'b,', 'dss'])
>>> pitch_list.index(abjad.NamedPitch('cqf'))
0
>>> pitch_list.index(abjad.NamedPitch("as'"))
1
>>> pitch_list.index('b,')
2
>>> pitch_list.index('dss')
3

Returns nonnegative integer.

(TypedList).insert(i, item)

Insert item into typed list.

Inserts into typed list.

>>> integer_list = abjad.TypedList(item_class=int)
>>> integer_list.extend(['1', 2, 4.3])
>>> integer_list
TypedList([1, 2, 4], item_class=int)
>>> integer_list.insert(0, '0')
>>> integer_list
TypedList([0, 1, 2, 4], item_class=int)
>>> integer_list.insert(1, '9')
>>> integer_list
TypedList([0, 9, 1, 2, 4], item_class=int)

Returns none.

pop(i=-1)

Pops note-head i.

>>> chord = abjad.Chord("<ef' c'' f''>4")
>>> abjad.show(chord) 
>>> chord.note_heads.pop(1)
NoteHead("c''")
>>> abjad.show(chord) 

Returns note-head.

remove(item)

Removes item.

>>> chord = abjad.Chord("<ef' c'' f''>4")
>>> abjad.show(chord) 
>>> note_head = chord.note_heads[1]
>>> chord.note_heads.remove(note_head)
>>> abjad.show(chord) 
(TypedList).reverse()

Reverses items in typed list.

(TypedList).sort(cmp=None, key=None, reverse=False)

Sorts items in typed list.


Read/write properties

(TypedList).keep_sorted

Is true when typed list keeps items sorted.

Defaults to none.

Set to true, false or none.

Returns true, false or none.


Read-only properties

client

Gets client.

(TypedCollection).item_class

Gets item class of collection.

Collection coerces items according to item_class.

Returns class.

(TypedCollection).items

Gets items in collection.

Returns list.