<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>

<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage 2.0">
<title>Class DS_INDEXABLE</title>
</head>

<body bgcolor="#FFFFFF">

<table border="0" width="100%">
    <tr>
        <td><font size="6"><strong>Class DS_INDEXABLE</strong></font></td>
        <td align="right"><a href="ds_hash_table_cursor.html"><img
        src="../../image/previous.gif" alt="Previous" border="0"
        width="40" height="40"></a><a
        href="ds_indexable_sorter.html"><img
        src="../../image/next.gif" alt="Next" border="0"
        width="40" height="40"></a></td>
    </tr>
</table>

<hr size="1">

<pre><font color="#000080"><em><strong>note</strong></em></font></pre>

<blockquote>
    <pre><em>description</em>:

<font color="#800000"><em>    &quot;Data structures that can be traversed and %
    %modified through integer access&quot;

</em></font><em>library:    </em><font color="#800000"><em>&quot;Gobo Eiffel Structure Library&quot;
</em></font><em>author:     </em><font color="#800000"><em>&quot;Eric Bezault &lt;</em></font><a
href="mailto:ericb@gobosoft.com"><font color="#800000"><em>ericb@gobosoft.com</em></font></a><font
color="#800000"><em>&gt;&quot;
</em></font><em>copyright:  </em><font color="#800000"><em>&quot;Copyright (c) 1999-2001, Eric Bezault and others&quot;
</em></font><em>license:   </em><font color="#800000"><em> &quot;MIT License&quot;</em></font></pre>
</blockquote>

<pre><font color="#000080"><em><strong>deferred class interface</strong></em></font></pre>

<blockquote>
    <pre><em>DS_INDEXABLE </em>[<em>G</em>]</pre>
</blockquote>

<pre><font color="#000080"><em><strong>inherit</strong></em></font></pre>

<blockquote>
    <pre><a href="ds_sortable.html"><em>DS_SORTABLE</em></a><em> </em>[<em>G</em>]
    <a href="ds_container.html"><em>DS_CONTAINER</em></a><em> </em>[<em>G</em>]</pre>
</blockquote>

<pre><font color="#000080"><em><strong>feature</strong></em></font><em> </em>{<em>NONE</em>}<font
color="#008000"> -- Initialization</font></pre>

<blockquote>
    <pre><a name="make_default"><em>make_default</em></a><em>
</em><font color="#008000">        -- Create an empty container.</font><em>
</em><font color="#008000">        -- (From </font><a
href="ds_container.html#make_default"><font color="#008000"><em>DS_CONTAINER</em></font></a><font
color="#008000">.)</font><em>
</em><font color="#000080"><em><strong>    deferred</strong></em></font><em>
    </em><font color="#000080"><em><strong>ensure</strong></em></font><em>
        empty</em>:<em> </em><a href="#is_empty"><em>is_empty</em></a></pre>
</blockquote>

<pre><font color="#000080"><em><strong>feature</strong></em></font><font
color="#008000"> -- Access</font></pre>

<blockquote>
    <pre><a name="infix_at"><font color="#000080"><em><strong>infix</strong></em></font><em> </em><font
color="#800000"><em>&quot;@&quot;</em></font></a>,<em> </em><a
name="item"><em>item</em></a><em> </em>(<em>i</em>:<em> </em><a
href="http://www.gobosoft.com/eiffel/nice/elks95/integer.html"><em>INTEGER</em></a>):<em> G
        </em><font color="#008000">-- Item at index </font><em>i
    </em><font color="#000080"><em><strong>require</strong></em></font><em>
        valid_index</em>:<em> </em><font color="#808000"><em>1</em></font><em> </em>&lt;=<em> i </em><font
color="#000080"><em><strong>and</strong></em></font><em> i </em>&lt;=<em> </em><a
href="#count"><em>count</em></a><em>
    </em><font color="#000080"><em><strong>deferred</strong></em></font></pre>
    <pre><a name="first"><em>first</em></a>:<em> G
        </em><font color="#008000">-- First item in container</font><em>
    </em><font color="#000080"><em><strong>require</strong></em></font><em>
        not_empty</em>:<em> </em><font color="#000080"><em><strong>not</strong></em></font><em> </em><a
href="#is_empty"><em>is_empty</em></a><em>
    </em><font color="#000080"><em><strong>deferred
    ensure</strong></em></font><em>
        definition</em>:<em> </em><font color="#008080"><em>Result</em></font><em> </em>= <a
href="#item"><em>item</em></a><em> </em>(<font color="#808000"><em>1</em></font>)</pre>
    <pre><a name="last"><em>last</em></a>:<em> G
        </em><font color="#008000">-- Last item in container</font><em>
    </em><font color="#000080"><em><strong>require</strong></em></font><em>
        not_empty</em>:<em> </em><font color="#000080"><em><strong>not</strong></em></font><em> </em><a
href="#is_empty"><em>is_empty</em></a><em>
    </em><font color="#000080"><em><strong>deferred
    ensure</strong></em></font><em>
        definition</em>:<em> </em><font color="#008080"><em>Result</em></font><em> </em>= <a
href="#item"><em>item</em></a><em> </em>(<a href="#count"><em>count</em></a>)</pre>
</blockquote>

<pre><font color="#000080"><em><strong>feature</strong></em></font><font
color="#008000"> -- Measurement</font></pre>

<blockquote>
    <pre><a name="count"><em>count</em></a>:<em> </em><a
