MEMO: care about condifion of step, totalLength
189299
function updateValues(id, withoutStep) {
                if (!withoutStep) {
                    margin = (areaLength - totalLength - itemLength) / 2;
                    if (margin < posMin) {
                        margin = (areaLength - itemLength) / 2;
                        totalLength = 0;
                        step++;
                    }
                }
                steps[id] = step;
                margins[step] = $$.isLegendInset ? 10 : margin;
                offsets[id] = totalLength;
                totalLength += itemLength;
            }
342339
function determineStepSize(min, max, unit, capacity) {
	var range = max - min;
	var interval = INTERVALS[unit];
	var milliseconds = interval.size;
	var steps = interval.steps;
	var i, ilen, factor;

	if (!steps) {
		return Math.ceil(range / (capacity * milliseconds));
	}

	for (i = 0, ilen = steps.length; i < ilen; ++i) {
		factor = steps[i];
		if (Math.ceil(range / (milliseconds * factor)) <= capacity) {
			break;
		}
	}

	return factor;
}
163018
def get_steps_branch_len(self, length):
        
        return log(length/self.length, min(self.branches[0][0]))
1209802
def _ensure_length(encoded, min_length, alphabet, guards, values_hash):
    """"""
    len_guards = len(guards)
    guard_index = (values_hash + ord(encoded[0])) % len_guards
    encoded = guards[guard_index] + encoded

    if len(encoded) < min_length:
        guard_index = (values_hash + ord(encoded[2])) % len_guards
        encoded += guards[guard_index]

    split_at = len(alphabet) // 2
    while len(encoded) < min_length:
        alphabet = _reorder(alphabet, alphabet)
        encoded = alphabet[split_at:] + encoded + alphabet[:split_at]
        excess = len(encoded) - min_length
        if excess > 0:
            from_index = excess // 2
            encoded = encoded[from_index:from_index+min_length]

    return encoded
649852
def step_impl(context, max_modified):
    
    assert len(context.buf) == len(context.fuzzed_buf)
    count = number_of_modified_bytes(context.buf, context.fuzzed_buf)
    assert count >= 0
    assert count <= max_modified
585166
public synchronized void recordCommit(int commitLength) {
        Preconditions.checkArgument(commitLength >= 0, "commitLength must be a non-negative number.");

        // Update counters.
        this.commitCount++;
        this.accumulatedLength += commitLength;

        int minCount = this.config.getCheckpointMinCommitCount();
        int countThreshold = this.config.getCheckpointCommitCountThreshold();
        long lengthThreshold = this.config.getCheckpointTotalCommitLengthThreshold();
        if (this.commitCount >= minCount && (this.commitCount >= countThreshold || this.accumulatedLength >= lengthThreshold)) {
            // Reset counters.
            this.commitCount = 0;
            this.accumulatedLength = 0;

            // Invoke callback.
            this.executor.execute(this.createCheckpointCallback);
        }
    }
455505
def _step_end(self, log=True):
        
        if log:
            step_end_time = self.log(u"STEP %d END (%s)" % (self.step_index, self.step_label))
            diff = (step_end_time - self.step_begin_time)
            diff = float(diff.seconds + diff.microseconds / 1000000.0)
            self.step_total += diff
            self.log(u"STEP %d DURATION %.3f (%s)" % (self.step_index, diff, self.step_label))
            self.step_index += 1
1020079
private void checkAndAddLengths(final int... requiredLengths) {
		for( final int length : requiredLengths ) {
			if( length < 0 ) {
				throw new IllegalArgumentException(String.format("required length cannot be negative but was %d",
					length));
			}
			this.requiredLengths.add(length);
		}
	}
141779
def add_step(self, setting, duration):
        
        if len(self._prog_steps) < 10:
            self._prog_steps.append(ProgramStep(self, setting, duration))
        else:
            raise IndexError("Maximum of 10 steps are allowed")
