documentation/EntityList.html

Summary

Maintainability
Test Coverage
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Class: EntityList - Documentation</title>

    <script src="scripts/prettify/prettify.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">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc-miew.css">
</head>

<body>

<div id="main">
    <h1 class="page-title">Class: EntityList</h1>

    




<section>

<header>
    
        <h2>EntityList</h2>
        
            <div class="class-description"><p>An indexed list of objects or classes.</p></div>
        
    
</header>

<article>
    <div class="container-overview">
    
        

    
    <h2>Constructor</h2>
    

    <h4 class="name" id="EntityList"><span class="type-signature"></span>new EntityList<span class="signature">(entities<span class="signature-attributes">opt, non-null</span>, indices<span class="signature-attributes">opt, non-null</span>)</span><span class="type-signature"></span></h4>

    



<div class="description">
    <p>Create a list of objects.
The objects can be indexed by one or more properties for the later retrieval.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>entities</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array.&lt;Object></span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>A list of objects to automatically register at creation time.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>indices</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array.&lt;string></span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>A list of property names to use for case-insensitive indexing.
By default, a single <code>.id</code> property is used.</p></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="EntityList.html#register">EntityList#register</a></li>
        </ul>
    </dd>
    

    
</dl>
















    
    </div>

    

    

    

     

    

    
        <h3 class="subsection-title">Members</h3>

        
            
<h4 class="name" id="all"><span class="type-signature">(non-null) </span>all<span class="type-signature"> :Array.&lt;Object></span></h4>




<div class="description">
    <p>An ordered list of all registered entities.
It is a read-only copy, use <a href="EntityList.html#register"><code>EntityList#register</code></a> and <a href="EntityList.html#unregister"><code>EntityList#unregister</code></a>
to modify it.</p>
</div>







<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>






        
            
<h4 class="name" id="first"><span class="type-signature"></span>first<span class="type-signature"> :Object</span></h4>




<div class="description">
    <p>The first registered entity.
Use it if you do not care which entity you are referring to.</p>
</div>







<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>






        
    

    
        <h3 class="subsection-title">Methods</h3>

        
            

    

    <h4 class="name" id=".registerInDict"><span class="type-signature">(static) </span>registerInDict<span class="signature">(dict<span class="signature-attributes">non-null</span>, keys<span class="signature-attributes">non-null</span>, value)</span><span class="type-signature"></span></h4>

    



<div class="description">
    <p>Add a value to a dictionary.
The value may be stored under multiple different keys (aliases).
There might be multiples values stored under the same key.</p>
</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>dict</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object.&lt;string, *></span>


            
            </td>

            

            

            <td class="description last"><p>A dictionary.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>keys</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array.&lt;string></span>


            
            </td>

            

            

            <td class="description last"><p>An array of keys.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>value</code></td>
            

            <td class="type">
            
                
<span class="param-type">*</span>


            
            </td>

            

            

            <td class="description last"><p>A value to add.</p></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="EntityList.html#.unregisterFromDict">EntityList.unregisterFromDict</a></li>
        
            <li><a href="EntityList.html#.registerInList">EntityList.registerInList</a></li>
        </ul>
    </dd>
    

    
</dl>
















        
            

    

    <h4 class="name" id=".registerInList"><span class="type-signature">(static) </span>registerInList<span class="signature">(list<span class="signature-attributes">non-null</span>, value)</span><span class="type-signature"></span></h4>

    



<div class="description">
    <p>Add a value to the end of a list.
The list will contain only one copy of the value.</p>
</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>list</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array</span>


            
            </td>

            

            

            <td class="description last"><p>An array.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>value</code></td>
            

            <td class="type">
            
                
<span class="param-type">*</span>


            
            </td>

            

            

            <td class="description last"><p>A value to add.</p></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="EntityList.html#.unregisterFromList">EntityList.unregisterFromList</a></li>
        
            <li><a href="EntityList.html#.registerInDict">EntityList.registerInDict</a></li>
        </ul>
    </dd>
    

    
</dl>
















        
            

    

    <h4 class="name" id=".unregisterFromDict"><span class="type-signature">(static) </span>unregisterFromDict<span class="signature">(dict<span class="signature-attributes">non-null</span>, keys<span class="signature-attributes">non-null</span>, value)</span><span class="type-signature"></span></h4>

    



<div class="description">
    <p>Remove a value from a dictionary.
The value may be stored under multiple different keys (aliases).
There might be multiples values stored under the same key.</p>
</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>dict</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object.&lt;string, *></span>


            
            </td>

            

            

            <td class="description last"><p>A dictionary.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>keys</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array.&lt;string></span>


            
            </td>

            

            

            <td class="description last"><p>An array of keys.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>value</code></td>
            

            <td class="type">
            
                