href="http://www.gobosoft.com/eiffel/nice/elks95/integer.html"><em>INTEGER</em></a><font
color="#000080"><em><strong>
        </strong></em></font><font color="#008000">-- Number of items in container
        -- (From </font><a href="ds_container.html#count"><font
color="#008000"><em>DS_CONTAINER</em></font></a><font
color="#008000">.)</font><font color="#000080"><em><strong>
    deferred</strong></em></font></pre>
</blockquote>

<pre><font color="#000080"><em><strong>feature</strong></em></font><font
color="#008000"> -- Status report</font></pre>

<blockquote>
    <pre><a name="is_empty"><em>is_empty</em></a>:<em> </em><a
href="http://www.gobosoft.com/eiffel/nice/elks95/boolean.html"><em>BOOLEAN</em></a><font
color="#000080"><em><strong>
       </strong></em></font><font color="#008000"> -- Is container empty?
        -- (From </font><a href="ds_container.html#is_empty"><font
color="#008000"><em>DS_CONTAINER</em></font></a><font
color="#008000">.)</font></pre>
    <pre><a name="extendible"><em>extendible</em></a><em> </em>(<em>n</em>:<em> </em><a
href="http://www.gobosoft.com/eiffel/nice/elks95/integer.html"><em>INTEGER</em></a>):<em> </em><a
href="http://www.gobosoft.com/eiffel/nice/elks95/boolean.html"><em>BOOLEAN</em></a><em>
        </em><font color="#008000">-- May container be extended with </font><em>n</em><font
color="#008000"> items?</font><em>
    </em><font color="#000080"><em><strong>require</strong></em></font><em>
        positive_n</em>:<em> n </em>&gt;=<em> </em><font
color="#808000"><em>0</em></font><em>
</em><font color="#000080"><em><strong>    deferred</strong></em></font></pre>
    <pre><a name="sorted"><em>sorted</em></a><em> </em>(<em>a_sorter: </em><a
href="ds_sorter.html"><em>DS_SORTER</em></a><em> </em>[<em>G</em>]):<em> </em><a
href="http://www.gobosoft.com/eiffel/nice/elks95/boolean.html"><em>BOOLEAN</em></a><em>
        </em><font color="#008000">-- Is container sorted according to </font><em>a_sorter</em><font
color="#008000">'s criterion?
        -- (From </font><a href="ds_sortable.html#sorted"><font
color="#008000"><em>DS_SORTABLE</em></font></a><font
color="#008000">.)</font><em>
    </em><font color="#000080"><em><strong>require</strong></em></font><em>
        a_sorter_not_void</em>:<em> a_sorter </em>/= <font
color="#008080"><em>Void</em></font></pre>
</blockquote>

<pre><font color="#000080"><em><strong>feature</strong></em></font><font
color="#008000"> -- Comparison</font></pre>

<blockquote>
    <pre><a name="is_equal"><em>is_equal</em></a><em> </em>(<em>other</em>:<em> </em><font
color="#000080"><em><strong>like</strong></em></font><em> </em><font
color="#008080"><em>Current</em></font><em>)</em>:<em> </em><a
href="http://www.gobosoft.com/eiffel/nice/elks95/boolean.html"><em>BOOLEAN</em></a><em>
        </em><font color="#008000">-- Is current container equal to </font><em>other</em><font
color="#008000">?</font><em>
        </em><font color="#008000">-- (From </font><a
href="http://www.gobosoft.com/eiffel/nice/elks95/general.html#is_equal"><font
color="#008000"><em>GENERAL</em></font></a><font color="#008000">.)</font><em>
    </em><font color="#000080"><em><strong>require</strong></em></font><em>
        other_not_void</em>:<em> other </em>/=<em> </em><font
color="#008080"><em>Void</em></font><em>
    </em><font color="#000080"><em><strong>deferred</strong></em></font><em>
    </em><font color="#000080"><em><strong>ensure</strong></em></font><em>
        consistent</em>:<em> </em><a
href="http://www.gobosoft.com/eiffel/nice/elks95/general.html#standard_is_equal"><em>standard_is_equal</em></a><em> </em>(<em>other</em>)<em> </em><font
color="#000080"><em><strong>implies</strong></em></font><em> </em><font
color="#008080"><em>Result</em></font><em>
        same_type</em>:<em> </em><font color="#008080"><em>Result</em></font><em> </em><font
color="#000080"><em><strong>implies</strong></em></font><em> </em><a
href="http://www.gobosoft.com/eiffel/nice/elks95/general.html#same_type"><em>same_type</em></a><em> </em>(<em>other</em>)<em>
        symmetric</em>:<em> </em><font color="#008080"><em>Result</em></font><em> </em><font
color="#000080"><em><strong>implies</strong></em></font><em> other</em>.<a
href="#is_equal"><em>is_equal</em></a><em> </em>(<font
color="#008080"><em>Current</em></font>)<em>
        same_count</em>:<em> </em><font color="#008080"><em>Result</em></font><em> </em><font
color="#000080"><em><strong>implies</strong></em></font><em> count </em>=<em> other</em>.<a
href="#count"><em>count</em></a></pre>
</blockquote>

<pre><font color="#000080"><em><strong>feature</strong></em></font> <font
color="#008000">-- Duplication</font></pre>

<blockquote>
    <pre><a name="copy"><em>copy</em></a><em> </em>(<em>other</em>:<em> </em><font
color="#000080"><em><strong>like</strong></em></font><em> </em><font
color="#008080"><em>Current</em></font>)<em>
        </em><font color="#008000">-- Copy </font><em>other</em><font
