sjm.utensil
Class LimitingLinearCalculator

java.lang.Object
  |
  +--sjm.utensil.LinearCalculator
        |
        +--sjm.utensil.LimitingLinearCalculator

public class LimitingLinearCalculator
extends LinearCalculator

A LimitingLinearCalculator is a LinearCalculator where the data points given in the constructor limit the extrapoltation. The X value of a LimitingLinearCalculator will never be below the minimum of xFrom and xTo, and will never be above the maximum of these two.

Version:
1.0
Author:
Steven J. Metsker

Fields inherited from class sjm.utensil.LinearCalculator
xFrom, xTo, yFrom, yTo
 
Constructor Summary
LimitingLinearCalculator(double xFrom, double xTo, double yFrom, double yTo)
          Create a LimitingLinearCalculator from known points on two scales.
 
Method Summary
 double calculateXforGivenY(double y)
          Return the value on the first scale, corresponding to the given value on the second scale.
 double calculateYforGivenX(double x)
          Return the value on the second scale, corresponding to the given value on the first scale.
 
Methods inherited from class sjm.utensil.LinearCalculator
main, toString
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LimitingLinearCalculator

public LimitingLinearCalculator(double xFrom,
                                double xTo,
                                double yFrom,
                                double yTo)
Create a LimitingLinearCalculator from known points on two scales.
Parameters:
double - xFrom
double - xTo
double - yFrom
double - yTo
Method Detail

calculateXforGivenY

public double calculateXforGivenY(double y)
Return the value on the first scale, corresponding to the given value on the second scale. Limit the X value to be between xFrom and xTo.
Overrides:
calculateXforGivenY in class LinearCalculator
Returns:
the value on the first scale, corresponding to the given value on the second scale

calculateYforGivenX

public double calculateYforGivenX(double x)
Return the value on the second scale, corresponding to the given value on the first scale. Limit the Y value to be between yFrom and yTo.
Overrides:
calculateYforGivenX in class LinearCalculator
Returns:
the value on the second scale, corresponding to the given value on the first scale