Package smile.data.type
Class StructType
java.lang.Object
smile.data.type.StructType
- All Implemented Interfaces:
Serializable,DataType
Struct data type is determined by the fixed order of the fields
of primitive data types in the struct. An instance of a struct type
will be a tuple.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface smile.data.type.DataType
DataType.ID -
Constructor Summary
ConstructorsConstructorDescriptionStructType(List<StructField> fields) Constructor.StructType(StructField... fields) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionboxed(Collection<Tuple> rows) Updates the field type to the boxed one if the field has null/missing values in the data.booleanfield(int i) Return the field at position i.Return the field of given name.fields()Returns the fields.id()Returns the type ID enum.intReturns the index of a field.intlength()Returns the number of fields.measure(int i) Returns the field's level of measurements.Measure[]measures()Returns the field's level of measurements.name()Returns the type name used in external catalogs.name(int i) Returns the field name.String[]names()Returns the field names.parser()Returns the lambda functions that parse field values.toString()Returns the string representation of a value of the type.type(int i) Returns the field data type.DataType[]types()Returns the field data types.unboxed()Updates the field type to the primitive one.Returns the value from its string representation.
-
Constructor Details
-
StructType
Constructor.- Parameters:
fields- the struct fields.
-
StructType
Constructor.- Parameters:
fields- the struct fields.
-
-
Method Details
-
length
public int length()Returns the number of fields.- Returns:
- the number of fields.
-
fields
Returns the fields.- Returns:
- the fields.
-
field
Return the field of given name.- Parameters:
name- the field name.- Returns:
- the field.
-
field
Return the field at position i.- Parameters:
i- the field index.- Returns:
- the field.
-
indexOf
Returns the index of a field.- Parameters:
field- the field name.- Returns:
- the index of field.
-
name
Returns the field name.- Parameters:
i- the index of field.- Returns:
- the field name.
-
names
Returns the field names.- Returns:
- the field names.
-
type
Returns the field data type.- Parameters:
i- the index of field.- Returns:
- the field data type.
-
types
Returns the field data types.- Returns:
- the field data types.
-
measure
Returns the field's level of measurements.- Parameters:
i- the index of field.- Returns:
- the field's level of measurements.
-
measures
Returns the field's level of measurements.- Returns:
- the field's level of measurements.
-
parser
Returns the lambda functions that parse field values.- Returns:
- the lambda functions that parse field values.
-
boxed
Updates the field type to the boxed one if the field has null/missing values in the data.- Parameters:
rows- a set of tuples.- Returns:
- the new struct with boxed field types.
-
unboxed
Updates the field type to the primitive one. -
name
Description copied from interface:DataTypeReturns the type name used in external catalogs. DataType.of(name()) should return the same type. -
id
Description copied from interface:DataTypeReturns the type ID enum. -
toString
-
toString
Description copied from interface:DataTypeReturns the string representation of a value of the type. -
valueOf
Description copied from interface:DataTypeReturns the value from its string representation. -
equals
-