public class RealNumericIndexer<T>
extends java.lang.Object
implements java.lang.Iterable<T>
| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<xal.tools.NumericRecord<T>> |
_records
records of data
|
| Constructor and Description |
|---|
RealNumericIndexer()
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(double location,
T value)
Add the specified value at the specified location.
|
double |
findIndex(double location)
Get the index of the specified location.
|
T |
get(int index)
Get the element at the specified index
|
int |
getClosestIndex(double location)
Get the index which is closest to the index of the specified location and round down if two are equally close.
|
int[] |
getIndicesWithinLocationRange(double startLocation,
double endLocation)
Get the smallest range of indices whose location range contains the specified range inclusive.
|
double |
getLocation(int index)
Get the location corresponding to the specified index.
|
int |
getLowerIndex(double location)
Get the index which is the greatest integer less than or equal to the index of the specified location.
|
int |
getUpperIndex(double location)
Get the index which is the least integer greater than or equal to the index of the specified location but the greatest of equals.
|
java.util.Iterator<T> |
iterator()
Get an indexer for the indexed items.
|
T |
remove(int index)
Remove the specified item by index.
|
int |
size()
Get the size
|
java.util.List<T> |
toList()
Generate a list of the values.
|
protected final java.util.List<xal.tools.NumericRecord<T>> _records
public int size()
public java.util.Iterator<T> iterator()
iterator in interface java.lang.Iterable<T>public java.util.List<T> toList()
public T get(int index)
public double getLocation(int index)
index - the index of the record to fetchpublic int getLowerIndex(double location)
location - the location for which to identify the array indexpublic int getUpperIndex(double location)
location - the location for which to identify the array indexpublic int[] getIndicesWithinLocationRange(double startLocation,
double endLocation)
startLocation - the starting locationendLocation - the ending locationpublic int getClosestIndex(double location)
location - the location for which to identify the array indexpublic double findIndex(double location)
location - the location for which to identify the array indexpublic void add(double location,
T value)
value - the value to addlocation - the location of the valuepublic T remove(int index)
index - the index of the item to remove