vexflow-musicxml
Version:
MusicXml Parser for vexflow
2,255 lines (596 loc) • 24.8 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: Part</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Class: Part</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>Part<span class="signature">(node)</span><span class="type-signature"></span></h2>
<div class="class-description">Class representation of a part</div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="Part"><span class="type-signature"></span>new Part<span class="signature">(node)</span><span class="type-signature"></span></h4>
<div class="description">
Create a part from an XML node
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>node</code></td>
<td class="type">
<span class="param-type">NodeObject</span>
</td>
<td class="description last">the XML Node representing the part</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="src_xml_Part.js.html">src/xml/Part.js</a>, <a href="src_xml_Part.js.html#line8">line 8</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Extends</h3>
<ul>
<li><a href="XmlObject.html">XmlObject</a></li>
</ul>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="accept"><span class="type-signature"></span>accept<span class="signature">(visitor)</span><span class="type-signature"></span></h4>
<div class="description">
Methods to hook in converters that can use this XML type for formatting
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>visitor</code></td>
<td class="type">
<span class="param-type">Visitor</span>
</td>
<td class="description last">that converts XML to other formats</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="XmlObject.html#accept">XmlObject#accept</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="src_xml_XmlObject.js.html">src/xml/XmlObject.js</a>, <a href="src_xml_XmlObject.js.html#line23">line 23</a>
</li></ul></dd>
</dl>
<h4 class="name" id="childExists"><span class="type-signature"></span>childExists<span class="signature">(name)</span><span class="type-signature"> → {bool}</span></h4>
<div class="description">
childExists - Check if a child exists
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The tag name of the child</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="XmlObject.html#childExists">XmlObject#childExists</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="src_xml_XmlObject.js.html">src/xml/XmlObject.js</a>, <a href="src_xml_XmlObject.js.html#line85">line 85</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
true if child exists, false otherwise
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">bool</span>
</dd>
</dl>
<h4 class="name" id="getAllClefs"><span class="type-signature"></span>getAllClefs<span class="signature">()</span><span class="type-signature"> → {Array}</span></h4>
<div class="description">
Get all clefs in all measure
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="src_xml_Part.js.html">src/xml/Part.js</a>, <a href="src_xml_Part.js.html#line48">line 48</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Array of clefs in all measures
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
<h4 class="name" id="getAllMeasuresWithKeys"><span class="type-signature"></span>getAllMeasuresWithKeys<span class="signature">()</span><span class="type-signature"> → {Key}</span></h4>
<div class="description">
Gets all measures that have keys. This can be used for checking if we still
have the same keys as in the measure before
</div>
<dl class="details">
<dt class="important tag-deprecated">Deprecated:</dt><dd><ul class="dummy"><li>This function will always return all measures because all measures have attributes (with keys)</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="src_xml_Part.js.html">src/xml/Part.js</a>, <a href="src_xml_Part.js.html#line74">line 74</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
A Key class object
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Key</span>
</dd>
</dl>
<h4 class="name" id="getAllStaves"><span class="type-signature"></span>getAllStaves<span class="signature">()</span><span class="type-signature"> → {Array}</span></h4>
<div class="description">
Get the number of all staves in all measures
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="src_xml_Part.js.html">src/xml/Part.js</a>, <a href="src_xml_Part.js.html#line39">line 39</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Array of staves in measure
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
<h4 class="name" id="getAttribute"><span class="type-signature"></span>getAttribute<span class="signature">(name)</span><span class="type-signature"> → {string}</span></h4>
<div class="description">
getAttribute - Gets a string representation of an attribute
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">Attribute name</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="XmlObject.html#getAttribute">XmlObject#getAttribute</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="src_xml_XmlObject.js.html">src/xml/XmlObject.js</a>, <a href="src_xml_XmlObject.js.html#line144">line 144</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Attribute value
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
<h4 class="name" id="getChild"><span class="type-signature"></span>getChild<span class="signature">(name)</span><span class="type-signature"> → {DOMNode}</span></h4>
<div class="description">
getChild - Gets a (usally the first) child by its tag name
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The tag name of the child</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="XmlObject.html#getChild">XmlObject#getChild</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="src_xml_XmlObject.js.html">src/xml/XmlObject.js</a>, <a href="src_xml_XmlObject.js.html#line33">line 33</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
DOM node representation of the child
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">DOMNode</span>
</dd>
</dl>
<h4 class="name" id="getChildren"><span class="type-signature"></span>getChildren<span class="signature">(name)</span><span class="type-signature"> → {DOMNodeList}</span></h4>
<div class="description">
getChildren - Gets all children by its tag name
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The tag name of the child. If empty all children will be given</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="XmlObject.html#getChildren">XmlObject#getChildren</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="src_xml_XmlObject.js.html">src/xml/XmlObject.js</a>, <a href="src_xml_XmlObject.js.html#line43">line 43</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
DOM node list representation of the children
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">DOMNodeList</span>
</dd>
</dl>
<h4 class="name" id="getNotesByStaff"><span class="type-signature"></span>getNotesByStaff<span class="signature">(Number)</span><span class="type-signature"> → {<a href="Note.html">Note</a>}</span></h4>
<div class="description">
Get all the notes belonging to the given staff. The staff number
can be retrieved from getStaves
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>Number</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">of the staff.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="src_xml_Part.js.html">src/xml/Part.js</a>, <a href="src_xml_Part.js.html#line59">line 59</a>
</li></ul></dd>
<dt class="tag-see">See:</dt>
<dd class="tag-see">
<ul>
<li>getStaves</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
A Note class object
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Note.html">Note</a></span>
</dd>
</dl>
<h4 class="name" id="getNum"><span class="type-signature"></span>getNum<span class="signature">(name)</span><span class="type-signature"> → {float}</span></h4>
<div class="description">
getNum - Get the numeric representation of the node. Will return NaN if failed
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The tag name of the child</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="XmlObject.html#getNum">XmlObject#getNum</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="src_xml_XmlObject.js.html">src/xml/XmlObject.js</a>, <a href="src_xml_XmlObject.js.html#line129">line 129</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Value of the node
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">float</span>
</dd>
</dl>
<h4 class="name" id="getSiblings"><span class="type-signature"></span>getSiblings<span class="signature">(name)</span><span class="type-signature"> → {DOMNodeList}</span></h4>
<div class="description">
getSiblings - Gets all siblings by its tag name
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The tag name of the sibling.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="XmlObject.html#getSiblings">XmlObject#getSiblings</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="src_xml_XmlObject.js.html">src/xml/XmlObject.js</a>, <a href="src_xml_XmlObject.js.html#line53">line 53</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
DOM node list representation of the children
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">DOMNodeList</span>
</dd>
</dl>
<h4 class="name" id="getText"><span class="type-signature"></span>getText<span class="signature">(name)</span><span class="type-signature"> → {string}</span></h4>
<div class="description">
getText - Get the string representation of a node's text content
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The tag name of the child</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="XmlObject.html#getText">XmlObject#getText</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="src_xml_XmlObject.js.html">src/xml/XmlObject.js</a>, <a href="src_xml_XmlObject.js.html#line95">line 95</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
string of the text content
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
<h4 class="name" id="getTextArray"><span class="type-signature"></span>getTextArray<span class="signature">(name)</span><span class="type-signature"> → {Arrray}</span></h4>
<div class="description">
getTextArray - Get the strings of the given child tags as array instead of string
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The tag name of the child</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="XmlObject.html#getTextArray">XmlObject#getTextArray</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="src_xml_XmlObject.js.html">src/xml/XmlObject.js</a>, <a href="src_xml_XmlObject.js.html#line112">line 112</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
string array of the text content
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Arrray</span>
</dd>
</dl>
<h4 class="name" id="isFirst"><span class="type-signature"></span>isFirst<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Check if this element is the first in the tag
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="XmlObject.html#isFirst">XmlObject#isFirst</a>
</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="src_xml_XmlObject.js.html">src/xml/XmlObject.js</a>, <a href="src_xml_XmlObject.js.html#line151">line 151</a>
</li></ul></dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Test.html">Test</a></li></ul><h3>Classes</h3><ul><li><a href="ClefVisitor.html">ClefVisitor</a></li><li><a href="Key_Key.html">Key</a></li><li><a href="KeyVisitor.html">KeyVisitor</a></li><li><a href="Measure.html">Measure</a></li><li><a href="MeasureVisitor.html">MeasureVisitor</a></li><li><a href="MusicXmlRenderer.html">MusicXmlRenderer</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteVisitor.html">NoteVisitor</a></li><li><a href="Part.html">Part</a></li><li><a href="TimeSignatureVisitor.html">TimeSignatureVisitor</a></li><li><a href="TimeVisitor.html">TimeVisitor</a></li><li><a href="XmlObject.html">XmlObject</a></li><li><a href="XmlSerializer_XmlSerializer.html">XmlSerializer</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Nov 20 2017 21:30:34 GMT+0100 (CET)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>