Class Scaler

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

class Scaler
extends java.lang.Object
implements Function1

A Scaler is a Function1 object that can be used to scale a list of Numbers by a scale factor. If both the scale factor and the function argument are Integer or Long, a Long will be returned. Otherwise a Double will be returned.


Field Summary
private  java.lang.Number factor
           
 
Constructor Summary
(package private) Scaler(java.lang.Number _factor)
          Create a Scaler with a specific scale factor.
 
Method Summary
 java.lang.Object apply(java.lang.Object x)
          Apply this Scaler object to an Object x, which should be a Number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factor

private java.lang.Number factor
Constructor Detail

Scaler

Scaler(java.lang.Number _factor)
Create a Scaler with a specific scale factor.

Parameters:
_factor - the factor to be used
Method Detail

apply

public java.lang.Object apply(java.lang.Object x)
Apply this Scaler 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
Parameters:
x - the Object to which this function is applied
Returns:
a Double containing this Scaler's factor times the argument's value