Package com.asakusafw.compiler.flow.DataClass

Examples of com.asakusafw.compiler.flow.DataClass.Property


        DataClass outputType = getEnvironment().getDataClasses().load(outputPort.getDataType());
        DataObjectMirror cache = context.createModelCache(term.source());
        context.add(cache.createReset());
        for (Joined.Mapping mapping : term.mappings()) {
            // input: joined(destination), output: origin(source)
            Property source = inputType.findProperty(mapping.destination());
            Property destination = outputType.findProperty(mapping.source());
            context.add(destination.createSetter(
                    cache.get(),
                    source.createGetter(context.getInput())));
        }
        ResultMirror result = context.getOutput(outputPort);
        context.add(result.createAdd(cache.get()));
View Full Code Here


            for (Joined.Mapping mapping : term.mappings()) {
                if (saw.contains(mapping.destination())) {
                    continue;
                }
                saw.add(mapping.destination());
                Property sourceProperty = inputType.findProperty(mapping.source());
                Property destinationProperty = outputType.findProperty(mapping.destination());
                process.add(destinationProperty.createSetter(
                        resultCache.get(),
                        sourceProperty.createGetter(input)));
            }
        }
        ResultMirror joined = context.getOutput(joinedPort);
View Full Code Here

        context.add(cache.createReset());
        Expression inputObject = context.getInput();
        Expression outputObject = cache.get();
        for (DataClass.Property sourceProperty : sourceType.getProperties()) {
            Property sinkProperty = sinkType.findProperty(sourceProperty.getName());
            if (sinkProperty == null) {
                // skip this property
            } else if (sourceProperty.getType().equals(sinkProperty.getType()) == false) {
                getEnvironment().error(
                        "{0}において、{1}.{2}と{3}.{4}のプロパティ型が一致しません",
                        context.getOperatorDescription().getName(),
                        sourceType,
                        sourceProperty.getName(),
                        sinkType,
                        sinkProperty.getName());
            } else {
                context.add(sinkProperty.createSetter(outputObject,
                        sourceProperty.createGetter(inputObject)));
            }
        }
    }
View Full Code Here

        if (valueClass == null) {
            valueClass = new DataClass.Unresolved(environment.getModelFactory(), slot.getType());
            environment.error("型{0}をロードできませんでした", slot.getType());
        } else {
            for (String name : slot.getSortPropertyNames()) {
                Property property = valueClass.findProperty(name);
                if (property == null) {
                    environment.error("型{0}のプロパティをロードできませんでした", slot.getType(), name);
                } else {
                    sortProperties.add(property);
                }
View Full Code Here

            Expression outputCache) {
        assert context != null;
        assert folding != null;
        assert summarizing != null;
        assert outputCache != null;
        Property property = summarizing.findProperty(folding.destination());
        Expression input = context.getProcessInput(context.getInputPort(Summarize.ID_INPUT));
        ModelFactory f = context.getModelFactory();
        // TODO for only DMDL
        switch (folding.aggregator()) {
        case MAX:
            return new ExpressionBuilder(f, property.createGetter(outputCache))
                .method("max", property.createGetter(input))
                .toStatement();
        case MIN:
            return new ExpressionBuilder(f, property.createGetter(outputCache))
                .method("min", property.createGetter(input))
                .toStatement();
        case SUM:
        case COUNT:
            return new ExpressionBuilder(f, property.createGetter(outputCache))
                .method("add", property.createGetter(input))
                .toStatement();
        default:
            throw new AssertionError();
        }
    }
View Full Code Here

                Context context,
                Summarized.Folding folding,
                DataClass input,
                DataClass output,
                Expression outputCache) {
            Property source = input.findProperty(folding.source());
            Property destination = output.findProperty(folding.destination());
            ModelFactory f = context.getModelFactory();
            // TODO for only DMDL
            switch (folding.aggregator()) {
            case ANY:
                return destination.createSetter(
                        outputCache,
                        source.createGetter(context.getInput()));
            case MAX:
            case MIN:
            case SUM:
                return new ExpressionBuilder(f, destination.createGetter(outputCache))
                    .method("modify", new ExpressionBuilder(f, source.createGetter(context.getInput()))
                        .method("get")
                        .toExpression())
                    .toStatement();
            case COUNT:
                return new ExpressionBuilder(f, destination.createGetter(outputCache))
                    .method("modify", Models.toLiteral(f, 1L))
                    .toStatement();
            default:
                throw new AssertionError();
            }
View Full Code Here

                        "グループ化項目の個数が一致しません: {0}",
                        first.getPort().getOwner());
                break;
            }
            for (int j = 0, m = group.size(); j < m; j++) {
                Property firstTerm = group.get(j).getSource();
                Property otherTerm = other.get(j).getSource();
                if (isCompatible(firstTerm.getType(), otherTerm.getType()) == false) {
                    environment.error(
                            "グループ化項目の種類が一致しません: {0}",
                            first.getPort().getOwner());
                }
            }
View Full Code Here

        }

        private FieldDeclaration createProperty(Segment segment, Term term) {
            assert segment != null;
            assert term != null;
            Property source = term.getSource();
            String name = ShuffleEmiterUtil.getPropertyName(segment, term);
            return factory.newFieldDeclaration(
                    new JavadocBuilder(factory)
                        .text("{0}#{1}が利用するキー ({2})",
                                segment.getPort().getOwner().getDescription().getName(),
                                segment.getPort().getDescription().getName(),
                                source.getName())
                        .toJavadoc(),
                    new AttributeBuilder(factory)
                        .Public()
                        .toAttributes(),
                    t(source.getType()),
                    factory.newSimpleName(name),
                    source.createNewInstance(t(source.getType())));
        }
View Full Code Here

        context.add(cache.createReset());
        Expression inputObject = context.getInput();
        Expression outputObject = cache.get();
        for (DataClass.Property sourceProperty : sourceType.getProperties()) {
            Property sinkProperty = sinkType.findProperty(sourceProperty.getName());
            if (sinkProperty == null) {
                getEnvironment().error(
                        "{0}において、{2}.{3}に対応するプロパティが{1}に定義されていません",
                        context.getOperatorDescription().getName(),
                        sinkType,
                        sourceType,
                        sourceProperty.getName());
            } else if (sourceProperty.getType().equals(sinkProperty.getType()) == false) {
                getEnvironment().error(
                        "{0}において、{1}.{2}と{3}.{4}のプロパティ型が一致しません",
                        context.getOperatorDescription().getName(),
                        sourceType,
                        sourceProperty.getName(),
                        sinkType,
                        sinkProperty.getName());
            } else {
                context.add(sinkProperty.createSetter(outputObject,
                        sourceProperty.createGetter(inputObject)));
            }
        }
    }
View Full Code Here

            for (Joined.Mapping mapping : term.mappings()) {
                if (saw.contains(mapping.destination())) {
                    continue;
                }
                saw.add(mapping.destination());
                Property sourceProperty = inputType.findProperty(mapping.source());
                Property destinationProperty = outputType.findProperty(mapping.destination());
                process.add(destinationProperty.createSetter(
                        resultCache.get(),
                        sourceProperty.createGetter(input)));
            }
        }
View Full Code Here

TOP

Related Classes of com.asakusafw.compiler.flow.DataClass.Property

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.