<span class="param-type">*</span>


            
            </td>

            

            

            <td class="description last"><p>A value to add.</p></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="EntityList.html#.registerInDict">EntityList.registerInDict</a></li>
        </ul>
    </dd>
    

    
</dl>
















        
            

    

    <h4 class="name" id=".unregisterFromList"><span class="type-signature">(static) </span>unregisterFromList<span class="signature">(list<span class="signature-attributes">non-null</span>, value)</span><span class="type-signature"></span></h4>

    



<div class="description">
    <p>Remove a value from a list if it is there.</p>
</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>list</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array</span>


            
            </td>

            

            

            <td class="description last"><p>An array.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>value</code></td>
            

            <td class="type">
            
                
<span class="param-type">*</span>


            
            </td>

            

            

            <td class="description last"><p>A value to remove.</p></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="EntityList.html#.registerInList">EntityList.registerInList</a></li>
        </ul>
    </dd>
    

    
</dl>
















        
            

    

    <h4 class="name" id="get"><span class="type-signature"></span>get<span class="signature">(key, index<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Object}</span></h4>

    



<div class="description">
    <p>Retrieve an entity by its key.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>key</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            

            <td class="description last"><p>A case-insensitive property value to look-up.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>index</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>One of the indices specified during the list construction. If omitted,
the first of the indices is used.</p></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>













<h5>Returns:</h5>

        
<div class="param-desc">
    <p>An object registered in the index under the key. If there are multiple
objects under the same key, the first one is returned.</p>
</div>



<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Object</span>


    </dd>
</dl>

    



        
            

    

    <h4 class="name" id="keys"><span class="type-signature"></span>keys<span class="signature">(index<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; (non-null) {Array.&lt;string>}</span></h4>

    



<div class="description">
    <p>Retrieve a list of keys for the index.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>index</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>One of the indices specified during the list construction. If omitted,
the first of the indices is used.</p></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>













<h5>Returns:</h5>

        
<div class="param-desc">
    <p>An unordered list of keys in the index, i.e. particular property
values for all registered entities.</p>
</div>



<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Array.&lt;string></span>


    </dd>
</dl>

    



        
            

    

    <h4 class="name" id="register"><span class="type-signature"></span>register<span class="signature">(entity<span class="signature-attributes">non-null</span>)</span><span class="type-signature"></span></h4>

    



<div class="description">
    <p>Add an entity to this list.</p>
</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>entity</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            

            

            <td class="description last"><p>An object or a class to register. The object must include all
properties specified as indices on construction.</p></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="EntityList.html#unregister">EntityList#unregister</a></li>
        </ul>
    </dd>
    

    
</dl>
















        
            

    

    <h4 class="name" id="unregister"><span class="type-signature"></span>unregister<span class="signature">(entity<span class="signature-attributes">non-null</span>)</span><span class="type-signature"></span></h4>

    



<div class="description">
    <p>Remove an entity from this list.</p>
</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>entity</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            

            

            <td class="description last"><p>An object or a class to unregister. The object may be
missing from the list but it must include all properties specified as indices
on construction.</p></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="EntityList.html#register">EntityList#register</a></li>
        </ul>
    </dd>
    

    
</dl>
















        
    

    

    
</article>

</section>




</div>

<nav>
    <h2><a href="index.html">Home</a></h2><h3>Namespaces</h3><ul><li><a href="SettingsObject.html">SettingsObject</a></li></ul><h3>Classes</h3><ul><li><a href="EntityList.html">EntityList</a></li><li><a href="EventDispatcher.html">EventDispatcher</a></li><li><a href="GROParser.html">GROParser</a></li><li><a href="GROReader.html">GROReader</a></li><li><a href="Helix.html">Helix</a></li><li><a href="LoaderList.html">LoaderList</a></li><li><a href="Logger.html">Logger</a></li><li><a href="Miew.html">Miew</a></li><li><a href="ParserList.html">ParserList</a></li><li><a href="PDBStream.html">PDBStream</a></li><li><a href="Strand.html">Strand</a></li><li><a href="StructuralElement.html">StructuralElement</a></li></ul><h3>Tutorials</h3><ul><li><a href="tutorial-embed.html">Embedding the Viewer</a></li><li><a href="tutorial-events.html">events</a></li><li><a href="tutorial-selectors.html">Selection Language</a></li><li><a href="tutorial-url.html">URL Query String</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav>

<br class="clear">

<footer>
    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a> on Thu Dec 16 2021 21:46:09 GMT+0300 (Москва, стандартное время)
</footer>

<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>