color="#008000"> to current container.
        -- (From </font><a
href="http://www.gobosoft.com/eiffel/nice/elks95/general.html#copy"><font
color="#008000"><em>GENERAL</em></font></a><font color="#008000">.)</font><em>
    </em><font color="#000080"><em><strong>require</strong></em></font><em>
        other_not_void</em>:<em> other </em>/= <font
color="#008080"><em>Void</em></font><em>
        type_identity</em>:<em> </em><a
href="http://www.gobosoft.com/eiffel/nice/elks95/general.html#same_type"><em>same_type</em></a><em> </em>(<em>other</em>)<em>
    </em><font color="#000080"><em><strong>deferred
    ensure</strong></em></font><em>
        is_equal</em>:<em> </em><a href="#is_equal"><em>is_equal</em></a><em> </em>(<em>other</em>)</pre>
</blockquote>

<pre><font color="#000080"><em><strong>feature</strong></em></font><font
color="#008000"> -- Sort</font></pre>

<blockquote>
    <pre><a name="sort"><em>sort</em></a><em> </em>(<em>a_sorter</em>:<em> </em><a
href="ds_sorter.html"><em>DS_SORTER</em></a><em> </em>[<em>G</em>])<em>
        </em><font color="#008000">-- Sort container using </font><em>a_sorter</em><font
color="#008000">'s algorithm.</font><em>
        </em><font color="#008000">-- (From </font><a
href="ds_sortable.html#sort"><font color="#008000"><em>DS_SORTABLE</em></font></a><font
color="#008000">.)</font><em>
    </em><font color="#000080"><em><strong>require</strong></em></font><em>
        a_sorter_not_void</em>:<em> a_sorter </em>/=<em> </em><font
color="#008080"><em>Void</em></font><em>
    </em><font color="#000080"><em><strong>ensure</strong></em></font><em>
        sorted</em>:<em> </em><a href="#sorted"><em>sorted</em></a><em> </em>(<em>a_sorter</em>)</pre>
</blockquote>

<pre><font color="#000080"><em><strong>feature </strong></em></font><font
color="#008000">-- Element change</font></pre>

<blockquote>
    <pre><a name="put_first"><em>put_first</em></a><em> </em>(<em>v</em>:<em> G</em>)<em>
        </em><font color="#008000">-- Add </font><em>v</em><font
color="#008000"> to beginning of container.</font><em>
    </em><font color="#000080"><em><strong>require</strong></em></font><em>
        extendible</em>:<em> </em><a href="#extendible"><em>extendible</em></a><em> </em>(<font
color="#808000"><em>1</em></font>)<em>
    </em><font color="#000080"><em><strong>deferred</strong></em></font><em>
    </em><font color="#000080"><em><strong>ensure</strong></em></font><em>
        one_more</em>:<em> </em><a href="#count"><em>count</em></a><em> </em>=<em> </em><font
color="#000080"><em><strong>old</strong></em></font><em> </em><a
href="#count"><em>count</em></a><em> </em>+<em> </em><font
color="#808000"><em>1</em></font><em>
        inserted</em>:<em> </em><a href="#first"><em>first</em></a><em> </em>=<em> v</em></pre>
    <pre><a name="put_last"><em>put_last</em></a><em> </em>(<em>v</em>:<em> G</em>)<em>
        </em><font color="#008000">-- Add </font><em>v</em><font
color="#008000"> to end of container.</font><em>
    </em><font color="#000080"><em><strong>require</strong></em></font><em>
        extendible</em>:<em> </em><a href="#extendible"><em>extendible</em></a><em> </em>(<font
color="#808000"><em>1</em></font>)<em>
    </em><font color="#000080"><em><strong>deferred</strong></em></font><em>
    </em><font color="#000080"><em><strong>ensure</strong></em></font><em>
        one_more</em>:<em> </em><a href="#count"><em>count</em></a><em> </em>=<em> </em><font
color="#000080"><em><strong>old</strong></em></font><em> </em><a
href="#count"><em>count</em></a><em> </em>+<em> </em><font
color="#808000"><em>1</em></font><em>
        inserted</em>:<em> </em><a href="#last"><em>last</em></a><em> </em>=<em> v</em></pre>
    <pre><a name="put"><em>put</em></a><em> </em>(<em>v</em>:<em> G</em>;<em> i</em>:<em> </em><a
href="http://www.gobosoft.com/eiffel/nice/elks95/integer.html"><em>INTEGER</em></a>)<em>
        </em><font color="#008000">-- Add </font><em>v</em><font
color="#008000"> at </font><em>i</em><font color="#008000">-th position.</font><em>
    </em><font color="#000080"><em><strong>require</strong></em></font><em>
        extendible</em>:<em> </em><a href="#extendible"><em>extendible</em></a><em> </em>(<font
color="#808000"><em>1</em></font>)<em>
        valid_index</em>:<em> </em><font color="#808000"><em>1</em></font><em> </em>&lt;=<em> i </em><font
color="#000080"><em><strong>and</strong></em></font><em> i </em>&lt;= (<a
href="#count"><em>count</em></a><em> </em>+<em> </em><font
color="#808000"><em>1</em></font>)<em>
    </em><font color="#000080"><em><strong>deferred</strong></em></font><em>
    </em><font color="#000080"><em><strong>ensure</strong></em></font><em>
        one_more</em>:<em> </em><a href="#count"><em>count</em></a><em> </em>=<em> </em><font
