Class Ranger

java.lang.Object
  |
  +--Ranger
All Implemented Interfaces:
Function1

class Ranger
extends java.lang.Object
implements Function1

A Ranger is a Function1 object that produces a list of number from a start number up to including the argument number. The start number is specified in the constructor. So a Ranger can be used as the argument to map or mappend, for example.


Field Summary
private  java.lang.Number increment
           
private  java.lang.Number start
          The starting number in the range to be produced.
 
Constructor Summary
(package private) Ranger(java.lang.Number _start, java.lang.Number _increment)
          Create a Ranger with a specific start and increment.
 
Method Summary
 java.lang.Object apply(java.lang.Object stop)
          Apply this Ranger object to an Object x, which should be a Number.
static OpenList range(java.lang.Number start, java.lang.Number stop, java.lang.Number increment)
          Create an ascending list beginning with start, up to and including stop.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

start

private java.lang.Number start
The starting number in the range to be produced.


increment

private java.lang.Number increment
Constructor Detail

Ranger

Ranger(java.lang.Number _start,
       java.lang.Number _increment)
Create a Ranger with a specific start and increment.

Parameters:
_start - the starting Number to be used.
_increment - the increment Number to be used.
Method Detail

range

public static OpenList range(java.lang.Number start,
                             java.lang.Number stop,
                             java.lang.Number increment)
Create an ascending list beginning with start, up to and including stop.

Returns:
a list consisting of start to stop, incremented by increment.

apply

public java.lang.Object apply(java.lang.Object stop)
Apply this Ranger object to an Object x, which should be a Number. If x is not a number, a ClassCastException will be thrown.

Specified by:
apply in interface Function1
Returns:
a Double containing this Ranger's start times the argument's value