### iterator for a toolsarray class

sub new {
    my ($class, $toolsarray) = @_; ### NOTE, bytesarray class

    $self = { $array => \$toolsarray, };

    bless $self, $class;

}

sub hasNext {
    my $self = shift;

    if(${$self->{array}}->index >= ${$self->{array}}->length) {
	return 0; ### false
    } else {
	return 1;
    }
}

sub curent {
    my $self = shift;

    return ${$self->{array}}[${$self->array}}->index -1];
}

sub next {
    my $self = shift;

    if (${$self->{array}}->length < ${$self->{array}}->index
	&& $self->{array}->length > 0) {

	${$self->{array}}->index++;
	
	return ${$self->{array}}->base[${$self->{array}}->index - 1];

    } else {

	return undef;

    }
};

1;
