Search in sources :

Example 1 with TDSAggregateValue

use of org.finos.legend.engine.protocol.pure.v1.model.valueSpecification.raw.TDSAggregateValue in project legend-engine by finos.

the class Handlers method aggInference.

public static void aggInference(Object obj, GenericType gt, int mapOffset, int aggOffset, CompileContext cc, MutableList<String> ov, ProcessingContext pc) {
    Lambda aggFirstLambda = null;
    Lambda aggSecondLambda = null;
    if (obj instanceof AppliedFunction) {
        aggFirstLambda = ((Lambda) ((AppliedFunction) obj).parameters.get(mapOffset));
        aggSecondLambda = ((Lambda) ((AppliedFunction) obj).parameters.get(aggOffset));
    } else if (obj instanceof AggregateValue) {
        aggFirstLambda = ((AggregateValue) obj).mapFn;
        aggSecondLambda = ((AggregateValue) obj).aggregateFn;
    } else if (obj instanceof TDSAggregateValue) {
        aggFirstLambda = ((TDSAggregateValue) obj).mapFn;
        aggSecondLambda = ((TDSAggregateValue) obj).aggregateFn;
    }
    if (aggFirstLambda != null && aggSecondLambda != null) {
        updateSimpleLambda(aggFirstLambda, gt, new org.finos.legend.engine.protocol.pure.v1.model.packageableElement.domain.Multiplicity(1, 1));
        ValueSpecification processLambda = aggFirstLambda.accept(new ValueSpecificationBuilder(cc, ov, pc));
        updateSimpleLambda(aggSecondLambda, funcReturnType(processLambda, cc.pureModel), new org.finos.legend.engine.protocol.pure.v1.model.packageableElement.domain.Multiplicity());
    }
}
Also used : TDSAggregateValue(org.finos.legend.engine.protocol.pure.v1.model.valueSpecification.raw.TDSAggregateValue) AggregateValue(org.finos.legend.engine.protocol.pure.v1.model.valueSpecification.raw.AggregateValue) TDSAggregateValue(org.finos.legend.engine.protocol.pure.v1.model.valueSpecification.raw.TDSAggregateValue) ValueSpecification(org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.valuespecification.ValueSpecification) AppliedFunction(org.finos.legend.engine.protocol.pure.v1.model.valueSpecification.application.AppliedFunction) Lambda(org.finos.legend.engine.protocol.pure.v1.model.valueSpecification.raw.Lambda) ValueSpecificationBuilder(org.finos.legend.engine.language.pure.compiler.toPureGraph.ValueSpecificationBuilder)

Aggregations

ValueSpecificationBuilder (org.finos.legend.engine.language.pure.compiler.toPureGraph.ValueSpecificationBuilder)1 AppliedFunction (org.finos.legend.engine.protocol.pure.v1.model.valueSpecification.application.AppliedFunction)1 AggregateValue (org.finos.legend.engine.protocol.pure.v1.model.valueSpecification.raw.AggregateValue)1 Lambda (org.finos.legend.engine.protocol.pure.v1.model.valueSpecification.raw.Lambda)1 TDSAggregateValue (org.finos.legend.engine.protocol.pure.v1.model.valueSpecification.raw.TDSAggregateValue)1 ValueSpecification (org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.valuespecification.ValueSpecification)1