
Data::Range::Compare::Stream::Iterator::Array - simple array iterator

use Data::Range::Compare::Stream;
use Data::Range::Compare::Stream::Iterator::Array;
my $iterator=Data::Range::Compare::Stream::Iterator::Array->new(
factory_instance=>'Data::Range::Compare::Stream',
);
# create a new range and add it to the iterator
$iterator->create_range(0,0);
my $range=Data::Range::Compare::Stream->new(0,1);
# add a new range from the existing one
$iterator->add_range($range);
$iterator->prepare_for_consolidate_asc;
while($iterator->has_next) {
my $next_range=$iterator->get_next;
}

This module implements Data::Range::Compare::Stream::Iterator::Base and provides an array iterator.
Instance Constructor, all arguments are optional:
factory_instance =>$obj
# defines the object that implements the $obj->factory($start,$end,$data).
# new ranges are constructed from the factory interfcae. If a factory interface
# is not created an instance of Data::Range::Compare::Stream is assumed.
new_from => 'Data::Range::Compare::Stream'
# depricated, but supported
# Defines what class to call new against for $iterator->create_range(x,x,x)
range_list => []
# Defines the array reference used internally
sorted => 0
# Sets the sorted state
autosort => 'prepare_for_consolidate_asc' or 'prepare_for_consolidate_desc'
# Allows for dynamic sort support when has_next is called
Adds $obj to the internal array. This function returns false once $iterator has been sorted
Creates a new range object and adds it to the internal array. This function returns false once $iterator has been sorted.
Sorts the internal array and sets the sorted flag $iterator->has_next returns false until the internal array has been sorted.
Sorts the internal array and sets the sorted flag: $iterator->has_next returns false until the internal array has been sorted.
Used to set the internal array sorted flag
Returns the sorted state
Returns true when the internal array has been sorted and still contains data. If autosrot has been set, then it will return true if the array contains data.
If $iterator->has_next returns true, then the next value from the internal array is returned
Returns the instance name of $iterator
Inserts a range into a the iterator regardless of the "sorted" state. Use with caution!
Returns the prepared state
Prepares the object to be used for iteration.

Data::Range::Compare::Stream::Cookbook

Michael Shipper

As of version 0.001 the Project has been moved to Source-Forge.net
Data Range Compare https://sourceforge.net/projects/data-range-comp/

Copyright 2011 Michael Shipper. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.