public class VectorEntryFunction extends AbstractScalarFunction<Vectorizable> implements Vectorizable
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_INDEX
The default index is 0.
|
protected int |
index
The index of the vector to get.
|
Constructor and Description |
---|
VectorEntryFunction()
Creates a new
VectorEntryFunction with an initial index of
0. |
VectorEntryFunction(int index)
Creates a new
VectorEntryFunction with the given index. |
Modifier and Type | Method and Description |
---|---|
VectorEntryFunction |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
void |
convertFromVector(Vector parameters)
Converts a vector into the index to select from the vector.
|
Vector |
convertToVector()
Converts the index to select into a vector (of length 1).
|
boolean |
equals(java.lang.Object other) |
double |
evaluateAsDouble(Vectorizable input)
Returns the vector value at the specified index.
|
int |
getIndex()
Gets the index into the vector that the function gets the value for.
|
int |
hashCode() |
void |
setIndex(int index)
Sets the index into the vector that the function gets the value for.
|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
evaluate
public static final int DEFAULT_INDEX
protected int index
public VectorEntryFunction()
VectorEntryFunction
with an initial index of
0.public VectorEntryFunction(int index)
VectorEntryFunction
with the given index.index
- The index into a vector to get the output for.public VectorEntryFunction clone()
AbstractCloneableSerializable
Object
class and
removes the exception that it throws. Its default behavior is to
automatically create a clone of the exact type of object that the
clone is called on and to copy all primitives but to keep all references,
which means it is a shallow copy.
Extensions of this class may want to override this method (but call
super.clone()
to implement a "smart copy". That is, to target
the most common use case for creating a copy of the object. Because of
the default behavior being a shallow copy, extending classes only need
to handle fields that need to have a deeper copy (or those that need to
be reset). Some of the methods in ObjectUtil
may be helpful in
implementing a custom clone method.
Note: The contract of this method is that you must use
super.clone()
as the basis for your implementation.clone
in interface Vectorizable
clone
in interface CloneableSerializable
clone
in class AbstractCloneableSerializable
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public double evaluateAsDouble(Vectorizable input)
evaluateAsDouble
in interface ScalarFunction<Vectorizable>
input
- The input vector.public Vector convertToVector()
convertToVector
in interface Vectorizable
public void convertFromVector(Vector parameters)
convertFromVector
in interface Vectorizable
parameters
- The parameter vector. Must be of dimensionality one.public int getIndex()
public void setIndex(int index)
index
- The index.