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

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


                .assignFrom(name)
                .toStatement();
        }

        private FieldDeclaration createPrivateField(Class<?> type, SimpleName name, boolean newInstance) {
            Expression initializer;
            if (newInstance) {
                initializer = new TypeBuilder(f, context.resolve(type))
                    .newObject()
                    .toExpression();
            } else {
View Full Code Here


                cases.add(factory.newSwitchCaseLabel(v(segment.getPortId())));
                for (Term term : segment.getTerms()) {
                    if (term.getArrangement() != Arrangement.GROUPING) {
                        continue;
                    }
                    Expression hash = term.getSource().createHashCode(
                            new ExpressionBuilder(factory, key)
                                .field(ShuffleEmiterUtil.getPropertyName(segment, term))
                                .toExpression());
                    cases.add(new ExpressionBuilder(factory, result)
                        .assignFrom(
View Full Code Here

        private List<Statement> createStatements(SimpleName argument) {
            assert argument != null;
            List<Statement> results = Lists.create();
            boolean end = false;
            Expression input = argument;
            Iterator<Factor> factors = fragment.getFactors().iterator();
            while (factors.hasNext()) {
                Factor factor = factors.next();
                if (factor.isLineEnd()) {
                    assert factors.hasNext() == false;
View Full Code Here

         * @return 対応する結果オブジェクト
         * @throws IllegalArgumentException 指定のポートを発見できない場合
         */
        public ResultMirror getOutput(FlowElementPortDescription port) {
            Precondition.checkMustNotBeNull(port, "port"); //$NON-NLS-1$
            Expression result = outputs.get(port);
            if (result == null) {
                throw new IllegalArgumentException(port.toString());
            }
            return new ResultMirror(factory, result);
        }
View Full Code Here

            return getCommonInput(port);
        }

        private Expression getCommonInput(FlowElementPortDescription port) {
            assert port != null;
            Expression input = inputs.get(port);
            if (input == null) {
                throw new IllegalArgumentException(port.toString());
            }
            return input;
        }
View Full Code Here

                    }));
            return decl;
        }

        private MethodDeclaration createGetPreferredFragmentSize() {
            Expression value = Models.toLiteral(f, -1L);
            return f.newMethodDeclaration(
                    null,
                    new AttributeBuilder(f)
                        .annotation(context.resolve(Override.class))
                        .Public()
View Full Code Here

                    Collections.singletonList(new ExpressionBuilder(f, value).toReturnStatement()));
        }

        private MethodDeclaration createGetMinimumFragmentSize() {
            boolean fastMode = isFastMode();
            Expression value = fastMode
                ? new TypeBuilder(f, context.resolve(Long.class)).field("MAX_VALUE").toExpression()
                : Models.toLiteral(f, -1L);
            return f.newMethodDeclaration(
                    null,
                    new AttributeBuilder(f)
View Full Code Here

            SimpleName fragmentSize = f.newSimpleName("fragmentSize");
            List<Statement> statements = Lists.create();
            statements.add(createNullCheck(dataType));
            statements.add(createNullCheck(path));
            statements.add(createNullCheck(stream));
            Expression isNotHead = new ExpressionBuilder(f, offset)
                .apply(InfixOperator.GREATER, Models.toLiteral(f, 0L))
                .toExpression();
            if (isFastMode() == false) {
                statements.add(f.newIfStatement(
                        isNotHead,
View Full Code Here

                    f.newBlock(f.newWhileStatement(Models.toLiteral(f, true), f.newBlock(body))));
            return decl;
        }

        private Expression blessInputStream(SimpleName stream) {
            Expression codec = createCompressionCodec();
            if (codec == null) {
                return stream;
            }
            return new ExpressionBuilder(f, codec)
                .method("createInputStream", stream)
View Full Code Here

                .method("createInputStream", stream)
                .toExpression();
        }

        private Expression blessOutputStream(SimpleName stream) {
            Expression codec = createCompressionCodec();
            if (codec == null) {
                return stream;
            }
            return new ExpressionBuilder(f, codec)
                .method("createOutputStream", stream)
View Full Code Here

TOP

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

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.