# ***********************************************
# 
# !!!! DO NOT EDIT !!!!
# 
# This file was auto-generated by Build.PL.
# 
# ***********************************************
# 
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

=encoding utf8

=head1 NAME

Clownfish::Vector - Variable-sized array.

=head1 SYNOPSIS

    my $vector = Clownfish::Vector->new;
    $vector->store($tick, $value);
    my $value = $vector->fetch($tick);

=head1 DESCRIPTION

=head1 CONSTRUCTORS

=head2 new

    my $vector = Clownfish::Vector->new(
        capacity => $capacity,  # default: 0
    );

Return a new Vector.

=over

=item *

B<capacity> - Initial number of elements that the object will be able
to hold before reallocation.

=back

=head1 METHODS

=head2 push

    $vector->push($element);
    $vector->push();  # default: undef

Push an item onto the end of a Vector.

=head2 push_all

    $vector->push_all($other);

Push all the elements of another Vector onto the end of this one.

=head2 pop

    my $obj = $vector->pop();

Pop an item off of the end of a Vector.

Returns: the element or undef if the Vector is empty.

=head2 insert

    $vector->insert(
        tick    => $tick,     # required
        element => $element,  # default: undef
    );

Insert an element at C<tick> moving the following elements.

=head2 insert_all

    $vector->insert_all(
        tick  => $tick,   # required
        other => $other,  # required
    );

Inserts elements from C<other> vector at C<tick> moving the following
elements.

=head2 fetch

    my $obj = $vector->fetch($tick);

Fetch the element at C<tick>.

Returns: the element or undef if C<tick> is out of bounds.

=head2 store

    $vector->store($tick, $elem)

Store an element at index C<tick>, possibly displacing an existing element.

=head2 delete

    my $obj = $vector->delete($tick);

Replace an element in the Vector with undef and return it.

Returns: the element stored at C<tick> or undef if C<tick> is out of
bounds.

=head2 excise

    $vector->excise(
        offset => $offset,  # required
        length => $length,  # required
    );

Remove C<length> elements from the Vector, starting at C<offset>.
Move elements over to fill in the gap.

=head2 clone

    my $arrayref = $vector->clone();

Clone the Vector but merely increment the refcounts of its elements
rather than clone them.

=head2 sort

    $vector->sort();

Sort the Vector.  Sort order is guaranteed to be I<stable>: the
relative order of elements which compare as equal will not change.

=head2 resize

    $vector->resize($size);

Set the size for the Vector.  If the new size is larger than the
current size, grow the object to accommodate undef elements; if
smaller than the current size, decrement and discard truncated elements.

=head2 clear

    $vector->clear();

Empty the Vector.

=head2 get_size

    my $int = $vector->get_size();

Return the size of the Vector.

=head2 slice

    my $arrayref = $vector->slice(
        offset => $offset,  # required
        length => $length,  # required
    );

Return a slice of the Vector consisting of elements from a contiguous
range.  If the specified range is out of bounds, return a slice with
fewer elements – potentially none.

=over

=item *

B<offset> - The index of the element to start at.

=item *

B<length> - The maximum number of elements to slice.

=back

=head1 INHERITANCE

Clownfish::Vector isa L<Clownfish::Obj>.

=cut