Interface DataSetMetadata
-
- All Superinterfaces:
Collection<DataStructureComponent<?,?,?>>
,Iterable<DataStructureComponent<?,?,?>>
,Serializable
,Set<DataStructureComponent<?,?,?>>
,VTLValueMetadata
public interface DataSetMetadata extends Set<DataStructureComponent<?,?,?>>, VTLValueMetadata, Serializable
The immutable representation of the data structure of aDataSet
.- Author:
- Valentino Pinna
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description boolean
contains(String name)
Checks if thisDataSetMetadata
contains a component with the specified name.DataSetMetadata
drop(Collection<String> names)
Creates a new structure dropping all the named non-identifier components.Optional<DataStructureComponent<?,?,?>>
getComponent(String name)
Queries thisDataSetMetadata
for a component with the specified name.default <R extends ComponentRole>
Optional<DataStructureComponent<R,?,?>>getComponent(String name, Class<R> role)
Queries thisDataSetMetadata
for a component with the specified name and role.default <R extends ComponentRole,S extends ValueDomainSubset<S,D>,D extends ValueDomain>
Optional<DataStructureComponent<R,S,D>>getComponent(String name, Class<R> role, S domain)
Queries thisDataSetMetadata
for a component with the specified name, role and value domain.default <S extends ValueDomainSubset<S,D>,D extends ValueDomain>
Optional<DataStructureComponent<?,S,D>>getComponent(String name, S domain)
Queries thisDataSetMetadata
for a component with the specified name and value domain.<R extends ComponentRole>
Set<DataStructureComponent<R,?,?>>getComponents(Class<R> role)
Queries for components of thisDataSetMetadata
having a specified role.default <R extends ComponentRole,S extends ValueDomainSubset<S,D>,D extends ValueDomain>
Set<DataStructureComponent<R,S,D>>getComponents(Class<R> role, S domain)
Queries for components of thisDataSetMetadata
having a specified role and domain.default Set<DataStructureComponent<?,?,?>>
getComponents(String... names)
Queries thisDataSetMetadata
for components with the specified names.default Set<DataStructureComponent<?,?,?>>
getComponents(Collection<String> names)
Queries thisDataSetMetadata
for components with the specified names.default <R extends ComponentRole>
Set<DataStructureComponent<R,?,?>>getComponents(Collection<String> names, Class<R> role)
Queries thisDataSetMetadata
for components having the specified role and matching each of the specified names.DataSetMetadata
joinForOperators(DataSetMetadata other)
Creates a new structure by joining this and anotherDataSetMetadata
.DataSetMetadata
keep(String... names)
Creates a new structure where only the named non-identifier components are kept.DataSetMetadata
membership(String name)
Creates a new structure by performing a VTL membership operation on this structure.<S extends ValueDomainSubset<S,D>,D extends ValueDomain>
DataSetMetadatapivot(DataStructureComponent<ComponentRole.Identifier,StringEnumeratedDomainSubset,StringDomain> identifier, DataStructureComponent<ComponentRole.Measure,S,D> measure)
Creates a new structure by pivoting the specified measure over an identifier that is defined on a string enumerated domain (codelist).DataSetMetadata
rename(DataStructureComponent<?,?,?> component, String newName)
Creates a new structure by renaming a component of thisDataSetMetadata
.DataSetMetadata
subspace(Collection<? extends DataStructureComponent<ComponentRole.Identifier,?,?>> subspace)
Creates a new structure subspacing this structure over the provided identifiers.-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
-
-
-
Method Detail
-
getComponents
<R extends ComponentRole> Set<DataStructureComponent<R,?,?>> getComponents(Class<R> role)
Queries for components of thisDataSetMetadata
having a specified role. The returned set should not be altered in any way.- Type Parameters:
R
- the role type- Parameters:
role
- the role to query- Returns:
- A set of the queried components.
-
getComponents
default <R extends ComponentRole,S extends ValueDomainSubset<S,D>,D extends ValueDomain> Set<DataStructureComponent<R,S,D>> getComponents(Class<R> role, S domain)
Queries for components of thisDataSetMetadata
having a specified role and domain. The returned set should not be altered in any way.- Type Parameters:
R
- the role typeS
- the domain subset typeD
- the domain type- Parameters:
role
- the role to querydomain
- the domain to query- Returns:
- A set of the queried components.
-
contains
boolean contains(String name)
Checks if thisDataSetMetadata
contains a component with the specified name.- Parameters:
name
- the name of the desired component- Returns:
- true if this
DataSetMetadata
contains a component with the specified name.
-
getComponent
Optional<DataStructureComponent<?,?,?>> getComponent(String name)
Queries thisDataSetMetadata
for a component with the specified name.- Parameters:
name
- the name of the desired component- Returns:
- an
Optional
containing the component if one exists.
-
getComponent
default <S extends ValueDomainSubset<S,D>,D extends ValueDomain> Optional<DataStructureComponent<?,S,D>> getComponent(String name, S domain)
Queries thisDataSetMetadata
for a component with the specified name and value domain.- Type Parameters:
S
- the domain subset typeD
- the domain type- Parameters:
name
- the name of the desired componentdomain
- the domain to query- Returns:
- an
Optional
containing the component if one exists.
-
getComponent
default <R extends ComponentRole> Optional<DataStructureComponent<R,?,?>> getComponent(String name, Class<R> role)
Queries thisDataSetMetadata
for a component with the specified name and role.- Type Parameters:
R
- the role type- Parameters:
name
- the name of the desired componentrole
- the role to query- Returns:
- an
Optional
containing the component if one exists.
-
getComponent
default <R extends ComponentRole,S extends ValueDomainSubset<S,D>,D extends ValueDomain> Optional<DataStructureComponent<R,S,D>> getComponent(String name, Class<R> role, S domain)
Queries thisDataSetMetadata
for a component with the specified name, role and value domain.- Type Parameters:
R
- the role typeS
- the domain subset typeD
- the domain type- Parameters:
name
- the name of the desired componentrole
- the role to querydomain
- the domain to query- Returns:
- an
Optional
containing the component if one exists.
-
getComponents
default Set<DataStructureComponent<?,?,?>> getComponents(String... names)
Queries thisDataSetMetadata
for components with the specified names. The returned set should not be altered in any way.- Parameters:
names
- the names to query- Returns:
- a set containing the existing components.
- Throws:
VTLMissingComponentsException
- if one of the names isn't found.
-
getComponents
default Set<DataStructureComponent<?,?,?>> getComponents(Collection<String> names)
Queries thisDataSetMetadata
for components with the specified names. The returned set should not be altered in any way.- Parameters:
names
- the names to query- Returns:
- a set containing the existing components.
- Throws:
VTLMissingComponentsException
- if one of the names isn't found.
-
getComponents
default <R extends ComponentRole> Set<DataStructureComponent<R,?,?>> getComponents(Collection<String> names, Class<R> role)
Queries thisDataSetMetadata
for components having the specified role and matching each of the specified names. The returned set should not be altered in any way.- Type Parameters:
R
- the role type- Parameters:
names
- the names to queryrole
- the role to query- Returns:
- a set containing the existing components.
- Throws:
VTLMissingComponentsException
- if one of the names isn't found.
-
subspace
DataSetMetadata subspace(Collection<? extends DataStructureComponent<ComponentRole.Identifier,?,?>> subspace)
Creates a new structure subspacing this structure over the provided identifiers.- Parameters:
subspace
- the identifiers that must be subspaced- Returns:
- The new structure.
-
keep
DataSetMetadata keep(String... names)
Creates a new structure where only the named non-identifier components are kept.- Parameters:
names
- names of the non-identifier components to keep- Returns:
- The new structure.
-
drop
DataSetMetadata drop(Collection<String> names)
Creates a new structure dropping all the named non-identifier components.- Parameters:
names
- names of the non-identifier components to drop- Returns:
- The new structure.
-
membership
DataSetMetadata membership(String name)
Creates a new structure by performing a VTL membership operation on this structure.- Parameters:
name
- the name of the component on which the membership operation is performed- Returns:
- The new structure.
-
joinForOperators
DataSetMetadata joinForOperators(DataSetMetadata other)
Creates a new structure by joining this and anotherDataSetMetadata
.- Parameters:
other
- the other structure to join- Returns:
- the new structure.
-
rename
DataSetMetadata rename(DataStructureComponent<?,?,?> component, String newName)
Creates a new structure by renaming a component of thisDataSetMetadata
. If a component with the new name already exists, the behaviour is undefined.- Parameters:
component
- the component to renamenewName
- the new name for the component- Returns:
- the new structure.
-
pivot
<S extends ValueDomainSubset<S,D>,D extends ValueDomain> DataSetMetadata pivot(DataStructureComponent<ComponentRole.Identifier,StringEnumeratedDomainSubset,StringDomain> identifier, DataStructureComponent<ComponentRole.Measure,S,D> measure)
Creates a new structure by pivoting the specified measure over an identifier that is defined on a string enumerated domain (codelist).- Type Parameters:
S
- the domain subset type of the measureD
- the domain type of the measure- Parameters:
identifier
- the identifiermeasure
- the measure- Returns:
- the new structure.
-
-