Range
Kind of class: | class |
---|---|
Inherits from: | CoreObject |
Version: | 09/10/07 |
Author: | Aaron Clinger |
Classpath: | org.casalib.math.Range |
File last modified: | Monday, 01 December 2008, 13:34:40 |
Creates a standardized way of describing and storing an amount or extent of variation/a value range.
Example:
-
var valueRange:Range = new Range(-100, 100); trace(valueRange.getValueOfPercent(new Percent(.25)));
Summary
Constructor
- Range (startValue:Number, endValue:Number)
- Creates and defines a Range object.
Instance methods
- setRange (startValue:Number, endValue:Number) : Void
- Defines or redefines range.
- getStartValue : Number
- getEndValue : Number
- getMinValue : Number
- getMaxValue : Number
- isWithinRange (value:Number) : Boolean
- Determines if value is included in the range including the range's start and end values.
- getValueOfPercent (percent:Percent) : Number
- Calculates the percent of the range.
- getPercentOfValue (value:Number) : Percent
- Returns the percentage the value represents out of the range.
- equals (range:Range) : Boolean
- Determines whether the range specified by the range parameter is equal to this range object.
- overlaps (range:Range) : Boolean
- Determines whether this range and the range specified by the range parameter overlap.
- contains (range:Range) : Boolean
- Determines whether this range contains the range specified by the range parameter.
- clone : Range
- destroy : Void
Instance methods inherited from CoreObject
Constructor
Range
function Range (
startValue:Number,
endValue:Number)
Creates and defines a Range object.
Parameters:
startValue:
[optional] Beginning value of the range.
endValue :
[optional] Ending value of the range.
Usage note:
- You are not required to define the range in the contructor you can do it at any point by calling setRange.
Instance methods
contains
Determines whether this range contains the range specified by the
range
parameter. Parameters:
A:
defined Range object.
Returns:
- Returns
true
if this range contains all values of the range specified; otherwisefalse
.
equals
Determines whether the range specified by the
range
parameter is equal to this range object. Parameters:
percent:
A defined Range object.
Returns:
- Returns
true
if ranges are identical; otherwisefalse
.
getEndValue
function getEndValue (
) : Number
getMaxValue
function getMaxValue (
) : Number
Returns:
- Returns the maximum value of the range.
getMinValue
function getMinValue (
) : Number
Returns:
- Returns the minimum value of the range.
getPercentOfValue
Returns the percentage the value represents out of the range.
Parameters:
value:
An integer.
Returns:
- A Percent object.
getStartValue
function getStartValue (
) : Number
getValueOfPercent
Calculates the percent of the range.
Parameters:
percent:
A defined Percent object.
Returns:
- The value the percent represent of the range.
isWithinRange
function isWithinRange (
value:Number) : Boolean
Determines if value is included in the range including the range's start and end values.
Returns:
- Returns
true
if value was included in range; otherwisefalse
.
overlaps
Determines whether this range and the range specified by the
range
parameter overlap. Parameters:
A:
defined Range object.
Returns:
- Returns
true
if this range contains any value of the range specified; otherwisefalse
.
setRange
function setRange (
startValue:Number,
endValue:Number) : Void
Defines or redefines range.
Parameters:
startValue:
Beginning value of the range.
endValue :
Ending value of the range.