Nengo.ca

ca.nengo.util.impl
Class StatefulIndexFinder

java.lang.Object
  extended by ca.nengo.util.impl.StatefulIndexFinder
All Implemented Interfaces:
IndexFinder, java.lang.Cloneable

public class StatefulIndexFinder
extends java.lang.Object
implements IndexFinder

An IndexFinder that searches linearly, starting where the last answer was. This is a good choice if many interpolations will be made on the same series, and adjacent requests will be close to each other. TODO: test


Constructor Summary
StatefulIndexFinder(float[] values)
           
 
Method Summary
static boolean areMonotonicallyIncreasing(float[] values)
           
 StatefulIndexFinder clone()
           
 int findIndexBelow(float value)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StatefulIndexFinder

public StatefulIndexFinder(float[] values)
Parameters:
values - Must be monotonically increasing.
Method Detail

findIndexBelow

public int findIndexBelow(float value)
Specified by:
findIndexBelow in interface IndexFinder
Parameters:
value - A floating-point value that the list is expected to span
Returns:
The index of the largest value in the list which is smaller than the 'value' arg

areMonotonicallyIncreasing

public static boolean areMonotonicallyIncreasing(float[] values)
Parameters:
values - A list of values
Returns:
True if list values increases monotonically, false otherwise

clone

public StatefulIndexFinder clone()
                          throws java.lang.CloneNotSupportedException
Specified by:
clone in interface IndexFinder
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

Nengo.ca