original_string: public function calculate($sampleids, $samplesorigin, $starttime = false, $endtime = false, $existingcalculations = array()) {
  
          if (!PHPUNIT_TEST && CLI_SCRIPT) {
              echo '.';
          }
  
          $calculations = array();
          $newcalculations = array();
          $notnulls = array();
          foreach ($sampleids as $sampleid => $unusedsampleid) {
  
              if (isset($existingcalculations[$sampleid])) {
                  $calculatedvalue = $existingcalculations[$sampleid];
              } else {
                  $calculatedvalue = $this->calculate_sample($sampleid, $samplesorigin, $starttime, $endtime);
                  $newcalculations[$sampleid] = $calculatedvalue;
              }
  
              if (!is_null($calculatedvalue)) {
                  $notnulls[$sampleid] = $sampleid;
                  $this->validate_calculated_value($calculatedvalue);
              }
  
              $calculations[$sampleid] = $calculatedvalue;
          }
  
          $features = $this->to_features($calculations);
  
          return array($features, $newcalculations, $notnulls);
      }
code: public function calculate($sampleids, $samplesorigin, $starttime = false, $endtime = false, $existingcalculations = array()) {
  
          if (!PHPUNIT_TEST && CLI_SCRIPT) {
              echo '.';
          }
  
          $calculations = array();
          $newcalculations = array();
          $notnulls = array();
          foreach ($sampleids as $sampleid => $unusedsampleid) {
  
              if (isset($existingcalculations[$sampleid])) {
                  $calculatedvalue = $existingcalculations[$sampleid];
              } else {
                  $calculatedvalue = $this->calculate_sample($sampleid, $samplesorigin, $starttime, $endtime);
                  $newcalculations[$sampleid] = $calculatedvalue;
              }
  
              if (!is_null($calculatedvalue)) {
                  $notnulls[$sampleid] = $sampleid;
                  $this->validate_calculated_value($calculatedvalue);
              }
  
              $calculations[$sampleid] = $calculatedvalue;
          }
  
          $features = $this->to_features($calculations);
  
          return array($features, $newcalculations, $notnulls);
      }
code_tokens: public function calculate ( $ sampleids , $ samplesorigin , $ starttime = false , $ endtime = false , $ existingcalculations = array ( ) ) { if ( ! PHPUNIT_TEST && CLI_SCRIPT ) { echo '.' ; } $ calculations = array ( ) ; $ newcalculations = array ( ) ; $ notnulls = array ( ) ; foreach ( $ sampleids as $ sampleid => $ unusedsampleid ) { if ( isset ( $ existingcalculations [ $ sampleid ] ) ) { $ calculatedvalue = $ existingcalculations [ $ sampleid ] ; } else { $ calculatedvalue = $ this -> calculate_sample ( $ sampleid , $ samplesorigin , $ starttime , $ endtime ) ; $ newcalculations [ $ sampleid ] = $ calculatedvalue ; } if ( ! is_null ( $ calculatedvalue ) ) { $ notnulls [ $ sampleid ] = $ sampleid ; $ this -> validate_calculated_value ( $ calculatedvalue ) ; } $ calculations [ $ sampleid ] = $ calculatedvalue ; } $ features = $ this -> to_features ( $ calculations ) ; return array ( $ features , $ newcalculations , $ notnulls ) ; }
docstring: Calculates the indicator.
  
  Returns an array of values which size matches $sampleids size.
  
  @param int[] $sampleids
  @param string $samplesorigin
  @param integer $starttime Limit the calculation to this timestart
  @param integer $endtime Limit the calculation to this timeend
  @param array $existingcalculations Existing calculations of this indicator, indexed by sampleid.
  @return array [0] = [$sampleid => int[]|float[]], [1] = [$sampleid => int|float], [2] = [$sampleid => $sampleid]
docstring_tokens: Calculates the indicator .