IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 8, 2007, 10:39:15 AM (19 years ago)
Author:
Paul Price
Message:

Adding max and min operations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/PS-IPP-Config/lib/PS/IPP/Metadata/Stats.pm

    r14114 r14434  
    11# Copyright (c) 2006  Paul Price, Joshua Hoblitt
    22#
    3 # $Id: Stats.pm,v 1.22 2007-07-11 01:18:03 eugene Exp $
     3# $Id: Stats.pm,v 1.23 2007-08-08 20:39:15 price Exp $
    44
    55package PS::IPP::Metadata::Stats;
     
    146146            }
    147147        }
     148
     149        if ($type eq "max") {
     150            if (scalar @$data > 0) {
     151                # Get statistics on the value
     152                my $stats = Statistics::Descriptive::Sparse->new(); # Statistics calculator
     153                $stats->add_data(@$data);
     154                $entry->{value} = $stats->max();
     155            } else {
     156                $self->_null_for_type ($entry);
     157            }
     158        }
     159
     160        if ($type eq "min") {
     161            if (scalar @$data > 0) {
     162                # Get statistics on the value
     163                my $stats = Statistics::Descriptive::Sparse->new(); # Statistics calculator
     164                $stats->add_data(@$data);
     165                $entry->{value} = $stats->min();
     166            } else {
     167                $self->_null_for_type ($entry);
     168            }
     169        }
     170
    148171    }
    149172
Note: See TracChangeset for help on using the changeset viewer.