NAME
SPVM::FloatList - Continuous dynamic float array
SYNOPSYS
use SPVM::FloatList;
# Create a float list
my $float_list = SPVM::FloatList->new;
# Create a float list with array
my $float_list = SPVM::FloatList->newa([1.5f, 2.5f, 3.5f]);
# Get list length
my $length = $float_list->length;
# Push float value
$float_list->push(3.5f);
# Pop float value.
my $float_value = $float_list->pop;
# Unshift float value.
$float_list->unshift(3.2f);
# Shift float value.
my $float_value = $float_list->shift;
# Set float value.
$float_list->set(2, 3.2f);
# Get float value.
my $float_value = $float_list->get(2);
# Convert SPVM::FloatList to float array.
my $float_array = $float_list->to_array;
DESCRIPTION
SPVM::FloatList is continuous dynamic float array.
CLASS METHODS
new
sub new : SPVM::FloatList ()
Create a new SPVM::FloatList object.
newa
sub newa : SPVM::FloatList ($array : float[])
Create a new SPVM::FloatList object with specific float
array.
INSTANCE METHODS
length
sub length : int ()
Get list length.
push
sub push : void ($self : self, $value : float)
Appending the value to the end of list.
pop
sub pop : float ($self : self)
Pops and returns the last value of the list, shortening the array by one element If there are no elements in the list, exception occur.
unshift
sub unshift : void ($self : self, $value : float)
Appending the value to the top of list.
shift
sub shift : float ($self : self)
Shifts the first value of the list off and returns it, shortening the array by 1 and moving everything down. If there are no elements in the list, exception occur.
set
sub set : void ($self : self, $index : int, $value : float)
Set the value with index.
get
sub get : float ($self : self, $index : int)
Get the value with index.
to_array
sub to_array : float[] ($self : self)
Convert SPVM::FloatList to float array.