Package com.asakusafw.utils.java.model.syntax

Examples of com.asakusafw.utils.java.model.syntax.SimpleName


    }

    private MethodDeclaration createInliner(NamedType objectType, NameGenerator names) {
        assert objectType != null;
        assert names != null;
        SimpleName optimize = names.create("optimize");
        return factory.newMethodDeclaration(
                new JavadocBuilder(factory)
                    .text("このフロー部品のインライン化状態を設定する。")
                    .param(optimize)
                        .text("trueならば最適化を行い、falseならばステージ構成を保持する")
View Full Code Here


    private List<FormalParameterDeclaration> createParametersForConstructor(
            NameGenerator names) {
        List<FormalParameterDeclaration> parameters = Lists.create();
        for (OperatorPortDeclaration var : flowClass.getInputPorts()) {
            SimpleName name = factory.newSimpleName(names.reserve(var.getName()));
            parameters.add(factory.newFormalParameterDeclaration(
                    util.toSourceType(var.getType().getRepresentation()),
                    name));
        }
        for (OperatorPortDeclaration var : flowClass.getParameters()) {
            SimpleName name = factory.newSimpleName(names.reserve(var.getName()));
            parameters.add(factory.newFormalParameterDeclaration(
                    util.t(var.getType().getRepresentation()),
                    name));
        }
        return parameters;
View Full Code Here

    private List<Statement> createBodyForConstructor(
            List<FormalParameterDeclaration> parameters,
            NameGenerator names) {
        assert parameters != null;
        List<Statement> statements = Lists.create();
        SimpleName builderName = names.create("builder");
        statements.add(new TypeBuilder(factory, util.t(FlowPartDescription.Builder.class))
            .newObject(factory.newClassLiteral(util.t(flowClass.getElement())))
            .toLocalVariableDeclaration(util.t(FlowPartDescription.Builder.class),
                    builderName));

        Expression[] arguments = new Expression[
                flowClass.getInputPorts().size()
                + flowClass.getOutputPorts().size()
                + flowClass.getParameters().size()
                ];
        for (OperatorPortDeclaration var : flowClass.getInputPorts()) {
            SimpleName name = names.create(var.getName());
            statements.add(new ExpressionBuilder(factory, builderName)
                .method("addInput",
                        util.v(var.getName()),
                        factory.newSimpleName(var.getType().getReference()))
                .toLocalVariableDeclaration(
                        util.toInType(var.getType().getRepresentation()),
                        name));
            arguments[var.getParameterPosition()] = name;
        }
        for (OperatorPortDeclaration var : flowClass.getOutputPorts()) {
            SimpleName name = names.create(var.getName());
            Expression type = toExpression(var);
            assert type != null;
            statements.add(new ExpressionBuilder(factory, builderName)
                .method("addOutput", util.v(var.getName()), type)
                .toLocalVariableDeclaration(
                        util.toOutType(var.getType().getRepresentation()),
                        name));
            arguments[var.getParameterPosition()] = name;
        }
        for (OperatorPortDeclaration var : flowClass.getParameters()) {
            Expression type = toExpression(var);
            SimpleName name = factory.newSimpleName(var.getName());
            statements.add(new ExpressionBuilder(factory, builderName)
                .method("addParameter",
                    util.v(var.getName()),
                    type,
                    name)
                .toStatement());
            arguments[var.getParameterPosition()] = name;
        }
        SimpleName descName = names.create("desc");
        statements.add(new TypeBuilder(factory, getType(util.t(flowClass.getElement())))
            .newObject(arguments)
            .toLocalVariableDeclaration(util.t(FlowDescription.class), descName));

        Expression resolver = new ExpressionBuilder(factory, factory.newThis())
View Full Code Here

        javadoc.inline(flowClass.getDocumentation());
        List<FormalParameterDeclaration> parameters = Lists.create();
        List<Expression> arguments = Lists.create();
        List<Expression> inputMetaData = Lists.create();
        for (OperatorPortDeclaration var : flowClass.getInputPorts()) {
            SimpleName name = factory.newSimpleName(var.getName());
            javadoc.param(name).inline(var.getDocumentation());
            parameters.add(util.toFactoryMethodInput(var, name));
            inputMetaData.add(util.toMetaData(var, arguments.size()));
            arguments.add(name);
        }
        List<Expression> outputMetaData = Lists.create();
        for (OperatorPortDeclaration var : flowClass.getOutputPorts()) {
            outputMetaData.add(util.toMetaData(var, -1));
        }
        List<Expression> parameterMetaData = Lists.create();
        for (OperatorPortDeclaration var : flowClass.getParameters()) {
            SimpleName name = factory.newSimpleName(var.getName());
            javadoc.param(name).inline(var.getDocumentation());
            parameters.add(factory.newFormalParameterDeclaration(
                    util.t(var.getType().getRepresentation()),
                    name));
            parameterMetaData.add(util.toMetaData(var, arguments.size()));
View Full Code Here

            DistributeEngine engine = new DistributeEngine(environment, moduleId, slot);
            source = engine.generate();
        }
        environment.emit(source);
        Name packageName = source.getPackageDeclaration().getName();
        SimpleName simpleName = source.getTypeDeclarations().get(0).getName();
        Name name = environment.getModelFactory().newQualifiedName(packageName, simpleName);
        LOG.debug("Mapper for output \"{}\" in epilogue phase is {}",
                slot.getSource().getOutputName(),
                name);
        return new CompiledType(name);
View Full Code Here

            arguments = arguments.subList(0, selector.getParameterTypes().size());
        }

        context.addProcess(tx, list.createEnd());
        Expression impl = context.createImplementation();
        SimpleName selected = context.createName("selected");
        context.addProcess(tx, new ExpressionBuilder(f, impl)
            .method(selector.getName(), arguments)
            .toLocalVariableDeclaration(
                    context.convert(master.getDataType()),
                    selected));
View Full Code Here

                    Collections.singletonList(type),
                    Collections.<Comment>emptyList());
        }

        private TypeDeclaration createType() {
            SimpleName name = factory.newSimpleName(Naming.getMapClass(0));
            importer.resolvePackageMember(name);
            return factory.newClassDeclaration(
                    new JavadocBuilder(factory)
                        .text("Mapper for output \"{0}\" in epilogue phase.", slot.getSource().getOutputName())
                        .toJavadoc(),
View Full Code Here

        assert importer != null;
        this.factory = environment.getModelFactory();
        this.fragment = fragment;
        this.importer = importer;
        for (ResourceFragment resource : fragment.getResources()) {
            SimpleName name = names.create("resource");
            resources.put(resource.getDescription(), name);
        }
        for (FlowElementOutput output : fragment.getOutputPorts()) {
            SimpleName name = names.create(output.getDescription().getName());
            successors.put(output, name);
        }
    }
View Full Code Here

        JavadocBuilder javadoc = new JavadocBuilder(factory)
            .text("インスタンスを生成する。");
        List<FormalParameterDeclaration> parameters = Lists.create();
        List<Statement> statements = Lists.create();
        for (ResourceFragment resource : fragment.getResources()) {
            SimpleName param = getResource(resource.getDescription());
            javadoc.param(param)
                .text(resource.getDescription().toString());
            parameters.add(factory.newFormalParameterDeclaration(
                    importer.toType(resource.getCompiled().getQualifiedName()),
                    param));
            statements.add(new ExpressionBuilder(factory, factory.newThis())
                .field(param)
                .assignFrom(param)
                .toStatement());
        }
        for (FlowElementOutput output : fragment.getOutputPorts()) {
            SimpleName chain = successors.get(output);
            assert chain != null;
            javadoc.param(chain)
                .code("{0}#{1}",
                        output.getOwner().getDescription().getName(),
                        output.getDescription().getName())
View Full Code Here

                null);
    }

    private SimpleName getResource(FlowResourceDescription description) {
        Precondition.checkMustNotBeNull(description, "description"); //$NON-NLS-1$
        SimpleName name = resources.get(description);
        Precondition.checkMustNotBeNull(name, "name"); //$NON-NLS-1$
        return name;
    }
View Full Code Here

TOP

Related Classes of com.asakusafw.utils.java.model.syntax.SimpleName

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.