| 1 | package IDS::Algorithm::Null; | ||
| 2 | use base qw(IDS::Algorithm); | ||
| 3 | $IDS::Algorithm::Null::VERSION = "1.0"; | ||
| 4 | |||
| 5 | =head1 NAME | ||
| 6 | |||
| 7 | IDS::Algorithm::Null - An IDS algorithm that does nothing. Useful for | ||
| 8 | performance testing the I/O system with IDS::Test. | ||
| 9 | |||
| 10 | =head1 SYNOPSIS | ||
| 11 | |||
| 12 | A usage synopsis would go here. Since it is not here, read on. | ||
| 13 | |||
| 14 | =head1 DESCRIPTION | ||
| 15 | |||
| 16 | See IDS::Algorithm.pm docs for any functions not described here. | ||
| 17 | |||
| 18 | =cut | ||
| 19 | |||
| 20 | use strict; | ||
| 21 | use warnings; | ||
| 22 | use Carp qw(cluck carp confess); | ||
| 23 | |||
| 24 | sub param_options { | ||
| 25 | my $self = shift; | ||
| 26 | |||
| 27 | return ( | ||
| 28 | "Null_verbose=i" => \${$self->{"params"}}{"verbose"}, | ||
| 29 | ); | ||
| 30 | } | ||
| 31 | |||
| 32 | sub default_parameters { | ||
| 33 | my $self = shift; | ||
| 34 | |||
| 35 | %{$self->{"params"}} = ( | ||
| 36 | "verbose" => 0, | ||
| 37 | ); | ||
| 38 | } | ||
| 39 | |||
| 40 | sub initialize { | ||
| 41 | my $self = shift; | ||
| 42 | |||
| 43 | return; # nothing to do in a null algorithm | ||
| 44 | } | ||
| 45 | |||
| 46 | sub save { | ||
| 47 | my $self = shift; | ||
| 48 | my $fname = $self->find_fname(shift); | ||
| 49 | defined($fname) && $fname or | ||
| 50 | confess *save{PACKAGE} . "::save missing filename"; | ||
| 51 | my $fh = to_fh($fname, ">"); | ||
| 52 | |||
| 53 | return; # nothing to do in a null algorithm | ||
| 54 | } | ||
| 55 | |||
| 56 | sub load { | ||
| 57 | my $self = shift; | ||
| 58 | my $fname = $self->find_fname(shift); | ||
| 59 | $fname or | ||
| 60 | confess *load{PACKAGE} . "::load missing filename"; | ||
| 61 | my $fh = to_fh($fname, "<"); | ||
| 62 | |||
| 63 | return; # nothing to do in a null algorithm | ||
| 64 | } | ||
| 65 | |||
| 66 | sub test { | ||
| 67 | my $self = shift; | ||
| 68 | my $tokensref = shift or | ||
| 69 | confess "bug: missing tokensref to ", *test{PACKAGE} . "::test"; | ||
| 70 | my $string = shift or | ||
| 71 | confess "bug: missing string to ", *test{PACKAGE} . "::test"; | ||
| 72 | my $instance = shift or | ||
| 73 | confess "bug: missing instance to ", *test{PACKAGE} . "::test"; | ||
| 74 | |||
| 75 | return 0; # nothing to do in a null algorithm | ||
| 76 | } | ||
| 77 | |||
| 78 | sub add { | ||
| 79 | my $self = shift; | ||
| 80 | my $tokensref = shift or | ||
| 81 | confess "bug: missing tokensref to ", *add{PACKAGE} . "::add"; | ||
| 82 | my $string = shift or | ||
| 83 | confess "bug: missing string to ", *add{PACKAGE} . "::add"; | ||
| 84 | my $instance = shift or | ||
| 85 | confess "bug: missing instance to ", *add{PACKAGE} . "::add"; | ||
| 86 | |||
| 87 | return 0; # nothing to do in a null algorithm | ||
| 88 | } | ||
| 89 | |||
| 90 | =head1 AUTHOR INFORMATION | ||
| 91 | |||
| 92 | Copyright 2005-2007, Kenneth Ingham. All rights reserved. | ||
| 93 | |||
| 94 | This library is free software; you can redistribute it and/or modify | ||
| 95 | it under the same terms as Perl itself. | ||
| 96 | |||
| 97 | Address bug reports and comments to: ids_test at i-pi.com. When sending | ||
| 98 | bug reports, please provide the versions of IDS::Test.pm, IDS::Algorithm.pm, | ||
| 99 | IDS::DataSource.pm, the version of Perl, and the name and version of the | ||
| 100 | operating system you are using. Since Kenneth is a PhD student, the | ||
| 101 | speed of the reponse depends on how the research is proceeding. | ||
| 102 | |||
| 103 | =head1 BUGS | ||
| 104 | |||
| 105 | Please report them. | ||
| 106 | |||
| 107 | =head1 SEE ALSO | ||
| 108 | |||
| 109 | L<IDS::Test>, L<IDS::DataSource>, L<IDS::Algorithm> | ||
| 110 | |||
| 111 | =cut | ||
| 112 | |||
| 113 | 1; |