KeyIntermediate - the key type of the right side ComposedComputationKey1 - the key of the base computationResult1 - the result type of the base computationKey2 - the key type corresponding to the final result type of this compositionResult2 - the result type of this computationpublic class RightComposingComputation<KeyIntermediate extends ComputeKey<?>,Key1 extends ComputeKey<Result1>,Result1 extends ComputeResult,Key2 extends ComputeKey<Result2>,Result2 extends ComputeResult> extends Object implements ComposedComputation<Key1,Result2>
ComposedComputation that takes a base GraphComputation, a Composer, and Transformer and returns a new ComposedResult of Result2 type. This is composing
from the right to left. This allows us to define a sequence of transformations K1 -> R1 to Kn ->
Rn as one computation K1 -> [Rn] where computation of the next key doesn't require collecting all
the results from the prior stages. This lets us perform fan-out tree shaped computations.| Modifier and Type | Class and Description |
|---|---|
static interface |
RightComposingComputation.RightComposer<Key1,Result1,RightKey extends ComputeKey<?>,RightResult extends ComputeResult>
Specific
Composer that the right computation is a ComposedComputation |
| Modifier and Type | Method and Description |
|---|---|
GraphComputationStage<ComposedKey<Key1,Result2>,ComposedResult<ComputeKey<Result2>,Result2>> |
asStage() |
com.google.common.collect.ImmutableSet<? extends ComputeKey<? extends ComputeResult>> |
discoverDeps(ComposedKey<Key1,Result2> key,
ComputationEnvironment env)
Compute dependent keys required to compute given key, and a set of dependencies as listed by
GraphComputation.discoverPreliminaryDeps(ComputeKey). |
com.google.common.collect.ImmutableSet<? extends ComputeKey<? extends ComputeResult>> |
discoverPreliminaryDeps(ComposedKey<Key1,Result2> key)
Compute dependent keys required to compute given the current key.
|
ComposedComputationIdentifier<Result2> |
getIdentifier() |
ComposedResult<ComputeKey<Result2>,Result2> |
transform(ComposedKey<Key1,Result2> key,
ComputationEnvironment env)
Perform a transformation identified by key
Key into a final type Result. |
public ComposedComputationIdentifier<Result2> getIdentifier()
getIdentifier in interface ComposedComputation<Key1 extends ComputeKey<Result1>,Result2 extends ComputeResult>getIdentifier in interface GraphComputation<ComposedKey<Key1 extends ComputeKey<Result1>,Result2 extends ComputeResult>,ComposedResult<ComputeKey<Result2 extends ComputeResult>,Result2 extends ComputeResult>>ComputeKey.getIdentifier()public ComposedResult<ComputeKey<Result2>,Result2> transform(ComposedKey<Key1,Result2> key, ComputationEnvironment env) throws Exception
GraphComputationKey into a final type Result. This
transformation should be performed synchronously.transform in interface ComposedComputation<Key1 extends ComputeKey<Result1>,Result2 extends ComputeResult>transform in interface GraphComputation<ComposedKey<Key1 extends ComputeKey<Result1>,Result2 extends ComputeResult>,ComposedResult<ComputeKey<Result2 extends ComputeResult>,Result2 extends ComputeResult>>key - The Key of the requested resultenv - The execution environment containing results of keys from GraphComputation.discoverDeps(ComputeKey, ComputationEnvironment) and GraphComputation.discoverPreliminaryDeps(ComputeKey)Exceptionpublic com.google.common.collect.ImmutableSet<? extends ComputeKey<? extends ComputeResult>> discoverDeps(ComposedKey<Key1,Result2> key, ComputationEnvironment env) throws Exception
GraphComputationGraphComputation.discoverPreliminaryDeps(ComputeKey). The results of those computations will be
available in GraphComputation.transform(ComputeKey, ComputationEnvironment) as a part of ComputationEnvironmentdiscoverDeps in interface ComposedComputation<Key1 extends ComputeKey<Result1>,Result2 extends ComputeResult>discoverDeps in interface GraphComputation<ComposedKey<Key1 extends ComputeKey<Result1>,Result2 extends ComputeResult>,ComposedResult<ComputeKey<Result2 extends ComputeResult>,Result2 extends ComputeResult>>key - the current key to transformenv - The execution environment containing results of keys from GraphComputation.discoverPreliminaryDeps(ComputeKey)Exceptionpublic com.google.common.collect.ImmutableSet<? extends ComputeKey<? extends ComputeResult>> discoverPreliminaryDeps(ComposedKey<Key1,Result2> key)
GraphComputationGraphComputation.discoverDeps(ComputeKey, ComputationEnvironment) as
a part of ComputationEnvironment, and GraphComputation.transform(ComputeKey,
ComputationEnvironment)discoverPreliminaryDeps in interface ComposedComputation<Key1 extends ComputeKey<Result1>,Result2 extends ComputeResult>discoverPreliminaryDeps in interface GraphComputation<ComposedKey<Key1 extends ComputeKey<Result1>,Result2 extends ComputeResult>,ComposedResult<ComputeKey<Result2 extends ComputeResult>,Result2 extends ComputeResult>>key - the current key to transformGraphComputation.discoverDeps(ComputeKey, ComputationEnvironment) and
GraphComputation.transform(ComputeKey, ComputationEnvironment) of the current key depends onpublic GraphComputationStage<ComposedKey<Key1,Result2>,ComposedResult<ComputeKey<Result2>,Result2>> asStage()
asStage in interface ComposedComputation<Key1 extends ComputeKey<Result1>,Result2 extends ComputeResult>GraphComputationStage for registering this computation with the
GraphTransformationEngine