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
ConstructorsConstructorDescriptionUnionProjector(List<nz.org.riskscape.engine.types.Struct> sourceTypes, nz.org.riskscape.engine.types.Struct producedType) -
Method Summary
Modifier and TypeMethodDescriptionnz.org.riskscape.engine.Tupleapply(nz.org.riskscape.engine.Tuple t) nz.org.riskscape.engine.types.Structnz.org.riskscape.engine.types.StructList<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.StructunionOf(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, waitMethods inherited from interface nz.org.riskscape.engine.projection.Projector
getDirectMapping, getDirectMappingStrings, getProjectedType, getSpatialMetadataMapperMethods 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 producedType)
-
-
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
Anythingtype.- 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:
getSourceTypein interfacenz.org.riskscape.engine.projection.Projector
-
getSourceTypes
-
getProducedType
public nz.org.riskscape.engine.types.Struct getProducedType()- Specified by:
getProducedTypein interfacenz.org.riskscape.engine.projection.Projector- Specified by:
getProducedTypein interfacenz.org.riskscape.engine.pipeline.Realized
-