Bio::DB::GFF::Adaptor memory_iterator
SummaryPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvsRaw content
Summary
Bio::DB::GFF::Adaptor::memory_iterator - iterator for Bio::DB::GFF::Adaptor::memory
Package variables
No package variables defined.
Synopsis
For internal use only
Description
This is an internal module that is used by the Bio::DB::GFF in-memory
adaptor to return an iterator across a sequence feature query. The
object has a single method, next_feature(), that returns the next
feature from the query. The method next_seq() is an alias for
next_feature().
Methods
new
No description
Code
next_feature
No description
Code
Methods description
None available.
Methods code
newdescriptionprevnextTop
sub new {
  my $class = shift;
  my ($data,$callback) = @_;
  my $pos = 0;
  return bless {data     => $data,
		pos      => $pos,
		callback => $callback,
                cache    => []},$class;
  #return bless [$sth,$callback,[]],$class;
}
next_featuredescriptionprevnextTop
sub next_feature {
  my $self = shift;
  return shift @{$self->{cache}} if @{$self->{cache}};

  my $data     = $self->{data} or return;
  my $callback = $self->{callback};

  my $features;
  while (1) {
    my $feature = $data->[$self->{pos}++];
    if ($feature) {
      $features   = $callback->(@{$feature});
      last if $features;
    } else {
      $features = $callback->();
      undef $self->{pos};
      undef $self->{data};
      undef $self->{cache};
      last;
    }
  }
  $self->{cache} = $features or return;
  shift @{$self->{cache}};
}

1;
}
General documentation
BUGSTop
None known yet.
SEE ALSOTop
Bio::DB::GFF,
AUTHORTop
Lincoln Stein <lstein@cshl.org>.
Copyright (c) 2001 Cold Spring Harbor Laboratory.
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.