Data-EventStream

 view release on metacpan or  search on metacpan

lib/Data/EventStream/Window.pm  view on Meta::CPAN

package Data::EventStream::Window;
use 5.010;
our $VERSION = "0.13";
$VERSION = eval $VERSION;
use Carp;

=head1 NAME

Data::EventStream::Window - Perl extension for event processing

=head1 VERSION

This document describes Data::EventStream::Window version 0.13

=head1 DESCRIPTION

This class represents time window for which aggregator aggregates data.
Normally window objects are passed to aggregators' callbacks and user has no need to build them himself.

=head1 METHODS

=cut

=head2 $class->new

Create a new Window object. L<Data::EventStream> will do it for you.

=cut

sub new {
    my $class = shift;
    my $self  = {@_};
    $self->{count} //= 0;
    croak "events parameter is required" unless $self->{events};
    $self->{start_time} //= 0;
    $self->{end_time}   //= 0;
    return bless $self, $class;
}

=head2 $self->count

Number of events in the window

=cut

sub count { shift->{count} }

=head2 $self->start_time

Window start time

=cut

sub start_time { shift->{start_time} }

=head2 $self->end_time

Window end time

=cut

sub end_time { shift->{end_time} }

=head2 $self->reset_count

Set number of events in window to 0

=cut

sub reset_count {
    shift->{count} = 0;
}

=head2 $self->time_length

Window length in time

=cut



( run in 1.026 second using v1.01-cache-2.11-cpan-39bf76dae61 )