@author Edward Raff
| 8 | * @author Edward Raff |
| 9 | */ |
| 10 | public abstract class IndexFunction implements Function |
| 11 | { |
| 12 | |
| 13 | private static final long serialVersionUID = -7306754195712805257L; |
| 14 | |
| 15 | /** |
| 16 | * An index function, meant to be applied to vectors where the |
| 17 | * value to be computed may vary based on the position in the |
| 18 | * vector of the value. |
| 19 | * |
| 20 | * @param value the value at the specified index |
| 21 | * @param index the index the value is from |
| 22 | * @return the computed result. If a negative index was given, |
| 23 | * the function should return 0.0 if indexFunc(0,indx) would |
| 24 | * return zero for all valid indices. If this is not the case, any non zero value should be returned. |
| 25 | * |
| 26 | */ |
| 27 | abstract public double indexFunc(double value, int index); |
| 28 | |
| 29 | public double f(double... x) |
| 30 | { |
| 31 | return indexFunc(x[0], (int)x[1]); |
| 32 | } |
| 33 | |
| 34 | public double f(Vec x) |
| 35 | { |
| 36 | return indexFunc(x.get(0), (int)x.get(1)); |
| 37 | } |
| 38 | } |
nothing calls this directly
no outgoing calls
no test coverage detected