color="#000080"><em><strong>old</strong></em></font><em> </em><a
href="#count"><em>count</em></a><em> </em>+<em> </em><font
color="#808000"><em>1</em></font><em>
        inserted</em>:<em> </em><a href="#item"><em>item</em></a><em> </em>(<em>i</em>) =<em> v</em></pre>
    <pre><a name="force_first"><em>force_first</em></a><em> </em>(<em>v</em>: <em>G</em>)<em>
        </em><font color="#008000">-- Add </font><em>v</em><font
color="#008000"> to beginning of container.</font><em>
    </em><font color="#000080"><em><strong>deferred
    ensure</strong></em></font><em>
        one_more</em>:<em> </em><a href="#count"><em>count</em></a><em> </em>= <font
color="#000080"><em><strong>old</strong></em></font><em> </em><a
href="#count"><em>count</em></a><em> </em>+<em> </em><font
color="#808000"><em>1</em></font><em>
        inserted</em>:<em> </em><a href="#first"><em>first</em></a> = <em>v</em></pre>
    <pre><a name="force_last"><em>force_last</em></a><em> </em>(<em>v</em>: <em>G</em>)<em>
        </em><font color="#008000">-- Add </font><em>v</em><font
color="#008000"> to end of container.</font><em>
    </em><font color="#000080"><em><strong>deferred
    ensure</strong></em></font><em>
        one_more</em>:<em> </em><a href="#count"><em>count</em></a><em> </em>= <font
color="#000080"><em><strong>old</strong></em></font><em> </em><a
href="#count"><em>count</em></a><em> </em>+<em> </em><font
color="#808000"><em>1</em></font><em>
        inserted</em>:<em> </em><a href="#last"><em>last</em></a> = <em>v</em></pre>
    <pre><a name="force"><em>force</em></a><em> </em>(<em>v</em>:<em> G</em>;<em> i</em>:<em> </em><a
href="http://www.gobosoft.com/eiffel/nice/elks95/integer.html"><em>INTEGER</em></a>)<em>
        </em><font color="#008000">-- Add </font><em>v</em><font
color="#008000"> at </font><em>i</em><font color="#008000">-th position.</font><em>
    </em><font color="#000080"><em><strong>require</strong></em></font><em>
        valid_index</em>:<em> </em><font color="#808000"><em>1</em></font><em> </em>&lt;= <em>i </em><font
color="#000080"><em><strong>and</strong></em></font><em> i </em>&lt;=<em> </em>(<a
href="#count"><em>count</em></a><em> </em>+<em> </em><font
color="#808000"><em>1</em></font>)<em>
    </em><font color="#000080"><em><strong>deferred
    ensure</strong></em></font><em>
        one_more</em>:<em> </em><a href="#count"><em>count</em></a><em> </em>= <font
color="#000080"><em><strong>old</strong></em></font><em> </em><a
href="#count"><em>count</em></a><em> </em>+<em> </em><font
color="#808000"><em>1</em></font><em>
        inserted</em>:<em> </em><a href="#item"><em>item</em></a><em> </em>(<em>i</em>) =<em> v</em></pre>
    <pre><a name="replace"><em>replace</em></a><em> </em>(<em>v</em>:<em> G</em>;<em> i</em>:<em> </em><a
href="http://www.gobosoft.com/eiffel/nice/elks95/integer.html"><em>INTEGER</em></a>)<em>
        </em><font color="#008000">-- Replace item at </font><em>i</em><font
color="#008000">-th position by </font><em>v</em><font
color="#008000">.</font><em>
    </em><font color="#000080"><em><strong>require</strong></em></font><em>
        valid_index</em>:<em> </em><font color="#808000"><em>1</em></font><em> </em>&lt;=<em> i </em><font
color="#000080"><em><strong>and</strong></em></font><em> i </em>&lt;= <a
href="#count"><em>count</em></a><em>
    </em><font color="#000080"><em><strong>deferred</strong></em></font><em>
    </em><font color="#000080"><em><strong>ensure</strong></em></font><em>
        same_count</em>:<em> </em><a href="#count"><em>count</em></a> = <font
color="#000080"><em><strong>old</strong></em></font><em> </em><a
href="#count"><em>count</em></a><em>
        replaced</em>:<em> </em><a href="#item"><em>item</em></a><em> </em>(<em>i</em>) =<em> v</em></pre>
    <pre><a name="swap"><em>swap</em></a><em> </em>(<em>i</em>,<em> j</em>:<em> </em><a
href="http://www.gobosoft.com/eiffel/nice/elks95/integer.html"><em>INTEGER</em></a>)<em>
        </em><font color="#008000">-- Exchange items at indexes </font><em>i</em><font
color="#008000"> and </font><em>j</em><font color="#008000">.</font><em>
    </em><font color="#000080"><em><strong>require</strong></em></font><em>
        valid_i</em>:<em> </em><font color="#808000"><em>1</em></font><em> </em>&lt;=<em> i </em><font
color="#000080"><em><strong>and</strong></em></font><em> i </em>&lt;= <a
href="#count"><em>count</em></a><em>
        valid_j</em>:<em> </em><font color="#808000"><em>1</em></font><em> </em>&lt;=<em> j </em><font
color="#000080"><em><strong>and</strong></em></font><em> j </em>&lt;= <a
href="#count"><em>count</em></a><em>
    </em><font color="#000080"><em><strong>ensure</strong></em></font><em>
        same_count</em>:<em> </em><a href="#count"><em>count</em></a><em> </em>= <font
color="#000080"><em><strong>old</strong></em></font><em> </em><a
href="#count"><em>count</em></a><em>
        new_i</em>:<em> </em><a href="#item"><em>item</em></a><em> </em>(<em>i</em>)<em> </em>=<em> </em><font
