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:Wednesday, 31 December 2008, 20:18:28
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
  • start : Number
    • The start value of the range.
  • end : Number
    • The end value of the range.
  • min : Number
    • The minimum or smallest value of the range.
  • max : Number
    • Tthe maximum or largest value of the range.
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

public function clone (
) : Range

Returns:
  • A new range object with the same values as this range.

contains

public function contains (
range:Range) : Boolean

Determines if this range contains the range specified by the range parameter.
Parameters:
A:
Range object.
Returns:
  • Returns true if this range contains all values of the range specified; otherwise false.

equals

public function equals (
range:Range) : Boolean

Determines if the range specified by the range parameter is equal to this range object.
Parameters:
percent:
A Range object.
Returns:
  • Returns true if ranges are identical; otherwise false.

getPercentOfValue

public function getPercentOfValue (
value:Number) : Percent

Returns the percentage the value represents out of the range.
Parameters:
value:
An integer.
Returns:
  • A Percent object.

getValueOfPercent

public function getValueOfPercent (
percent:Percent) : Number

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 true if value was included in range; otherwise false.

overlaps

public function overlaps (
range:Range) : Boolean

Determines if this range and the range specified by the range parameter overlap.
Parameters:
A:
Range object.
Returns:
  • Returns true if this range contains any value of the range specified; otherwise false.

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.