JsDoc Reference - links.StepNumber

Class Index | File Index

## Classes

- _global_
- links.Filter
- links.Graph3d
- links.Graph3d.Camera
- links.Point2d
- links.Point3d
- links.Slider
- links.StepNumber

# Class links.StepNumber

StepNumber The class StepNumber is an iterator for numbers. You provide a start and end value, and a best step size. StepNumber itself rounds to fixed values and a finds the step that best fits the provided step. If prettyStep is true, the step size is chosen as close as possible to the provided step, but being a round value like 1, 2, 5, 10, 20, 50, .... Example usage: var step = new links.StepNumber(0, 10, 2.5, true); step.start(); while (!step.end()) { alert(step.getCurrent()); step.next(); } Version: 1.0
Defined in: graph3d.js.

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| links.StepNumber(start, end, step, prettyStep)

Method Summary
Method Attributes | Method Name and Description
--- | ---
<static> | links.StepNumber.calculatePrettyStep(step) Calculate a nice step size, closest to the desired step size.
| end() Returns true whether the end is reached
| getCurrent() returns the current value of the step
| getStep() returns the current step size
| next() Do a step, add the step size to the current value
| setRange(start, end, step, prettyStep) Set a new range: start, end and step.
| setStep(step, prettyStep) Set a new step size
| start() Set the current value to the largest value smaller than start, which is a multiple of the step size

Class Detail
links.StepNumber(start, end, step, prettyStep)

Parameters:
{number} start
  The start value
{number} end
  The end value
{number} step
  Optional. Step size. Must be a positive value.
{boolean} prettyStep
  Optional. If true, the step size is rounded To a pretty step size (like 1, 2, 5, 10, 20, 50, ...)

Method Detail
<static> {number} links.StepNumber.calculatePrettyStep(step)
Calculate a nice step size, closest to the desired step size. Returns a value in one of the ranges 1*10^n, 2*10^n, or 5*10^n, where n is an integer number. For example 1, 2, 5, 10, 20, 50, etc...

Parameters:
{number} step
  Desired step size

Returns:
  {number} Nice step size

{boolean} end()
Returns true whether the end is reached

Returns:
  {boolean} True if the current value has passed the end value.

{number} getCurrent()
returns the current value of the step

Returns:
  {number} current value

{number} getStep()
returns the current step size

Returns:
  {number} current step size

next()
Do a step, add the step size to the current value

setRange(start, end, step, prettyStep)
Set a new range: start, end and step.

Parameters:
{number} start
  The start value
{number} end
  The end value
{number} step
  Optional. Step size. Must be a positive value.
{boolean} prettyStep
  Optional. If true, the step size is rounded To a pretty step size (like 1, 2, 5, 10, 20, 50, ...)

setStep(step, prettyStep)
Set a new step size

Parameters:
{number} step
  New step size. Must be a positive value
{boolean} prettyStep
  Optional. If true, the provided step is rounded to a pretty step size (like 1, 2, 5, 10, 20, 50, ...)

start()
Set the current value to the largest value smaller than start, which is a multiple of the step size

Documentation generated by JsDoc Toolkit 2.3.2 on Thu May 03 2012 16:42:48 GMT+0200 (CEST)