color="#000080"><em><strong>old</strong></em></font><em> </em><a
href="#item"><em>item</em></a><em> </em>(<em>j</em>)<em>
        new_j</em>:<em> </em><a href="#item"><em>item</em></a><em> </em>(<em>j</em>) =<em> </em><font
color="#000080"><em><strong>old</strong></em></font><em> </em><a
href="#item"><em>item</em></a><em> </em>(<em>i</em>)</pre>
    <pre><a name="extend_first"><em>extend_first</em></a><em> </em>(<em>other</em>:<em> </em><a
href="ds_linear.html"><em>DS_LINEAR</em></a><em> </em>[<em>G</em>])<em>
        </em><font color="#008000">-- Add items of </font><em>other</em><font
color="#008000"> to beginning of container.
        -- Keep items of </font><em>other</em><font
color="#008000"> in the same order.</font><em>
    </em><font color="#000080"><em><strong>require</strong></em></font><em>
        other_not_void</em>:<em> other</em> /= <font
color="#008080"><em>Void</em></font><em>
        extendible</em>:<em> </em><a href="#extendible"><em>extendible</em></a><em> </em>(<em>other.</em><a
href="ds_linear.html#count"><em>count</em></a>)<em>
    </em><font color="#000080"><em><strong>deferred
    ensure</strong></em></font><em>
        new_count</em>:<em> </em><a href="#count"><em>count</em></a><em> </em>= <font
color="#000080"><em><strong>old</strong></em></font><em> </em><a
href="#count"><em>count</em></a><em> </em>+ <em>other</em>.<a
href="ds_linear.html#count"><em>count</em></a><em>
        same_order</em>:<em> </em>(<font color="#000080"><em><strong>not</strong></em></font><em> other</em>.<a
href="ds_linear.html#is_empty"><em>is_empty</em></a>)<em> </em><font
color="#000080"><em><strong>implies</strong></em></font><em> </em>(<a
href="#first"><em>first</em></a> = <em>other</em>.<a
href="ds_linear.html#first"><em>first</em></a>)</pre>
    <pre><a name="extend_last"><em>extend_last</em></a><em> </em>(<em>other</em>:<em> </em><a
href="ds_linear.html"><em>DS_LINEAR</em></a><em> </em>[<em>G</em>])<em>
        </em><font color="#008000">-- Add items of </font><em>other</em><font
color="#008000"> to end of container.
        -- Keep items of </font><em>other</em><font
color="#008000"> in the same order.</font><em>
    </em><font color="#000080"><em><strong>require</strong></em></font><em>
        other_not_void</em>:<em> other</em> /= <font
color="#008080"><em>Void</em></font><em>
        extendible</em>:<em> </em><a href="#extendible"><em>extendible</em></a><em> </em>(<em>other.</em><a
href="ds_linear.html#count"><em>count</em></a>)<em>
    </em><font color="#000080"><em><strong>deferred
    ensure</strong></em></font><em>
        new_count</em>:<em> </em><a href="#count"><em>count</em></a><em> </em>= <font
color="#000080"><em><strong>old</strong></em></font><em> </em><a
href="#count"><em>count</em></a><em> </em>+ <em>other</em>.<a
href="ds_linear.html#count"><em>count</em></a><em>
        same_order</em>:<em> </em>(<font color="#000080"><em><strong>not</strong></em></font><em> other</em>.<a
href="ds_linear.html#is_empty"><em>is_empty</em></a>)<em> </em><font
color="#000080"><em><strong>implies</strong></em></font><em> </em>(<a
href="#item"><em>item</em></a><em> </em>(<font color="#000080"><em><strong>old</strong></em></font><em> </em><a
href="#count"><em>count</em></a><em> </em>+<em> </em><font
color="#808000"><em>1</em></font>) = <em>other</em>.<a
href="ds_linear.html#first"><em>first</em></a>)</pre>
    <pre><a name="extend"><em>extend</em></a><em> </em>(<em>other</em>:<em> </em><a
href="ds_linear.html"><em>DS_LINEAR</em></a><em> </em>[<em>G</em>];<em> i</em>:<em> </em><a
href="http://www.gobosoft.com/eiffel/nice/elks95/integer.html"><em>INTEGER</em></a>)<em>
        </em><font color="#008000">-- Add items of </font><em>other</em><font
color="#008000"> at </font><em>i</em><font color="#008000">-th position.
        -- Keep items of </font><em>other</em><font
color="#008000"> in the same order.</font><em>
    </em><font color="#000080"><em><strong>require</strong></em></font><em>
        other_not_void</em>:<em> other</em> /= <font
color="#008080"><em>Void</em></font><em>
        extendible</em>:<em> </em><a href="#extendible"><em>extendible</em></a><em> </em>(<em>other.</em><a
href="ds_linear.html#count"><em>count</em></a>)<em>
        valid_index</em>:<em> </em><font color="#808000"><em>1</em></font><em> </em>&lt;= <em>i </em><font
color="#000080"><em><strong>and</strong></em></font><em> i </em>&lt;= (<a
href="#count"><em>count</em></a><em> </em>+<em> </em><font
color="#808000"><em>1</em></font>)<em>
    </em><font color="#000080"><em><strong>deferred
    ensure</strong></em></font><em>
        new_count</em>:<em> </em><a href="#count"><em>count</em></a><em> </em>= <font
