Package com.yahoo.document.datatypes
Class TensorFieldValue
- java.lang.Object
-
- com.yahoo.vespa.objects.Selectable
-
- com.yahoo.vespa.objects.Identifiable
-
- com.yahoo.document.datatypes.FieldValue
-
- com.yahoo.document.datatypes.TensorFieldValue
-
- All Implemented Interfaces:
java.lang.Cloneable
,java.lang.Comparable<FieldValue>
public class TensorFieldValue extends FieldValue
Field value class that wraps a tensor.- Author:
- geirst
-
-
Field Summary
-
Fields inherited from class com.yahoo.document.datatypes.FieldValue
classId
-
-
Constructor Summary
Constructors Constructor Description TensorFieldValue()
Create an empty tensor field value where the tensor type is not yet known.TensorFieldValue(com.yahoo.tensor.Tensor tensor)
Create a tensor field value containing the given tensorTensorFieldValue(com.yahoo.tensor.TensorType type)
Create an empty tensor field value for the given tensor type
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
assign(java.lang.Object o)
Assign this non-fieldvalue value to this field value.void
assignTensor(java.util.Optional<com.yahoo.tensor.Tensor> tensor)
Assigns the given tensor to this field value.void
clear()
void
deserialize(Field field, FieldReader reader)
Read a field value from the specified readerboolean
equals(java.lang.Object o)
TensorDataType
getDataType()
java.util.Optional<com.yahoo.tensor.Tensor>
getTensor()
java.util.Optional<com.yahoo.tensor.TensorType>
getTensorType()
java.lang.Object
getWrappedValue()
Used to retrieve wrapped type for simple types, such that you can use get methods to retrieve ints and floats directly instead of Int/Float field values.void
printXml(XmlStream xml)
void
serialize(Field field, FieldWriter writer)
Write out field value to the specified writerjava.lang.String
toString()
-
Methods inherited from class com.yahoo.document.datatypes.FieldValue
clone, compareTo, create, deserialize, getRecursiveValue, getRecursiveValue, onDeserialize, onSerialize, serialize, toXml
-
-
-
-
Constructor Detail
-
TensorFieldValue
public TensorFieldValue()
Create an empty tensor field value where the tensor type is not yet known. The tensor (and tensor type) can later be assigned with assignTensor().
-
TensorFieldValue
public TensorFieldValue(com.yahoo.tensor.TensorType type)
Create an empty tensor field value for the given tensor type
-
TensorFieldValue
public TensorFieldValue(com.yahoo.tensor.Tensor tensor)
Create a tensor field value containing the given tensor
-
-
Method Detail
-
getTensor
public java.util.Optional<com.yahoo.tensor.Tensor> getTensor()
-
getTensorType
public java.util.Optional<com.yahoo.tensor.TensorType> getTensorType()
-
getDataType
public TensorDataType getDataType()
- Specified by:
getDataType
in classFieldValue
-
toString
public java.lang.String toString()
- Overrides:
toString
in classcom.yahoo.vespa.objects.Identifiable
-
printXml
public void printXml(XmlStream xml)
- Specified by:
printXml
in classFieldValue
-
clear
public void clear()
- Specified by:
clear
in classFieldValue
-
assign
public void assign(java.lang.Object o)
Description copied from class:FieldValue
Assign this non-fieldvalue value to this field value. This is used to be able to assign ints to Integer field values and List to Array field values and such.Override to accept the specific types that should be legal.
- Specified by:
assign
in classFieldValue
-
assignTensor
public void assignTensor(java.util.Optional<com.yahoo.tensor.Tensor> tensor)
Assigns the given tensor to this field value. The tensor type is also set from the given tensor if it was not set before.
-
serialize
public void serialize(Field field, FieldWriter writer)
Description copied from class:FieldValue
Write out field value to the specified writer- Specified by:
serialize
in classFieldValue
-
deserialize
public void deserialize(Field field, FieldReader reader)
Description copied from class:FieldValue
Read a field value from the specified reader- Specified by:
deserialize
in classFieldValue
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classcom.yahoo.vespa.objects.Identifiable
-
getWrappedValue
public java.lang.Object getWrappedValue()
Description copied from class:FieldValue
Used to retrieve wrapped type for simple types, such that you can use get methods to retrieve ints and floats directly instead of Int/Float field values. Complex types that can't be specified by simple java types just return themself.- Overrides:
getWrappedValue
in classFieldValue
-
-