Class UnionProjector
java.lang.Object
nz.org.riskscape.engine.projection.UnionProjector
- All Implemented Interfaces:
AutoCloseable
,Function<nz.org.riskscape.engine.Tuple,
,nz.org.riskscape.engine.Tuple> nz.org.riskscape.engine.pipeline.Realized
,nz.org.riskscape.engine.projection.Projector
Takes tuples that potentially differ in type from two or more sources, and reprojects the tuples to a common type
TODO we can come back and rework this to use the ancestor type conversion
-
Constructor Summary
ConstructorDescriptionUnionProjector
(List<nz.org.riskscape.engine.types.Struct> sourceTypes, nz.org.riskscape.engine.types.Struct projectedType) -
Method Summary
Modifier and TypeMethodDescriptionnz.org.riskscape.engine.Tuple
apply
(nz.org.riskscape.engine.Tuple t) nz.org.riskscape.engine.types.Struct
nz.org.riskscape.engine.types.Struct
List<nz.org.riskscape.engine.types.Struct>
static nz.org.riskscape.problem.ResultOrProblems<? extends nz.org.riskscape.engine.projection.Projector>
realize
(nz.org.riskscape.engine.typeset.TypeSet typeSet, List<nz.org.riskscape.engine.types.Struct> inputTypes) static nz.org.riskscape.problem.ResultOrProblems<? extends nz.org.riskscape.engine.projection.Projector>
realize
(nz.org.riskscape.engine.typeset.TypeSet typeSet, nz.org.riskscape.engine.types.Struct... inputTypes) Convenience API to build a UnionProjector from the given input types.static nz.org.riskscape.engine.types.Struct
unionOf
(nz.org.riskscape.engine.typeset.TypeSet typeSet, nz.org.riskscape.engine.types.Struct a, nz.org.riskscape.engine.types.Struct b) Takes the union of two structs.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface nz.org.riskscape.engine.projection.Projector
getDirectMapping, getDirectMappingStrings, getSpatialMetadataMapper
Methods inherited from interface nz.org.riskscape.engine.pipeline.Realized
close
-
Constructor Details
-
UnionProjector
public UnionProjector(List<nz.org.riskscape.engine.types.Struct> sourceTypes, nz.org.riskscape.engine.types.Struct projectedType)
-
-
Method Details
-
unionOf
public static nz.org.riskscape.engine.types.Struct unionOf(nz.org.riskscape.engine.typeset.TypeSet typeSet, nz.org.riskscape.engine.types.Struct a, nz.org.riskscape.engine.types.Struct b) Takes the union of two structs. For shared attributes, the common ancestor type is used. Attributes that are only in one struct become nullable. Shared nested structs are recursed, so that they end up with a shared set of attributes (rather than becoming the
Anything
type.- Returns:
- A Struct that is the union of the two structs' members
-
realize
public static nz.org.riskscape.problem.ResultOrProblems<? extends nz.org.riskscape.engine.projection.Projector> realize(nz.org.riskscape.engine.typeset.TypeSet typeSet, List<nz.org.riskscape.engine.types.Struct> inputTypes) - Returns:
- a new UnionProjector built from the given list of input types
-
realize
public static nz.org.riskscape.problem.ResultOrProblems<? extends nz.org.riskscape.engine.projection.Projector> realize(nz.org.riskscape.engine.typeset.TypeSet typeSet, nz.org.riskscape.engine.types.Struct... inputTypes) Convenience API to build a UnionProjector from the given input types.
-
apply
public nz.org.riskscape.engine.Tuple apply(nz.org.riskscape.engine.Tuple t) -
getSourceType
public nz.org.riskscape.engine.types.Struct getSourceType()- Specified by:
getSourceType
in interfacenz.org.riskscape.engine.projection.Projector
-
getSourceTypes
-
getProjectedType
public nz.org.riskscape.engine.types.Struct getProjectedType()- Specified by:
getProjectedType
in interfacenz.org.riskscape.engine.projection.Projector
-