color="#000080"><em><strong>old</strong></em></font><em> </em><a
href="#count"><em>count</em></a><em> </em>+ <em>other</em>.<a
href="ds_linear.html#count"><em>count</em></a><em>
        same_order</em>:<em> </em>(<font color="#000080"><em><strong>not</strong></em></font><em> other</em>.<a
href="ds_linear.html#is_empty"><em>is_empty</em></a>)<em> </em><font
color="#000080"><em><strong>implies</strong></em></font><em> </em>(<a
href="#item"><em>item</em></a><em> </em>(<em>i</em>) =<em> other</em>.<a
href="ds_linear.html#first"><em>first</em></a>)</pre>
    <pre><a name="append_first"><em>append_first</em></a><em> </em>(<em>other</em>:<em> </em><a
href="ds_linear.html"><em>DS_LINEAR</em></a><em> </em>[<em>G</em>])<em>
        </em><font color="#008000">-- Add items of </font><em>other</em><font
color="#008000"> to beginning of container.
        -- Keep items of </font><em>other</em><font
color="#008000"> in the same order.</font><em>
    </em><font color="#000080"><em><strong>require</strong></em></font><em>
        other_not_void</em>:<em> other </em>/=<em> </em><font
color="#008080"><em>Void</em></font><em>
    </em><font color="#000080"><em><strong>deferred
    ensure</strong></em></font><em>
        new_count</em>:<em> </em><a href="#count"><em>count</em></a><em> </em>= <font
color="#000080"><em><strong>old</strong></em></font><em> </em><a
href="#count"><em>count</em></a><em> </em>+ <em>other</em>.<a
href="ds_linear.html#count"><em>count</em></a><em>
        same_order</em>:<em> </em>(<font color="#000080"><em><strong>not</strong></em></font><em> other</em>.<a
href="ds_linear.html#is_empty"><em>is_empty</em></a>)<em> </em><font
color="#000080"><em><strong>implies</strong></em></font><em> </em>(<a
href="#first"><em>first</em></a><em> </em>=<em> other</em>.<a
href="ds_linear.html#first"><em>first</em></a>)</pre>
    <pre><a name="append_last"><em>append_last</em></a><em> </em>(<em>other</em>:<em> </em><a
href="ds_linear.html"><em>DS_LINEAR</em></a><em> </em>[<em>G</em>])<em>
        </em><font color="#008000">-- Add items of </font><em>other</em><font
color="#008000"> to end of container.
        -- Keep items of </font><em>other</em><font
color="#008000"> in the same order.</font><em>
    </em><font color="#000080"><em><strong>require</strong></em></font><em>
        other_not_void</em>:<em> other </em>/=<em> </em><font
color="#008080"><em>Void</em></font><em>
    </em><font color="#000080"><em><strong>deferred
    ensure</strong></em></font><em>
        new_count</em>:<em> </em><a href="#count"><em>count</em></a><em> </em>= <font
color="#000080"><em><strong>old</strong></em></font><em> </em><a
href="#count"><em>count</em></a><em> </em>+ <em>other</em>.<a
href="ds_linear.html#count"><em>count</em></a><em>
        same_order</em>:<em> </em>(<font color="#000080"><em><strong>not</strong></em></font><em> other</em>.<a
href="ds_linear.html#is_empty"><em>is_empty</em></a>)<em> </em><font
color="#000080"><em><strong>implies</strong></em></font><em> </em>(<a
href="#item"><em>item</em></a><em> </em>(<font color="#000080"><em><strong>old</strong></em></font><em> </em><a
href="#count"><em>count</em></a> +<em> </em><font color="#808000"><em>1</em></font>) =<em> other</em>.<a
href="ds_linear.html#first"><em>first</em></a>)</pre>
    <pre><a name="append"><em>append</em></a><em> </em>(<em>other</em>:<em> </em><a
href="ds_linear.html"><em>DS_LINEAR</em></a><em> </em>[<em>G</em>];<em> i</em>:<em> </em><a
href="http://www.gobosoft.com/eiffel/nice/elks95/integer.html"><em>INTEGER</em></a>)<em>
        </em><font color="#008000">-- Add items of </font><em>other</em><font
color="#008000"> at </font><em>i</em><font color="#008000">-th position.
        -- Keep items of </font><em>other</em><font
color="#008000"> in the same order.</font><em>
    </em><font color="#000080"><em><strong>require</strong></em></font><em>
        other_not_void</em>:<em> other </em>/=<em> </em><font
color="#008080"><em>Void</em></font><em>
        valid_index</em>:<em> </em><font color="#808000"><em>1</em></font><em> </em>&lt;=<em> i </em><font
color="#000080"><em><strong>and</strong></em></font><em> i </em>&lt;= (<a
href="#count"><em>count</em></a> +<em> </em><font color="#808000"><em>1</em></font>)<em>
    </em><font color="#000080"><em><strong>deferred
    ensure</strong></em></font><em>
        new_count</em>:<em> </em><a href="#count"><em>count</em></a><em> </em>= <font
color="#000080"><em><strong>old</strong></em></font><em> </em><a
href="#count"><em>count</em></a><em> </em>+ <em>other</em>.<a
href="ds_linear.html#count"><em>count</em></a><em>
        same_order</em>:<em> </em>(<font color="#000080"><em><strong>not</strong></em></font><em> other</em>.<a
href="ds_linear.html#is_empty"><em>is_empty</em></a>)<em> </em><font
color="#000080"><em><strong>implies</strong></em></font><em> </em>(<a
href="#item"><em>item</em></a><em> </em>(<em>i</em>) =<em> other</em>.<a
href="ds_linear.html#first"><em>first</em></a>)</pre>
</blockquote>

