Interface DataPoint
-
- All Superinterfaces:
Map<DataStructureComponent<?,?,?>,ScalarValue<?,?,?,?>>
,Serializable
- All Known Implementing Classes:
SparkDataPoint
public interface DataPoint extends Map<DataStructureComponent<?,?,?>,ScalarValue<?,?,?,?>>, Serializable
An immutable representation of a datapoint of a VTL dataset.- Author:
- Valentino Pinna
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description DataPoint
combine(Transformation transformation, DataPoint other)
Create a new datapoint combining this and another datapoint.static <S extends ValueDomainSubset<S,D>,D extends ValueDomain>
Comparator<DataPoint>compareBy(DataStructureComponent<ComponentRole.Identifier,S,D> component)
Defines aComparator
that enforces an ordering using the values of a given componentDataPoint
dropComponents(Collection<? extends DataStructureComponent<? extends ComponentRole.NonIdentifier,?,?>> components)
Creates a new datapoint dropping all provided non-id componentsLineage
getLineage()
Get the source transformation of this DataPointdefault <S extends ValueDomainSubset<S,D>,D extends ValueDomain>
ScalarValue<?,?,S,D>getValue(DataStructureComponent<?,S,D> component)
If the component exists, retrieves the value for it in this datapoint, performing a cast of the result.<R extends ComponentRole>
Map<DataStructureComponent<R,?,?>,ScalarValue<?,?,?,?>>getValues(Class<R> role)
Query all values for components having the specified role.default <R extends ComponentRole>
Map<DataStructureComponent<R,?,?>,ScalarValue<?,?,?,?>>getValues(Class<R> role, Collection<String> names)
Returns the values for multiple components having a specified role and matching one of the specified names.default Map<DataStructureComponent<?,?,?>,ScalarValue<?,?,?,?>>
getValues(Collection<? extends DataStructureComponent<?,?,?>> components)
Returns the values for multiple components.default <R extends ComponentRole>
Map<DataStructureComponent<R,?,?>,ScalarValue<?,?,?,?>>getValues(Collection<? extends DataStructureComponent<R,?,?>> components, Class<R> role)
Returns the values for the chosen components having a specified role.DataPoint
keep(Collection<? extends DataStructureComponent<? extends ComponentRole.NonIdentifier,?,?>> components)
Creates a new datapoint keeping all the identifiers and only the provided non-id componentsdefault boolean
matches(Map<? extends DataStructureComponent<? extends ComponentRole.Identifier,?,?>,? extends ScalarValue<?,?,?,?>> identifierValues)
Checks if this datapoint identifiers' values match all the provided ones.DataPoint
renameComponent(DataStructureComponent<?,?,?> oldComponent, DataStructureComponent<?,?,?> newComponent)
Creates a new datapoint renaming the provided component to another one with the same role.-
Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
-
-
-
Method Detail
-
compareBy
static <S extends ValueDomainSubset<S,D>,D extends ValueDomain> Comparator<DataPoint> compareBy(DataStructureComponent<ComponentRole.Identifier,S,D> component)
Defines aComparator
that enforces an ordering using the values of a given component- Parameters:
component
- the component whose values are used for the ordering- Returns:
- the Comparator instance
-
dropComponents
DataPoint dropComponents(Collection<? extends DataStructureComponent<? extends ComponentRole.NonIdentifier,?,?>> components)
Creates a new datapoint dropping all provided non-id components- Parameters:
components
- the components to drop- Returns:
- a new datapoint without the provided components.
-
keep
DataPoint keep(Collection<? extends DataStructureComponent<? extends ComponentRole.NonIdentifier,?,?>> components)
Creates a new datapoint keeping all the identifiers and only the provided non-id components- Parameters:
components
- the components to drop- Returns:
- a new datapoint with all existing ids and the provided components.
-
renameComponent
DataPoint renameComponent(DataStructureComponent<?,?,?> oldComponent, DataStructureComponent<?,?,?> newComponent)
Creates a new datapoint renaming the provided component to another one with the same role.- Parameters:
oldComponent
- the component to be renamednewComponent
- the already renamed component- Returns:
- a new datapoint with the old component renamed.
-
combine
DataPoint combine(Transformation transformation, DataPoint other)
Create a new datapoint combining this and another datapoint. All existing components keep their values in this datapoint and aren't updated with new values.- Parameters:
transformation
- The transformation that originated the combine operationother
- the datapoint to combine with this datapoint- Returns:
- a new datapoint that is the combination of this and another datapoint.
-
getValue
default <S extends ValueDomainSubset<S,D>,D extends ValueDomain> ScalarValue<?,?,S,D> getValue(DataStructureComponent<?,S,D> component)
If the component exists, retrieves the value for it in this datapoint, performing a cast of the result.- Type Parameters:
S
- the domain subset type of the componentD
- the domain type of the component- Parameters:
component
- the component to query- Returns:
- the casted value for the component if exists.
- Throws:
NullPointerException
- if the component is not found
-
matches
default boolean matches(Map<? extends DataStructureComponent<? extends ComponentRole.Identifier,?,?>,? extends ScalarValue<?,?,?,?>> identifierValues)
Checks if this datapoint identifiers' values match all the provided ones.- Parameters:
identifierValues
- the id values to check- Returns:
- true if this datapoint matches the provided identifiers' values.
-
getValues
<R extends ComponentRole> Map<DataStructureComponent<R,?,?>,ScalarValue<?,?,?,?>> getValues(Class<R> role)
Query all values for components having the specified role.- Type Parameters:
R
- the component role type- Parameters:
role
- role of the components- Returns:
- a map with values for each component of the specified role.
-
getValues
default Map<DataStructureComponent<?,?,?>,ScalarValue<?,?,?,?>> getValues(Collection<? extends DataStructureComponent<?,?,?>> components)
Returns the values for multiple components.- Parameters:
components
- the collection of components to query- Returns:
- a map with the values for the specified components.
-
getValues
default <R extends ComponentRole> Map<DataStructureComponent<R,?,?>,ScalarValue<?,?,?,?>> getValues(Class<R> role, Collection<String> names)
Returns the values for multiple components having a specified role and matching one of the specified names.- Type Parameters:
R
- the component role type- Parameters:
role
- role of the componentsnames
- collection of names- Returns:
- a map with the values for all the components having the specified role and matching one of the specified names.
-
getValues
default <R extends ComponentRole> Map<DataStructureComponent<R,?,?>,ScalarValue<?,?,?,?>> getValues(Collection<? extends DataStructureComponent<R,?,?>> components, Class<R> role)
Returns the values for the chosen components having a specified role.- Type Parameters:
R
- the component role type- Parameters:
role
- role of the componentscomponents
- collection of components to query- Returns:
- a map with the values for chosen the components having the specified role.
-
getLineage
Lineage getLineage()
Get the source transformation of this DataPoint- Returns:
- the transformation from where the datapoint originated
-
-