747034
function checkCommitMessage (commitMessage, settings) {
  const {
    summaryMaxLength,
    lineMaxLength,
    patterns = {},
    examples = {}
  } = settings

  const isSummaryValid = commitMessage
    ? commitMessage.split('\n')[0].length <= summaryMaxLength
    : true
  const linesExceedingMaxLength = commitMessage
    .split('\n')
    .slice(1) // skip the summary line
    .reduce((a, l, k) => {
      return l.length > lineMaxLength
        ? a.concat({ n: k + 2, text: l })
        : a
    }, [])
  const isLineLengthValid = linesExceedingMaxLength.length === 0
  const isPatternValid = Object.keys(patterns || {}).some(key => {
    return patterns[key].test(commitMessage)
  })

  let errors = []

  if (!isSummaryValid) {
    errors = errors.concat(
      Object.assign(new Error(`Summary is more than ${summaryMaxLength} characters.`), {
        code: 'ESUMRY'
      })
    )
  }

  if (!isLineLengthValid) {
    errors = errors.concat(
      Object.assign(new Error([
        `The following lines have more than ${lineMaxLength} characters :`,
        `${linesExceedingMaxLength.map(l => 'line ' + l.n + ' : ' + l.text).join('\n')}`
      ].join('\n')), { code: 'ELINES', lines: linesExceedingMaxLength })
    )
  }

  if (!isPatternValid) {
    errors = errors.concat(
      Object.assign(new Error([
        'Commit message doesn\'t follow any message pattern.'
      ].concat(
        Object.keys(examples || {})
          .map(key => ['', `${key}:`].concat(examples[key]))
          .reduce((a, b) => a.concat(b), [])
      ).join('\n')), { code: 'EFRMT' })
    )
  }

  return {
    isSummaryValid,
    isLineLengthValid,
    linesExceedingMaxLength,
    isPatternValid,
    isValid: isSummaryValid && isLineLengthValid && isPatternValid,
    errors
  }
}
779389
function() {
            var prev = steps.indexOf( activeStep ) - 1;
            prev = prev >= 0 ? steps[ prev ] : steps[ steps.length - 1 ];

            return goto( prev );
        }
643908
synchronized void setLength(long length) {
        Preconditions.checkState(!this.sealed, "Cannot increase the length of a sealed SegmentChunk.");
        Preconditions.checkArgument(length >= 0, "length must be a non-negative number.");
        this.length = length;
    }
891418
private boolean validSecondStep(LegStep secondStep, RouteProgress routeProgress) {
    return routeProgress.currentLegProgress().upComingStep() != null
      && routeProgress.currentLegProgress().upComingStep().equals(secondStep);
  }
304900
def length_limits(max_length_limit, length_limit_step):
    """"""
    string_len = len(str(max_length_limit))
    return [
        str(i).zfill(string_len) for i in
        xrange(
            length_limit_step,
            max_length_limit + length_limit_step - 1,
            length_limit_step
        )
    ]
858633
private void handleWarpToTheFuture(final UIContext uic) {

		// Increment the step counter
		StepCountUtil.incrementSessionStep(uic);

		// Get component at end of chain
		WComponent application = getUI();

		// Call handle step error on WApplication
		if (application instanceof WApplication) {
			LOG.warn("The handleStepError method will be called on WApplication.");
			((WApplication) application).handleStepError();
		}
	}
288426
private void setEnabledSteps() {

        // gets the important data
        boolean isAuth = isAuthenticated();
        boolean hasFalseErrors = badIntListBox.getItemCount() > 0;
        int currentStep = getCurrentStep();

        boolean login = true;
        boolean falseErrors = false;
        boolean omissions = false;
        boolean thanks = false;

        if(currentStep == STEP_THANKS) {

            login = falseErrors = omissions = false;
            thanks = true;

        } else if(isAuth) {

            if(hasFalseErrors) {
                falseErrors = true;
            }

            login = omissions = true;

        }

        setIsStepEnabled(STEP_LOGIN, login);
        setIsStepEnabled(STEP_FALSE_ERRORS, falseErrors);
        setIsStepEnabled(STEP_OMISSIONS, omissions);
        setIsStepEnabled(STEP_THANKS, thanks);

    }
717041
function( tmp ) {
      var _length = tmp.val.length;
      return _length === 0 || _length >= tmp.arg || messages.minLength.replace( '{count}', tmp.arg );
    }