Class SolnCache

java.lang.Object
  |
  +--SolnCache

class SolnCache
extends java.lang.Object
implements Solvable

Maintains a backup of the previous solution, and the solve() parameters used to obtain it. Subsequent calls will return a copy of the stored solution data, provided the parameters are the same, and that the cache has not been marked invalid.


Field Summary
protected  double[] cache
          The cache of solution data
protected  double last_step
          The value of step for which the cache is valid
protected  double last_x0
          The value of x0 for which the cache is valid
protected  Solvable src
          The Solvable object to obtain new data from
 
Constructor Summary
SolnCache(Solvable src)
           
 
Method Summary
 void invalidate()
          Requests that the cache be marked invalid.
 void solve(double x0, double step, double[] vals)
          Requests that the supplied array be filled with solution data.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

src

protected Solvable src
The Solvable object to obtain new data from

last_x0

protected double last_x0
The value of x0 for which the cache is valid

last_step

protected double last_step
The value of step for which the cache is valid

cache

protected double[] cache
The cache of solution data
Constructor Detail

SolnCache

public SolnCache(Solvable src)
Parameters:
src - The object to obtain solution data from
Method Detail

solve

public void solve(double x0,
                  double step,
                  double[] vals)
Description copied from interface: Solvable
Requests that the supplied array be filled with solution data. The nth element of the array should be the solution at x = x0 + step*n.
Specified by:
solve in interface Solvable
Tags copied from interface: Solvable
Parameters:
x0 - The initial x-value
step - The increment to be applied to x0
vals - The array which will hold the solution data

invalidate

public void invalidate()
Requests that the cache be marked invalid. This will typically be called after a parameter of the original Solvable has changed.