<pre><font color="#000080"><em><strong>feature</strong></em></font><font
color="#008000"> -- Removal</font></pre>

<blockquote>
    <pre><a name="remove_first"><em>remove_first</em></a><em>
        </em><font color="#008000">-- Remove first item from container.</font><em>
    </em><font color="#000080"><em><strong>require</strong></em></font><em>
        not_empty</em>:<em> </em><font color="#000080"><em><strong>not</strong></em></font><em> </em><a
href="#is_empty"><em>is_empty</em></a><em>
    </em><font color="#000080"><em><strong>deferred
    ensure</strong></em></font><em>
        one_less</em>:<em> </em><a href="#count"><em>count</em></a><em> </em>=<em> </em><font
color="#000080"><em><strong>old</strong></em></font><em> </em><a
href="#count"><em>count</em></a><em> </em>-<em> </em><font
color="#808000"><em>1</em></font></pre>
    <pre><a name="remove_last"><em>remove_last</em></a><em>
        </em><font color="#008000">-- Remove last item from container.</font><em>
    </em><font color="#000080"><em><strong>require</strong></em></font><em>
        not_empty</em>:<em> </em><font color="#000080"><em><strong>not</strong></em></font><em> </em><a
href="#is_empty"><em>is_empty</em></a><em>
    </em><font color="#000080"><em><strong>deferred
    ensure</strong></em></font><em>
        one_less</em>:<em> </em><a href="#count"><em>count</em></a><em> </em>=<em> </em><font
color="#000080"><em><strong>old</strong></em></font><em> </em><a
href="#count"><em>count</em></a><em> </em>-<em> </em><font
color="#808000"><em>1</em></font></pre>
    <pre><a name="remove"><em>remove</em></a><em> </em>(<em>i</em>:<em> </em><a
href="http://www.gobosoft.com/eiffel/nice/elks95/integer.html"><em>INTEGER</em></a>)<em>
        </em><font color="#008000">-- Remove item at </font><em>i</em><font
color="#008000">-th position.</font><em>
    </em><font color="#000080"><em><strong>require</strong></em></font><em>
        not_empty</em>:<em> </em><font color="#000080"><em><strong>not</strong></em></font><em> </em><a
href="#is_empty"><em>is_empty</em></a><em>
        valid_index</em>:<em> </em><font color="#808000"><em>1</em></font><em> </em>&lt;=<em> i </em><font
color="#000080"><em><strong>and</strong></em></font><em> i </em>&lt;= <a
href="#count"><em>count</em></a><em>
    </em><font color="#000080"><em><strong>deferred
    ensure</strong></em></font><em>
        one_less</em>:<em> </em><a href="#count"><em>count</em></a><em> </em>=<em> </em><font
color="#000080"><em><strong>old</strong></em></font><em> </em><a
href="#count"><em>count</em></a><em> </em>-<em> </em><font
color="#808000"><em>1</em></font></pre>
    <pre><a name="prune_first"><em>prune_first</em></a><em> </em>(<em>n</em>:<em> </em><a
href="http://www.gobosoft.com/eiffel/nice/elks95/integer.html"><em>INTEGER</em></a>)<em>
        </em><font color="#008000">-- Remove </font><em>n</em><font
color="#008000"> first items from container.</font><em>
    </em><font color="#000080"><em><strong>require</strong></em></font><em>
        valid_n</em>:<em> </em><font color="#808000"><em>0</em></font> &lt;=<em> n </em><font
color="#000080"><em><strong>and</strong></em></font><em> n </em>&lt;=<em> </em><a
href="#count"><em>count</em></a><em>
    </em><font color="#000080"><em><strong>deferred
    ensure</strong></em></font><em>
        new_count</em>:<em> </em><a href="#count"><em>count</em></a><em> </em>=<em> </em><font
color="#000080"><em><strong>old</strong></em></font><em> </em><a
href="#count"><em>count</em></a><em> </em>- <em>n</em></pre>
    <pre><a name="prune_last"><em>prune_last</em></a><em> </em>(<em>n</em>:<em> </em><a
href="http://www.gobosoft.com/eiffel/nice/elks95/integer.html"><em>INTEGER</em></a>)<em>
        </em><font color="#008000">-- Remove </font><em>n</em><font
color="#008000"> last items from container.</font><em>
</em><font color="#000080"><em><strong>    require</strong></em></font><em>
        valid_n</em>:<em> </em><font color="#808000"><em>0</em></font> &lt;=<em> n </em><font
color="#000080"><em><strong>and</strong></em></font><em> n </em>&lt;=<em> </em><a
href="#count"><em>count</em></a><em>
    </em><font color="#000080"><em><strong>deferred
    ensure</strong></em></font><em>
        new_count</em>:<em> </em><a href="#count"><em>count</em></a><em> </em>=<em> </em><font
color="#000080"><em><strong>old</strong></em></font><em> </em><a
href="#count"><em>count</em></a><em> </em>- <em>n</em></pre>
    <pre><a name="prune"><em>prune</em></a><em> </em>(<em>n</em>:<em> </em><a
href="http://www.gobosoft.com/eiffel/nice/elks95/integer.html"><em>INTEGER</em></a>;<em> i</em>:<em> </em><a
href="http://www.gobosoft.com/eiffel/nice/elks95/integer.html"><em>INTEGER</em></a>)<em>
        </em><font color="#008000">-- Remove </font><em>n</em><font
color="#008000"> items at and after </font><em>i</em><font
color="#008000">-th position.</font><em>
    </em><font color="#000080"><em><strong>require</strong></em></font><em>
        valid_index</em>:<em> </em><font color="#808000"><em>1</em></font><em> </em>&lt;= <em>i </em><font
