Examples of VariableDeclarationFragment


Examples of org.eclipse.jdt.core.dom.VariableDeclarationFragment

    org.eclipse.jdt.core.dom.Block block = ast.newBlock();
    /*
     * define the return value
     */
    SimpleName returnValueName = ast.newSimpleName("newGXTBean");
    VariableDeclarationFragment fragment = ast.newVariableDeclarationFragment();
    fragment.setName(returnValueName);
    ClassInstanceCreation newClassInstance = ast.newClassInstanceCreation();
    newClassInstance.setType((Type)returnType.copySubtree(ast, returnType));
    fragment.setInitializer(newClassInstance);
    VariableDeclarationStatement returnValue = ast.newVariableDeclarationStatement(fragment);
    returnValue.setType((Type)returnType.copySubtree(ast, returnType));
    block.statements().add(returnValue);
    /*
     * call each get method in the original and pass the result to the new set method
View Full Code Here

Examples of org.eclipse.jdt.core.dom.VariableDeclarationFragment

            Block body = ast.newBlock();
            body.statements().add(test);
            method.setBody(body);

            // Backup the old checkpoint.
            VariableDeclarationFragment fragment = ast
                    .newVariableDeclarationFragment();
            fragment.setName(ast.newSimpleName("oldCheckpoint"));
            fragment.setInitializer(ast.newSimpleName(CHECKPOINT_NAME));

            VariableDeclarationStatement tempDeclaration = ast
                    .newVariableDeclarationStatement(fragment);
            tempDeclaration.setType(createType(ast, checkpointType));
            thenBranch.statements().add(tempDeclaration);
View Full Code Here

Examples of org.eclipse.jdt.core.dom.VariableDeclarationFragment

                    // Iterate over all the fragments in the field declaration.
                    Iterator fragmentIter = fieldDecl.fragments().iterator();

                    while (fragmentIter.hasNext()) {
                        VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragmentIter
                                .next();
                        String fieldName = fragment.getName().getIdentifier();

                        // Get the list of numbers of indices.
                        Hashtable[] tables = new Hashtable[] { _accessedFields,
                                _specialAccessedFields, _backupFields };
View Full Code Here

Examples of org.eclipse.jdt.core.dom.VariableDeclarationFragment

        node.getType().accept(this);
        _output(" ");

        for (Iterator it = node.fragments().iterator(); it.hasNext();) {
            VariableDeclarationFragment f = (VariableDeclarationFragment) it
                    .next();
            f.accept(this);

            if (it.hasNext()) {
                _output(", ");
            }
        }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.VariableDeclarationFragment

        node.getType().accept(this);
        _output(" ");

        for (Iterator it = node.fragments().iterator(); it.hasNext();) {
            VariableDeclarationFragment f = (VariableDeclarationFragment) it
                    .next();
            f.accept(this);

            if (it.hasNext()) {
                _output(", ");
            }
        }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.VariableDeclarationFragment

        node.getType().accept(this);
        _output(" ");

        for (Iterator it = node.fragments().iterator(); it.hasNext();) {
            VariableDeclarationFragment f = (VariableDeclarationFragment) it
                    .next();
            f.accept(this);

            if (it.hasNext()) {
                _output(", ");
            }
        }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.VariableDeclarationFragment

                && (state.getCrossAnalyzedTypes().contains(parent.getName()) || isFieldDuplicated(
                        parent, CHECKPOINT_NAME))) {
            return null;
        }

        VariableDeclarationFragment fragment = ast
                .newVariableDeclarationFragment();
        fragment.setName(ast.newSimpleName(CHECKPOINT_NAME));

        ClassInstanceCreation checkpoint = ast.newClassInstanceCreation();
        String typeName = getClassName(Checkpoint.class, state, root);
        checkpoint.setType(ast.newSimpleType(createName(ast, typeName)));
        checkpoint.arguments().add(ast.newThisExpression());
        fragment.setInitializer(checkpoint);

        FieldDeclaration checkpointField = ast.newFieldDeclaration(fragment);
        checkpointField.setType(createType(ast, typeName));

        checkpointField.modifiers().add(
View Full Code Here

Examples of org.eclipse.jdt.core.dom.VariableDeclarationFragment

                && state.getCrossAnalyzedTypes().contains(parent.getName()) || isFieldDuplicated(
                parent, CHECKPOINT_RECORD_NAME))) {
            return null;
        }

        VariableDeclarationFragment fragment = ast
                .newVariableDeclarationFragment();
        fragment.setName(ast.newSimpleName(CHECKPOINT_RECORD_NAME));

        ClassInstanceCreation creation = ast.newClassInstanceCreation();
        String typeName = getClassName(CheckpointRecord.class, state, root);
        creation.setType(ast.newSimpleType(createName(ast, typeName)));
        fragment.setInitializer(creation);

        FieldDeclaration record = ast.newFieldDeclaration(fragment);
        record.setType(createType(ast, typeName));
        record.modifiers().add(
                ast.newModifier(Modifier.ModifierKeyword.PROTECTED_KEYWORD));
View Full Code Here

Examples of org.eclipse.jdt.core.dom.VariableDeclarationFragment

        }

        String typeName = getClassName(FieldRecord.class, state, root);

        // The only fragment of this field declaration.
        VariableDeclarationFragment fragment = ast
                .newVariableDeclarationFragment();
        fragment.setName(ast.newSimpleName(recordName));

        // Create the initializer, and use the number of dimensions as its
        // argument.
        ClassInstanceCreation initializer = ast.newClassInstanceCreation();
        initializer.setType(ast.newSimpleType(createName(ast, typeName)));
        initializer.arguments().add(
                ast.newNumberLiteral(Integer.toString(dimensions)));
        fragment.setInitializer(initializer);

        // The field declaration.
        FieldDeclaration field = ast.newFieldDeclaration(fragment);
        field.setType(createType(ast, typeName));
View Full Code Here

Examples of org.eclipse.jdt.core.dom.VariableDeclarationFragment

     @param fieldNames The names of all the fields.
     *  @return The field declaration of the record array.
     */
    private FieldDeclaration _createRecordArray(AST ast, CompilationUnit root,
            TypeAnalyzerState state, List fieldNames) {
        VariableDeclarationFragment fragment = ast
                .newVariableDeclarationFragment();
        fragment.setName(ast.newSimpleName(RECORDS_NAME));

        ArrayCreation initializer = ast.newArrayCreation();
        String typeName = getClassName(FieldRecord.class, state, root);
        initializer.setType(ast.newArrayType(createType(ast, typeName)));

        Iterator fields = fieldNames.iterator();
        ArrayInitializer arrayInitializer = ast.newArrayInitializer();
        initializer.setInitializer(arrayInitializer);

        List expressions = arrayInitializer.expressions();

        while (fields.hasNext()) {
            String fieldName = (String) fields.next();

            String recordName = _getRecordName(fieldName);
            expressions.add(ast.newSimpleName(recordName));
        }

        fragment.setInitializer(initializer);

        FieldDeclaration array = ast.newFieldDeclaration(fragment);
        array.setType(ast.newArrayType(createType(ast, typeName)));

        array.modifiers().add(
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.