[Bio] / FigKernelPackages / Tracer.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/Tracer.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.52, Wed Jun 14 01:12:42 2006 UTC revision 1.54, Sun Jun 18 07:40:23 2006 UTC
# Line 1348  Line 1348 
1348      return @inputList;      return @inputList;
1349  }  }
1350    
1351    =head3 Percent
1352    
1353    C<< my $percent = Tracer::Percent($number, $base); >>
1354    
1355    Returns the percent of the base represented by the given number. If the base
1356    is zero, returns zero.
1357    
1358    =over 4
1359    
1360    =item number
1361    
1362    Percent numerator.
1363    
1364    =item base
1365    
1366    Percent base.
1367    
1368    =item RETURN
1369    
1370    Returns the percentage of the base represented by the numerator.
1371    
1372    =back
1373    
1374    =cut
1375    
1376    sub Percent {
1377        # Get the parameters.
1378        my ($number, $base) = @_;
1379        # Declare the return variable.
1380        my $retVal = 0;
1381        # Compute the percent.
1382        if ($base != 0) {
1383            $retVal = $number * 100 / $base;
1384        }
1385        # Return the result.
1386        return $retVal;
1387    }
1388    
1389  =head3 GetFile  =head3 GetFile
1390    
1391  C<< my @fileContents = Tracer::GetFile($fileName); >>  C<< my @fileContents = Tracer::GetFile($fileName); >>
# Line 1606  Line 1644 
1644    
1645  =head3 AddToListMap  =head3 AddToListMap
1646    
1647  C<< Tracer::AddToListMap(\%hash, $key, $value); >>  C<< Tracer::AddToListMap(\%hash, $key, $value1, $value2, ... valueN); >>
1648    
1649  Add a key-value pair to a hash of lists. If no value exists for the key, a singleton list  Add a key-value pair to a hash of lists. If no value exists for the key, a singleton list
1650  is created for the key. Otherwise, the new value is pushed onto the list.  is created for the key. Otherwise, the new value is pushed onto the list.
# Line 1621  Line 1659 
1659    
1660  Key for which the value is to be added.  Key for which the value is to be added.
1661    
1662  =item value  =item value1, value2, ... valueN
1663    
1664  Value to add to the key's value list.  List of values to add to the key's value list.
1665    
1666  =back  =back
1667    
# Line 1631  Line 1669 
1669    
1670  sub AddToListMap {  sub AddToListMap {
1671      # Get the parameters.      # Get the parameters.
1672      my ($hash, $key, $value) = @_;      my ($hash, $key, @values) = @_;
1673      # Process according to whether or not the key already has a value.      # Process according to whether or not the key already has a value.
1674      if (! exists $hash->{$key}) {      if (! exists $hash->{$key}) {
1675          $hash->{$key} = [$value];          $hash->{$key} = [@values];
1676      } else {      } else {
1677          push @{$hash->{$key}}, $value;          push @{$hash->{$key}}, @values;
1678      }      }
1679  }  }
1680    

Legend:
Removed from v.1.52  
changed lines
  Added in v.1.54

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3