color="#000080"><em><strong>and</strong></em></font><em> i </em>&lt;=<em> </em><a
href="#count"><em>count</em></a><em>
        valid_n</em>:<em> </em><font color="#808000"><em>0</em></font><em> </em>&lt;=<em> n </em><font
color="#000080"><em><strong>and</strong></em></font><em> n </em>&lt;=<em> </em>(<a
href="#count"><em>count</em></a><em> </em>-<em> i </em>+<em> </em><font
color="#808000"><em>1</em></font>)<em>
    </em><font color="#000080"><em><strong>deferred
    ensure</strong></em></font><em>
        new_count</em>:<em> </em><a href="#count"><em>count</em></a><em> </em>=<em> </em><font
color="#000080"><em><strong>old</strong></em></font><em> </em><a
href="#count"><em>count</em></a><em> </em>- <em>n</em></pre>
    <pre><a name="keep_first"><em>keep_first</em></a><em> </em>(<em>n</em>:<em> </em><a
href="http://www.gobosoft.com/eiffel/nice/elks95/integer.html"><em>INTEGER</em></a>)<em>
        </em><font color="#008000">-- Keep </font><em>n</em><font
color="#008000"> first items in container.</font><em>
    </em><font color="#000080"><em><strong>require</strong></em></font><em>
        valid_n</em>:<em> </em><font color="#808000"><em>0</em></font> &lt;=<em> n </em><font
color="#000080"><em><strong>and</strong></em></font><em> n </em>&lt;=<em> </em><a
href="#count"><em>count</em></a><em>
    </em><font color="#000080"><em><strong>deferred
    ensure</strong></em></font><em>
        new_count</em>:<em> </em><a href="#count"><em>count</em></a><em> </em>=<em> n</em></pre>
    <pre><a name="keep_last"><em>keep_last</em></a><em> </em>(<em>n</em>:<em> </em><a
href="http://www.gobosoft.com/eiffel/nice/elks95/integer.html"><em>INTEGER</em></a>)<em>
        </em><font color="#008000">-- Keep </font><em>n</em><font
color="#008000"> last items in container.</font><em>
    </em><font color="#000080"><em><strong>require</strong></em></font><em>
        valid_n</em>:<em> </em><font color="#808000"><em>0</em></font> &lt;=<em> n </em><font
color="#000080"><em><strong>and</strong></em></font><em> n </em>&lt;=<em> </em><a
href="#count"><em>count</em></a><em>
    </em><font color="#000080"><em><strong>deferred
    ensure</strong></em></font><em>
        new_count</em>:<em> </em><a href="#count"><em>count</em></a><em> </em>=<em> n</em></pre>
    <pre><a name="wipe_out"><em>wipe_out</em></a><em>
        </em><font color="#008000">-- Remove all items from container.
        -- (From </font><a href="ds_container.html#wipe_out"><font
color="#008000"><em>DS_CONTAINER</em></font></a><font
color="#008000">.)</font><em>
    </em><font color="#000080"><em><strong>deferred
    ensure</strong></em></font><em>
        wiped_out</em>:<em> </em><a href="#is_empty"><em>is_empty</em></a></pre>
</blockquote>

<pre><a name="invariant"><font color="#000080"><em><strong>invariant</strong></em></font></a></pre>

<blockquote>
    <pre><em>positive_count</em>:<em> </em><a href="#count"><em>count</em></a><em> </em>&gt;=<em> </em><font
color="#808000"><em>0</em></font><em>
empty_definition</em>:<em> </em><a href="#is_empty"><em>is_empty</em></a><em> </em>= (<a
href="#count"><em>count</em></a><em> </em>=<em> </em><font
color="#808000"><em>0</em></font>)
    <font color="#008000">-- (From </font><a
href="ds_container.html#invariant"><font color="#008000"><em>DS_CONTAINER</em></font></a><font
color="#008000">.)</font></pre>
</blockquote>

<pre><font color="#000080"><em><strong>end</strong></em></font><font
color="#008000"> -- class DS_INDEXABLE</font></pre>

<hr size="1">

<table border="0" width="100%">
    <tr>
        <td><address>
            <font size="2"><b>Copyright © 1999-2001</b></font><font
            size="1"><b>, </b></font><font size="2"><strong>Eric
            Bezault</strong></font><strong> </strong><font
            size="2"><br>
            <strong>mailto:</strong></font><a
            href="mailto:ericb@gobosoft.com"><font size="2">ericb@gobosoft.com</font></a><font
            size="2"><br>
            <strong>http:</strong></font><a
            href="http://www.gobosoft.com"><font size="2">//www.gobosoft.com</font></a><font
            size="2"><br>
            <strong>Last Updated:</strong> 31 March 2001</font><br>
            <!--webbot bot="PurpleText"
            preview="
$Date$
$Revision$"
            -->
        </address>
        </td>
        <td align="right" valign="top"><a
        href="http://www.gobosoft.com"><img
        src="../../image/home.gif" alt="Home" border="0"
        width="40" height="40"></a><a href="index.html"><img
        src="../../image/toc.gif" alt="Toc" border="0" width="40"
        height="40"></a><a href="ds_hash_table_cursor.html"><img
        src="../../image/previous.gif" alt="Previous" border="0"
        width="40" height="40"></a><a
        href="ds_indexable_sorter.html"><img
        src="../../image/next.gif" alt="Next" border="0"
        width="40" height="40"></a></td>
    </tr>
</table>
</body>
</html>
