Range
| Kind of class: | public class |
|---|---|
| Package: | org.casalib.math |
| Inherits from: | none |
| Version: | 10/19/08 |
| Author: | Aaron Clinger, Mike Creighton |
| Classpath: | org.casalib.math.Range |
| File last modified: | Thursday, 19 February 2009, 11:33:36 |
Creates a standardized way of describing and storing an extent of variation/a value range.
Summary
Constructor
- Range (start:Number, end:Number)
- Creates and defines a Range object.
Instance properties
Instance methods
- setRange (start:Number, end:Number) : void
- Defines or redefines range.
- 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 if the range specified by the range parameter is equal to this range object.
- overlaps (range:Range) : Boolean
- Determines if this range and the range specified by the range parameter overlap.
- contains (range:Range) : Boolean
- Determines if this range contains the range specified by the range parameter.
- clone : Range
Constructor
Range
public function Range (
start:Number,
end:Number)
Creates and defines a Range object.
Parameters:
start:
Beginning value of the range.
end :
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 properties
end
public end:Number
(read,write)
The end value of the range.
max
public max:Number
(read)
Tthe maximum or largest value of the range.
min
public min:Number
(read)
The minimum or smallest value of the range.
start
public start:Number
(read,write)
The start value of the range.
Instance methods
clone
Returns:
- A new range object with the same values as this range.
contains
Determines if this range contains the range specified by the
range parameter. Parameters:
A:
Range object.
Returns:
- Returns
trueif this range contains all values of the range specified; otherwisefalse.
equals
Determines if the range specified by the
range parameter is equal to this range object. Parameters:
percent:
A Range object.
Returns:
- Returns
trueif ranges are identical; otherwisefalse.
getPercentOfValue
Returns the percentage the value represents out of the range.
Parameters:
value:
An integer.
Returns:
- A Percent object.
getValueOfPercent
Calculates the percent of the range.
Parameters:
percent:
A Percent object.
Returns:
- The value the percent represent of the range.
isWithinRange
public function isWithinRange (
value:Number) : Boolean
Determines if value is included in the range including the range's start and end values.
Returns:
- Returns
trueif value was included in range; otherwisefalse.
overlaps
Determines if this range and the range specified by the
range parameter overlap. Parameters:
A:
Range object.
Returns:
- Returns
trueif this range contains any value of the range specified; otherwisefalse.
setRange
public function setRange (
start:Number,
end:Number) : void
Defines or redefines range.
Parameters:
start:
Beginning value of the range.
end :
Ending value of the range.