KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > java > source > engine > TreeMakerInt


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.modules.java.source.engine;
20
21 import com.sun.source.tree.*;
22 import com.sun.source.tree.Tree.Kind;
23
24 import javax.lang.model.element.*;
25 import javax.lang.model.type.*;
26 import javax.tools.JavaFileObject;
27
28 import java.util.List JavaDoc;
29 import java.util.Set JavaDoc;
30
31 /**
32  * Factory interface for creating new com.sun.source.tree instances. The
33  * parameters for each method correspond as closely as possible to the
34  * accessor methods for each tree interface.
35  */

36 public interface TreeMakerInt {
37
38     /**
39      * Creates a new AnnotationTree.
40      *
41      * @param type the annotation type.
42      * @param arguments the arguments for this annotation, or an empty list.
43      * @see com.sun.source.tree.AnnotationTree
44      */

45     AnnotationTree Annotation(Tree type, List JavaDoc<? extends ExpressionTree> arguments);
46     
47     /**
48      * Creates a new ArrayAccessTree.
49      *
50      * @param array the array expression.
51      * @param index the array index.
52      * @see com.sun.source.tree.ArrayAccessTree
53      */

54     ArrayAccessTree ArrayAccess(ExpressionTree array, ExpressionTree index);
55     
56     /**
57      * Creates a new ArrayTypeTree.
58      *
59      * @param type the array type.
60      * @see com.sun.source.tree.ArrayTypeTree
61      */

62     ArrayTypeTree ArrayType(Tree type);
63     
64     /**
65      * Creates a new AssertTree.
66      *
67      * @param condition the boolean expression to test.
68      * @param detail the detail message to include if the assertion fails.
69      * @see com.sun.source.tree.AssertTree
70      */

71     AssertTree Assert(ExpressionTree condition, ExpressionTree detail);
72     
73     /**
74      * Creates a new AssignmentTree.
75      *
76      * @param variable the variable the expression is assigned to.
77      * @param expression the expression to assign to the variable.
78      * @see com.sun.source.tree.AssignmentTree
79      */

80     AssignmentTree Assignment(ExpressionTree variable, ExpressionTree expression);
81
82     /**
83      * Creates a new BinaryTree.
84      *
85      * @param operator the operator for this tree, such as Tree.Kind.PLUS.
86      * @param left the left operand of the tree.
87      * @param right the right operand of the tree.
88      * @see com.sun.source.tree.BinaryTree
89      * @see com.sun.source.tree.Tree.Kind
90      */

91     BinaryTree Binary(Kind operator, ExpressionTree left, ExpressionTree right);
92
93     /**
94      * Creates a new BlockTree.
95      *
96      * @param statements the list of statements to be contained within the block.
97      * @param isStatic true if the block defines a static initializer for a class. ExpressionTree getCondition();
98     ExpressionTree getDetail();
99
100      * @see com.sun.source.tree.BlockTree
101      */

102     BlockTree Block(List JavaDoc<? extends StatementTree> statements, boolean isStatic);
103     
104     /**
105      * Creates a new BreakTree.
106      *
107      * @param label the label to break to, or null if there is no label.
108      * @see com.sun.source.tree.BreakTree
109      */

110     BreakTree Break(CharSequence JavaDoc label);
111     
112     /**
113      * Creates a new CaseTree.
114      *
115      * @param expression the label for this case statement.
116      * @param statements the list of statements.
117      * @see com.sun.source.tree.CaseTree
118      */

119     CaseTree Case(ExpressionTree expression, List JavaDoc<? extends StatementTree> statements);
120     
121     /**
122      * Creates a new CatchTree.
123      *
124      * @param parameter the exception variable declaration.
125      * @param block the block of statements executed by this catch statement.
126      * @see com.sun.source.tree.CatchTree
127      */

128     CatchTree Catch(VariableTree parameter, BlockTree block);
129     
130     /**
131      * Creates a new ClassTree.
132      *
133      * @param modifiers the modifiers declaration
134      * @param simpleName the name of the class without its package, such
135      * as "String" for the class "java.lang.String".
136      * @param typeParameters the list of type parameters, or an empty list.
137      * @param extendsClause the name of the class this class extends, or null.
138      * @param implementsClauses the list of the interfaces this class
139      * implements, or an empty list.
140      * @param memberDecls the list of fields defined by this class, or an
141      * empty list.
142      * @see com.sun.source.tree.ClassTree
143      */

144     ClassTree Class(ModifiersTree modifiers,
145               CharSequence JavaDoc simpleName,
146               List JavaDoc<? extends TypeParameterTree> typeParameters,
147               Tree extendsClause,
148               List JavaDoc<? extends ExpressionTree> implementsClauses,
149               List JavaDoc<? extends Tree> memberDecls);
150
151     /**
152      * Creates a new ClassTree representing interface.
153      *
154      * @param modifiers the modifiers declaration
155      * @param simpleName the name of the class without its package, such
156      * as "String" for the class "java.lang.String".
157      * @param typeParameters the list of type parameters, or an empty list.
158      * @param extendsClauses the list of the interfaces this class
159      * extends, or an empty list.
160      * @param memberDecls the list of fields defined by this class, or an
161      * empty list.
162      * @see com.sun.source.tree.ClassTree
163      */

164     ClassTree Interface(ModifiersTree modifiers,
165              CharSequence JavaDoc simpleName,
166              List JavaDoc<? extends TypeParameterTree> typeParameters,
167              List JavaDoc<? extends ExpressionTree> extendsClauses,
168              List JavaDoc<? extends Tree> memberDecls);
169     
170     /**
171      * Creates a new ClassTree representing annotation type.
172      *
173      * @param modifiers the modifiers declaration
174      * @param simpleName the name of the class without its package, such
175      * as "String" for the class "java.lang.String".
176      * @param memberDecls the list of fields defined by this class, or an
177      * empty list.
178      * @see com.sun.source.tree.ClassTree
179      */

180     ClassTree AnnotationType(ModifiersTree modifiers,
181              CharSequence JavaDoc simpleName,
182              List JavaDoc<? extends Tree> memberDecls);
183     
184     /**
185      * Creates a new ClassTree representing enum.
186      *
187      * @param modifiers the modifiers declaration
188      * @param simpleName the name of the class without its package, such
189      * as "String" for the class "java.lang.String".
190      * @param implementsClauses the list of the interfaces this class
191      * implements, or an empty list.
192      * @param memberDecls the list of fields defined by this class, or an
193      * empty list.
194      * @see com.sun.source.tree.ClassTree
195      */

196     ClassTree Enum(ModifiersTree modifiers,
197              CharSequence JavaDoc simpleName,
198              List JavaDoc<? extends ExpressionTree> implementsClauses,
199              List JavaDoc<? extends Tree> memberDecls);
200     
201     /**
202      * Creates a new CompilationUnitTree.
203      *
204      * @param packageName a tree representing the package name.
205      * @param imports a list of import statements.
206      * @param typeDeclarations a list of type (class, interface or enum) declarations.
207      * @param sourceFile the source file associated with this compilation unit.
208      * @see com.sun.source.tree.CompilationUnitTree
209      */

210     
211     CompilationUnitTree CompilationUnit(ExpressionTree packageName,
212                                         List JavaDoc<? extends ImportTree> imports,
213                                         List JavaDoc<? extends Tree> typeDeclarations,
214                                         JavaFileObject sourceFile);
215      
216     /**
217      * Creates a new CompoundAssignmentTree.
218      *
219      * @param operator the operator for this tree, such as Tree.Kind.PLUS_ASSIGNMENT.
220      * @param variable the variable the expression is assigned to.
221      * @param expression the expression to assign to the variable.
222      * @see com.sun.source.tree.CompoundAssignmentTree
223      */

224     CompoundAssignmentTree CompoundAssignment(Kind operator,
225                                               ExpressionTree variable,
226                                               ExpressionTree expression);
227    
228     /**
229      * Creates a new ConditionalExpressionTree.
230      *
231      * @param condition the boolean expression to test.
232      * @param trueExpression the expression to be executed when the
233      * condition is true.
234      * @param falseExpression the expression to be executed when the
235      * condition is false.
236      * @see com.sun.source.tree.ConditionalExpressionTree
237      */

238     ConditionalExpressionTree ConditionalExpression(ExpressionTree condition,
239                                                     ExpressionTree trueExpression,
240                                                     ExpressionTree falseExpression);
241     
242     /**
243      * Creates a new ContinueTree.
244      *
245      * @param label the label to break to, or null if there is no label.
246      * @see com.sun.source.tree.ContinueTree
247      */

248     ContinueTree Continue(CharSequence JavaDoc label);
249     
250     /** Creates a new DoWhileLoopTree.
251      *
252      * @param condition the boolean expression to test.
253      * @param statement the statement to execute while the condition is true.
254      * @see com.sun.source.tree.DoWhileLoopTree
255      */

256     DoWhileLoopTree DoWhileLoop(ExpressionTree condition, StatementTree statement);
257
258     /**
259      * Creates a new EmptyStatementTree.
260      *
261      * @see com.sun.source.tree.EmptyStatementTree
262      */

263     EmptyStatementTree EmptyStatement();
264     
265     /**
266      * Creates a new EnhancedForLoopTree.
267      *
268      * @param variable the loop variable declaration.
269      * @param expression the expression to be iterated.
270      * @param statement the statement to execute each iteration.
271      * @see com.sun.source.tree.EnhancedForLoopTree
272      */

273     EnhancedForLoopTree EnhancedForLoop(VariableTree variable,
274                                         ExpressionTree expression,
275                                         StatementTree statement);
276     
277     /**
278      * Creates a new ErroneousTree.
279      *
280      * @param errorTrees a list of trees with possible errors.
281      * @see com.sun.source.tree.ErroneousTree
282      */

283     ErroneousTree Erroneous(List JavaDoc<? extends Tree> errorTrees);
284     
285     /**
286      * Creates a new ExpressionStatementTree.
287      *
288      * @param expression the expression body for this statement.
289      * @see com.sun.source.tree.ExpressionStatementTree
290      */

291     ExpressionStatementTree ExpressionStatement(ExpressionTree expression);
292     
293     /**
294      * Creates a new ForLoopTree.
295      *
296      * @param initializer a list of initializer statements, or an empty list.
297      * @param condition the condition to evaluate after each iteration.
298      * @param update the statements to execute after each iteration.
299      * @param statement the statement to execute for each iteration.
300      * @see com.sun.source.tree.ForLoopTree
301      */

302     ForLoopTree ForLoop(List JavaDoc<? extends StatementTree> initializer,
303                         ExpressionTree condition,
304                         List JavaDoc<? extends ExpressionStatementTree> update,
305                         StatementTree statement);
306     
307     /**
308      * Creates a new IdentifierTree.
309      *
310      * @param name the name of the identifier.
311      * @see com.sun.source.tree.IdentifierTree
312      */

313     IdentifierTree Identifier(CharSequence JavaDoc name);
314     
315     /**
316      * Creates a new IdentifierTree from an Element.
317      *
318      * @param element the element from which to extract the identifier name.
319      * @see com.sun.source.tree.IdentifierTree
320      * @see javax.lang.model.element.Element
321      */

322     IdentifierTree Identifier(Element element);
323      
324     
325     /** Creates a new IfTree.
326      *
327      * @param condition the boolean expression to test.
328      * @param thenStatement the statement to execute if the condition is true.
329      * @param elseStatement the statement to execute if the condition if false.
330      * A null value should be used if there is no else
331      * statement.
332      * @see com.sun.source.tree.IfTree
333      */

334     IfTree If(ExpressionTree condition, StatementTree thenStatement, StatementTree elseStatement);
335     
336     /**
337      * Creates a new ImportTree.
338      *
339      * @param qualid fully qualified identifier.
340      * @param importStatic true if static import statement.
341      * @see com.sun.source.tree.ImportTree
342      */

343     ImportTree Import(Tree qualid, boolean importStatic);
344     
345     /**
346      * Creates a new InstanceOfTree.
347      *
348      * @param expression the expression whose type is being checked.
349      * @param type the type to compare to.
350      * @see com.sun.source.tree.InstanceOfTree
351      */

352     InstanceOfTree InstanceOf(ExpressionTree expression, Tree type);
353     
354     /**
355      * Creates a new LabeledStatementTree.
356      *
357      * @param label the label string.
358      * @param statement the statement being labeled.
359      * @see com.sun.source.tree.LabeledStatementTree
360      */

361     LabeledStatementTree LabeledStatement(CharSequence JavaDoc label, StatementTree statement);
362     
363     /**
364      * Creates a new LiteralTree. Only literals which are wrappers for
365      * primitive types (Integer, Boolean, etc.) and String instances can
366      * be literals.
367      *
368      * @param value the value of the literal.
369      * @throws IllegalArgumentException for illegal literal values.
370      * @see com.sun.source.tree.LiteralTree
371      */

372     LiteralTree Literal(Object JavaDoc value);
373     
374     /**
375      * Creates a new MemberSelectTree. A MemberSelectTree consists of an
376      * expression and an identifier. Valid expressions include things like
377      * packages, class and field references, etc., while the identifier is a
378      * "child" of the expression. For example, "System.out" is represented by
379      * MemberSelectTree which has an ExpressionTree representing "System" and
380      * an identifier of "out".
381      *
382      * @param expression the expression the identifier is part of.
383      * @param identifier the element to select.
384      * @see com.sun.source.tree.MemberSelectTree
385      */

386     MemberSelectTree MemberSelect(ExpressionTree expression, CharSequence JavaDoc identifier);
387
388     /**
389      * Creates a new MemberSelectTree from an expression and an element.
390      *
391      * @param expression the expression the identifier is part of.
392      * @param element the element that provides the identifier name.
393      * @see com.sun.source.tree.MemberSelectTree
394      * @see javax.lang.model.element.Element
395      */

396     MemberSelectTree MemberSelect(ExpressionTree expression, Element element);
397     
398     /**
399      * Creates a new MethodInvocationTree.
400      *
401      * @param typeArguments the list of generic type arguments, or an empty list.
402      * @param method the method to be invoked.
403      * @param arguments the list of arguments to pass to the method, or an empty list.
404      * @see com.sun.source.tree.MethodInvocationTree
405      */

406     MethodInvocationTree MethodInvocation(List JavaDoc<? extends ExpressionTree> typeArguments,
407                                           ExpressionTree method,
408                                           List JavaDoc<? extends ExpressionTree> arguments);
409     
410     /**
411      * Creates a new MethodTree.
412      *
413      * @param modifiers the modifiers of this method.
414      * @param name the name of the method.
415      * @param returnType the return type for this method.
416      * @param typeParameters the list of generic type parameters, or an empty list.
417      * @param parameters the list of parameters, or an empty list.
418      * @param throwsList the list of throws clauses, or an empty list.
419      * @param body the method's code block.
420      * @param defaultValue the default value, used by annotation types.
421      * @see com.sun.source.tree.MethodTree
422      */

423     MethodTree Method(ModifiersTree modifiers,
424                       CharSequence JavaDoc name,
425                       Tree returnType,
426                       List JavaDoc<? extends TypeParameterTree> typeParameters,
427                       List JavaDoc<? extends VariableTree> parameters,
428                       List JavaDoc<? extends ExpressionTree> throwsList,
429                       BlockTree body,
430                       ExpressionTree defaultValue);
431     
432     /**
433      * Creates a new MethodTree.
434      *
435      * @param modifiers the modifiers of this method.
436      * @param name the name of the method.
437      * @param returnType the return type for this method.
438      * @param typeParameters the list of generic type parameters, or an empty list.
439      * @param parameters the list of parameters, or an empty list.
440      * @param throwsList the list of throws clauses, or an empty list.
441      * @param body the method's code block.
442      * @param defaultValue the default value, used by annotation types.
443      * @param enclosingElement the type instance this method is a member of.
444      * @see com.sun.source.tree.MethodTree
445      */

446     MethodTree Method(ModifiersTree modifiers,
447                       CharSequence JavaDoc name,
448                       Tree returnType,
449                       List JavaDoc<? extends TypeParameterTree> typeParameters,
450                       List JavaDoc<? extends VariableTree> parameters,
451                       List JavaDoc<? extends ExpressionTree> throwsList,
452                       BlockTree body,
453                       ExpressionTree defaultValue,
454                       TypeElement enclosingElement);
455     
456     /**
457      * Creates a new MethodTree from an ExecutableElement and a BlockTree.
458      *
459      * @param element the executable element of this method.
460      * @param body the method's code block, or null for native, abstract,
461      * and interface methods.
462      * @see com.sun.source.tree.MethodTree
463      * @see javax.lang.model.element.ExecutableElement
464      */

465     MethodTree Method(ExecutableElement element, BlockTree body);
466     
467     /**
468      * Creates a new ModifiersTree with a new set of flags and annotations.
469      *
470      * @param flags the set of modifier flags
471      * @param annotations a list of annotations, or an empty list.
472      * @see com.sun.source.tree.ModifiersTree
473      * @see javax.lang.model.element.Modifier
474      */

475     ModifiersTree Modifiers(Set JavaDoc<Modifier> flags, List JavaDoc<? extends AnnotationTree> annotations);
476     
477     /**
478      * Creates a new ModifiersTree without any annotations specified.
479      *
480      * @param flags the set of modifier flags
481      * @see com.sun.source.tree.ModifiersTree
482      * @see javax.lang.model.element.Modifier
483      */

484     ModifiersTree Modifiers(Set JavaDoc<Modifier> flags);
485     
486     /**
487      * Creates a new ModifiersTree with a new flags and annotation.
488      *
489      * @param flags modifier flags
490      * @see com.sun.source.tree.ModifiersTree
491      */

492     ModifiersTree Modifiers(long flags, List JavaDoc<? extends AnnotationTree> annotations);
493     
494     /**
495      * Creates a new ModifiersTree with a new set of annotations. The existing
496      * flags are copied from the old tree; this preserves private javac flags.
497      *
498      * @param oldMods the old ModifiersTree, from which the flags are copied.
499      * @param annotations a list of annotations, or an empty list.
500      * @see com.sun.source.tree.ModifiersTree
501      * @see javax.lang.model.element.Modifier
502      */

503     ModifiersTree Modifiers(ModifiersTree oldMods, List JavaDoc<? extends AnnotationTree> annotations);
504     
505     /**
506      * Creates a new NewArrayTree.
507      *
508      * @param elemtype the element type.
509      * @param dimensions the list of array dimensions.
510      * @param initializers the list of initializer statements, or an empty list.
511      * @see com.sun.source.tree.NewArrayTree
512      */

513     NewArrayTree NewArray(Tree elemtype,
514                           List JavaDoc<? extends ExpressionTree> dimensions,
515                           List JavaDoc<? extends ExpressionTree> initializers);
516
517     /**
518      * Creates a new NewClassTree.
519      *
520      * @param enclosingExpression the enclosing expression, or null.
521      * @param typeArguments the list of generic type arguments, or an empty list.
522      * @param identifier the class name expression
523      * @param arguments the list of constructor arguments, or an empty list.
524      * @param classBody the class definition, or null if there is no definition.
525      * @see com.sun.source.tree.NewClassTree
526      */

527     NewClassTree NewClass(ExpressionTree enclosingExpression,
528                           List JavaDoc<? extends ExpressionTree> typeArguments,
529                           ExpressionTree identifier,
530                           List JavaDoc<? extends ExpressionTree> arguments,
531                           ClassTree classBody);
532
533     /**
534      * Creates a new RootTree.
535      *
536      * @param name the simple (not fully-qualifed) name of the package.
537      * @param packages the list of sub-packages, with either an empty list or
538      * or null if there are not any.
539      * @param units the list of compilation units (source files) that declare
540      * themselves part of this package.
541      * @see org.netbeans.modules.java.source.engine.RootTree
542      */

543     RootTree Root(List JavaDoc<CompilationUnitTree> units);
544     
545     /**
546      * Creates a new ParameterizedTypeTree.
547      *
548      * @param type the generic type
549      * @param typeArguments the list of generic type arguments, or an empty list.
550      * @see com.sun.source.tree.ParameterizedTypeTree
551      */

552     ParameterizedTypeTree ParameterizedType(Tree type,
553                                             List JavaDoc<? extends ExpressionTree> typeArguments);
554     
555     /**
556      * Creates a new ParenthesizedTree.
557      *
558      * @param expression the expression within the parentheses.
559      * @see com.sun.source.tree.ParenthesizedTree
560      */

561     ParenthesizedTree Parenthesized(ExpressionTree expression);
562     
563     /**
564      * Creates a new PrimitiveTypeTree.
565      *
566      * @param typekind the primitive type.
567      * @see com.sun.source.tree.PrimitiveTypeTree
568      * @see javax.lang.model.type.TypeKind
569      */

570     PrimitiveTypeTree PrimitiveType(TypeKind typekind);
571     
572     /**
573      * Creates a qualified identifier from an element.
574      *
575      * @param element the element to use.
576      */

577     ExpressionTree QualIdent(Element element);
578     
579     /**
580      * Creates a qualified identifier from an element - internal, not to be used outside of jbrowse:
581      *
582      * @param element the element to use.
583      */

584     ExpressionTree QualIdentImpl(Element element);
585     
586     /**
587      * Creates a new ReturnTree.
588      *
589      * @param expression the expression to be returned.
590      * @see com.sun.source.tree.ReturnTree
591      */

592     ReturnTree Return(ExpressionTree expression);
593     
594     /**
595      * Creates a new SwitchTree.
596      *
597      * @param expression the expression which provides the value to be switched.
598      * @param cases the list of cases, or an empty list.
599      * @see com.sun.source.tree.SwitchTree
600      */

601     SwitchTree Switch(ExpressionTree expression, List JavaDoc<? extends CaseTree> cases);
602     
603     /**
604      * Creates a new SynchronizedTree.
605      *
606      * @param expression the expression defining the object being synchronized.
607      * @param block the block of statements executed by this statement.
608      * @see com.sun.source.tree.SynchronizedTree
609      */

610     SynchronizedTree Synchronized(ExpressionTree expression, BlockTree block);
611     
612     /**
613      * Creates a new ThrowTree.
614      *
615      * @param expression the exception to be thrown.
616      * @see com.sun.source.tree.ThrowTree
617      */

618     ThrowTree Throw(ExpressionTree expression);
619     
620     /**
621      * Creates a new TryTree.
622      *
623      * @param tryBlock the statement block in the try clause.
624      * @param catches the list of catch clauses, or an empty list.
625      * @param finallyBlock the finally clause, or null.
626      * @see com.sun.source.tree.TryTree
627      */

628     TryTree Try(BlockTree tryBlock,
629                 List JavaDoc<? extends CatchTree> catches,
630                 BlockTree finallyBlock);
631     
632     /**
633      * Creates a new Tree for a given TypeMirror.
634      *
635      * @param type TypeMirror for which a Tree should be created
636      * @see com.sun.source.tree.ExpressionTree
637      */

638     Tree Type(TypeMirror type);
639
640     /**
641      * Creates a new TypeCastTree.
642      *
643      * @param type the class or interface to cast.
644      * @param expression the expression being cast.
645      * @see com.sun.source.tree.TypeCastTree
646      */

647     TypeCastTree TypeCast(Tree type, ExpressionTree expression);
648     
649     /**
650      * Creates a new TypeParameterTree.
651      *
652      * @param name the name of this type parameter.
653      * @param bounds the bounds of this parameter.
654      * @see com.sun.source.tree.TypeParameterTree
655      */

656     TypeParameterTree TypeParameter(CharSequence JavaDoc name,
657                                     List JavaDoc<? extends ExpressionTree> bounds);
658
659     /**
660      * Creates a new UnaryTree.
661      *
662      * @param operator the operator for this tree, such as Tree.Kind.PLUS.
663      * @param arg the operand of the tree.
664      * @see com.sun.source.tree.UnaryTree
665      * @see com.sun.source.tree.Tree.Kind
666      */

667     UnaryTree Unary(Kind operator, ExpressionTree arg);
668     
669     /**
670      * Creates a new VariableTree.
671      *
672      * @param modifiers the modifiers of this variable.
673      * @param name the name of the variable.
674      * @param type the type of this variable.
675      * @param initializer the initialization expression for this variable, or null.
676      * @see com.sun.source.tree.VariableTree
677      */

678     VariableTree Variable(ModifiersTree modifiers,
679                           CharSequence JavaDoc name,
680                           Tree type,
681                           ExpressionTree initializer);
682     
683     /**
684      * Creates a new VariableTree.
685      *
686      * @param modifiers the modifiers of this variable.
687      * @param name the name of the variable.
688      * @param type the type of this variable.
689      * @param initializer the initialization expression for this variable, or null.
690      * @param enclosingElement the type instance this variable is a member of.
691      * @see com.sun.source.tree.VariableTree
692      */

693     VariableTree Variable(ModifiersTree modifiers,
694                           CharSequence JavaDoc name,
695                           Tree type,
696                           ExpressionTree initializer,
697                           TypeElement enclosingElement);
698     
699     /**
700      * Creates a new VariableTree from a VariableElement.
701      *
702      * @param variable the VariableElement to reference.
703      * @param initializer the initialization expression, or null.
704      * @see com.sun.source.tree.VariableTree
705      * @see javax.lang.model.element.VariableElement
706      */

707     VariableTree Variable(VariableElement variable, ExpressionTree initializer);
708     
709     /**
710      * Creates a new WhileLoopTree.
711      *
712      * @param condition the boolean expression to test.
713      * @param statement the statement to execute while the condition is true.
714      * @see com.sun.source.tree.WhileLoopTree
715      */

716     WhileLoopTree WhileLoop(ExpressionTree condition, StatementTree statement);
717     
718     /**
719      * Creates a new WildcardTree.
720      *
721      * @param kind the kind of wildcard to create.
722      * @param type the type (class, interface or enum) of this wildcard.
723      * @see com.sun.source.tree.WildcardTree
724      */

725     WildcardTree Wildcard(Kind kind, Tree type);
726     
727     ////////////////////////////////////////////////////////////////////////////
728
// AnnotationTree
729
/**
730      * Appends specified element <tt>attrValue</tt> to the end of attribute
731      * values list.
732      *
733      * @param annotation annotation tree containing attribute values list.
734      * @param attrValue element to be appended to attribute values list.
735      * @return annotation tree with modified attribute values.
736      */

737     AnnotationTree addAnnotationAttrValue(AnnotationTree annotation, ExpressionTree attrValue);
738     
739     /**
740      * Inserts the specified element <tt>attrValue</tt> at the specified
741      * position in attribute values list.
742      *
743      * @param annotation annotation tree with attribute values list.
744      * @param index index at which the specified element is to be inserted.
745      * @param attrValue element to be inserted to attribute values list.
746      * @return annotation tree with modified attribute values.
747      *
748      * @throws IndexOutOfBoundsException if the index is out of range
749      * (index &lt; 0 || index &gt; size()).
750      */

751     AnnotationTree insertAnnotationAttrValue(AnnotationTree annotation, int index, ExpressionTree attrValue);
752     
753     /**
754      * Removes the first occurrence in attribute values list of the specified
755      * element. If this list does not contain the element, it is
756      * unchanged.
757      *
758      * @param annotation annotation tree with attribute values list.
759      * @param attrValue element to be removed from this list, if present.
760      * @return annotation tree with modified attribute values.
761      */

762     AnnotationTree removeAnnotationAttrValue(AnnotationTree annotation, ExpressionTree attrValue);
763     
764     /**
765      * Removes the element at the specified position in attribute values list.
766      * Returns the modified annotation tree.
767      *
768      * @param annotation annotation tree with attribute values list.
769      * @param index the index of the element to be removed.
770      * @return annotation tree with modified attribute values.
771      *
772      * @throws IndexOutOfBoundsException if the index is out of range
773      * (index &lt; 0 || index &gt;= size()).
774      */

775     AnnotationTree removeAnnotationAttrValue(AnnotationTree annotation, int index);
776     
777     // BlockTree
778
/**
779      * Appends specified element <tt>statement</tt> to the end of statements
780      * list.
781      *
782      * @param block block tree containing statements list.
783      * @param statement element to be appended to statements list.
784      * @return block tree with modified statements
785      */

786     BlockTree addBlockStatement(BlockTree block, StatementTree statement);
787     
788     /**
789      * Inserts the specified element <tt>statement</tt> at the specified
790      * position in statements list.
791      *
792      * @param block block tree with statements list
793      * @param index index at which the specified element is to be inserted.
794      * @param statement element to be inserted to statements list.
795      * @return block tree with modified statements
796      *
797      * @throws IndexOutOfBoundsException if the index is out of range
798      * (index &lt; 0 || index &gt; size()).
799      */

800     BlockTree insertBlockStatement(BlockTree block, int index, StatementTree statement);
801     
802     /**
803      * Removes the first occurrence in statements list of the specified
804      * element. If this list does not contain the element, it is
805      * unchanged.
806      *
807      * @param block block tree with statements list
808      * @param statement element to be removed from this list, if present.
809      * @return block tree with modified statements
810      */

811     BlockTree removeBlockStatement(BlockTree block, StatementTree statement);
812     
813     /**
814      * Removes the element at the specified position in statements list.
815      * Returns the modified block tree.
816      *
817      * @param block block tree with statements list
818      * @param index the index of the element to be removed.
819      * @return block tree with modified statements
820      *
821      * @throws IndexOutOfBoundsException if the index is out of range
822      * (index &lt; 0 || index &gt;= size()).
823      */

824     BlockTree removeBlockStatement(BlockTree block, int index);
825     
826     // CaseTree
827
/**
828      * Appends specified element <tt>statement</tt> to the end of statements
829      * list.
830      *
831      * @param kejs case tree containing statements list.
832      * @param statement element to be appended to statements list.
833      * @return case tree with modified statements.
834      */

835     CaseTree addCaseStatement(CaseTree kejs, StatementTree statement);
836     
837     /**
838      * Inserts the specified element <tt>statement</tt> at the specified
839      * position in statements list.
840      *
841      * @param kejs case tree containing statements list.
842      * @param index index at which the specified element is to be inserted.
843      * @param statement element to be inserted to statements list.
844      * @return case tree with modified statements.
845      *
846      * @throws IndexOutOfBoundsException if the index is out of range
847      * (index &lt; 0 || index &gt; size()).
848      */

849     CaseTree insertCaseStatement(CaseTree kejs, int index, StatementTree statement);
850     
851     /**
852      * Removes the first occurrence in statements list of the specified
853      * element. If this list does not contain the element, it is
854      * unchanged.
855      *
856      * @param kejs case tree containing statements list.
857      * @param statement element to be removed from this list, if present.
858      * @return case tree with modified statements.
859      */

860     CaseTree removeCaseStatement(CaseTree kejs, StatementTree statement);
861     
862     /**
863      * Removes the element at the specified position in statements list.
864      * Returns the modified case tree.
865      *
866      * @param kejs case tree containing statements list.
867      * @param index the index of the element to be removed.
868      * @return case tree with modified statements.
869      *
870      * @throws IndexOutOfBoundsException if the index is out of range
871      * (index &lt; 0 || index &gt;= size()).
872      */

873     CaseTree removeCaseStatement(CaseTree kejs, int index);
874     
875     // ClassTree
876
/**
877      * Appends specified element <tt>member</tt> to the end of members
878      * list. Consider you want to add such a method to the end of class:
879      * <pre>
880      * public void newlyCreatedMethod(int a, float b) throws java.io.IOException {
881      * }
882      * </pre>
883      *
884      * You can get it e.g. with this code:
885      * <pre>
886      * ClassTree node = ...;
887      * // create method modifiers
888      * ModifiersTree parMods = make.Modifiers(Collections.EMPTY_SET, Collections.EMPTY_LIST);
889      * // create parameters
890      * VariableTree par1 = make.Variable(parMods, "a", make.PrimitiveType(TypeKind.INT), null);
891      * VariableTree par2 = make.Variable(parMods, "b", make.PrimitiveType(TypeKind.FLOAT), null);
892      * List<VariableTree> parList = new ArrayList<VariableTree>(2);
893      * parList.add(par1);
894      * parList.add(par2);
895      * // create method
896      * MethodTree newMethod = make.Method(
897      * make.Modifiers(
898      * Collections.singleton(Modifier.PUBLIC), // modifiers
899      * Collections.EMPTY_LIST // annotations
900      * ), // modifiers and annotations
901      * "newlyCreatedMethod", // name
902      * make.PrimitiveType(TypeKind.VOID), // return type
903      * Collections.EMPTY_LIST, // type parameters for parameters
904      * parList, // parameters
905      * Collections.singletonList(make.Identifier("java.io.IOException")), // throws
906      * make.Block(Collections.EMPTY_LIST, false), // empty statement block
907      * null // default value - not applicable here, used by annotations
908      * );
909      * // rewrite the original class node with the new one containing newMethod
910      * changes.rewrite(node, <b>make.addClassMember(node, newMethod)</b>);
911      * </pre>
912      *
913      * @param clazz class tree containing members list.
914      * @param member element to be appended to members list.
915      * @return class tree with modified members.
916      */

917     ClassTree addClassMember(ClassTree clazz, Tree member);
918     
919     /**
920      * Inserts the specified element <tt>member</tt> at the specified
921      * position in members list.
922      *
923      * @param clazz class tree with members list
924      * @param index index at which the specified element is to be inserted.
925      * @param member element to be inserted to members list.
926      * @return class tree with modified members.
927      *
928      * @throws IndexOutOfBoundsException if the index is out of range
929      * (index &lt; 0 || index &gt; size()).
930      */

931     ClassTree insertClassMember(ClassTree clazz, int index, Tree member);
932     
933     /**
934      * Removes the first occurrence in members list of the specified
935      * element. If this list does not contain the element, it is
936      * unchanged.
937      *
938      * @param clazz class tree with members list
939      * @param member element to be removed from this list, if present.
940      * @return class tree with modified members.
941      */

942     ClassTree removeClassMember(ClassTree clazz, Tree member);
943     
944     /**
945      * Removes the element at the specified position in members list.
946      * Returns the modified class tree.
947      *
948      * @param clazz class tree with members list.
949      * @param index the index of the element to be removed.
950      * @return class tree with modified members.
951      *
952      * @throws IndexOutOfBoundsException if the index is out of range
953      * (index &lt; 0 || index &gt;= size()).
954      */

955     ClassTree removeClassMember(ClassTree clazz, int index);
956     
957     /**
958      * Appends specified element <tt>typeParameter</tt> to the end of type parameters
959      * list.
960      *
961      * @param clazz class tree containing type parameters list.
962      * @param typeParameter element to be appended to type parameters list.
963      * @return class tree with modified type parameters.
964      */

965     ClassTree addClassTypeParameter(ClassTree clazz, TypeParameterTree typeParameter);
966     
967     /**
968      * Inserts the specified element <tt>member</tt> at the specified
969      * position in type parameters list.
970      *
971      * @param clazz class tree with type parameters list
972      * @param index index at which the specified element is to be inserted.
973      * @param typeParameter element to be inserted to type parameters list.
974      * @return class tree with modified type parameters.
975      *
976      * @throws IndexOutOfBoundsException if the index is out of range
977      * (index &lt; 0 || index &gt; size()).
978      */

979     ClassTree insertClassTypeParameter(ClassTree clazz, int index, TypeParameterTree typeParameter);
980     
981     /**
982      * Removes the first occurrence in type parameters list of the specified
983      * element. If this list does not contain the element, it is
984      * unchanged.
985      *
986      * @param clazz class tree with type parameters list
987      * @param typeParameter element to be removed from this list, if present.
988      * @return class tree with modified type parameters.
989      */

990     ClassTree removeClassTypeParameter(ClassTree clazz, TypeParameterTree typeParameter);
991     
992     /**
993      * Removes the element at the specified position in type parameters list.
994      * Returns the modified class tree.
995      *
996      * @param clazz class tree with type parameters list.
997      * @param index the index of the element to be removed.
998      * @return class tree with modified type parameters.
999      *
1000     * @throws IndexOutOfBoundsException if the index is out of range
1001     * (index &lt; 0 || index &gt;= size()).
1002     */

1003    ClassTree removeClassTypeParameter(ClassTree clazz, int index);
1004    
1005    /**
1006     * Appends specified element <tt>implementsClause</tt> to the end of implements
1007     * list.
1008     *
1009     * @param clazz class tree containing implements list.
1010     * @param implementsClause element to be appended to implements list.
1011     * @return class tree with modified implements.
1012     */

1013    ClassTree addClassImplementsClause(ClassTree clazz, ExpressionTree implementsClause);
1014    
1015    /**
1016     * Inserts the specified element <tt>implementsClause</tt> at the specified
1017     * position in implements list.
1018     *
1019     * @param clazz class tree with implements list
1020     * @param index index at which the specified element is to be inserted.
1021     * @param implementsClause element to be inserted to implements list.
1022     * @return class tree with modified implements.
1023     *
1024     * @throws IndexOutOfBoundsException if the index is out of range
1025     * (index &lt; 0 || index &gt; size()).
1026     */

1027    ClassTree insertClassImplementsClause(ClassTree clazz, int index, ExpressionTree implementsClause);
1028    
1029    /**
1030     * Removes the first occurrence in implements list of the specified
1031     * element. If this list does not contain the element, it is
1032     * unchanged.
1033     *
1034     * @param clazz class tree with implements list
1035     * @param implementsClause element to be removed from this list, if present.
1036     * @return class tree with modified implements.
1037     */

1038    ClassTree removeClassImplementsClause(ClassTree clazz, ExpressionTree implementsClause);
1039    
1040    /**
1041     * Removes the element at the specified position in implements list.
1042     * Returns the modified class tree.
1043     *
1044     * @param clazz class tree with implements list.
1045     * @param index the index of the element to be removed.
1046     * @return class tree with modified implements.
1047     *
1048     * @throws IndexOutOfBoundsException if the index is out of range
1049     * (index &lt; 0 || index &gt;= size()).
1050     */

1051    ClassTree removeClassImplementsClause(ClassTree clazz, int index);
1052        
1053    // CompilationUnitTree
1054
/**
1055     * Appends specified element <tt>typeDeclaration</tt> to the end of type
1056     * declarations list.
1057     *
1058     * @param compilationUnit compilation unit tree containing type declarations list.
1059     * @param typeDeclaration element to be appended to type declarations list.
1060     * @return compilation unit tree with modified type declarations.
1061     */

1062    CompilationUnitTree addCompUnitTypeDecl(CompilationUnitTree compilationUnit, Tree typeDeclaration);
1063    
1064    /**
1065     * Inserts the specified element <tt>typeDeclaration</tt> at the specified
1066     * position in type declarations list.
1067     *
1068     * @param compilationUnit compilation unit tree containing type declarations list.
1069     * @param index index at which the specified element is to be inserted.
1070     * @param typeDeclaration element to be inserted to type declarations list.
1071     * @return compilation unit tree with modified type declarations.
1072     *
1073     * @throws IndexOutOfBoundsException if the index is out of range
1074     * (index &lt; 0 || index &gt; size()).
1075     */

1076    CompilationUnitTree insertCompUnitTypeDecl(CompilationUnitTree compilationUnit, int index, Tree typeDeclaration);
1077    
1078    /**
1079     * Removes the first occurrence in type declarations list of the specified
1080     * element. If this list does not contain the element, it is
1081     * unchanged.
1082     *
1083     * @param compilationUnit compilation unit tree containing type declarations list.
1084     * @param typeDeclaration element to be removed from this list, if present.
1085     * @return compilation unit tree with modified type declarations.
1086     */

1087    CompilationUnitTree removeCompUnitTypeDecl(CompilationUnitTree compilationUnit, Tree typeDeclaration);
1088    
1089    /**
1090     * Removes the element at the specified position in type declarations list.
1091     * Returns the modified compilation unit tree.
1092     *
1093     * @param compilation unit tree containing type declarations list.
1094     * @param index the index of the element to be removed.
1095     * @return compilation unit tree with modified type declarations.
1096     *
1097     * @throws IndexOutOfBoundsException if the index is out of range (index
1098     * &lt; 0 || index &gt;= size()).
1099     */

1100    CompilationUnitTree removeCompUnitTypeDecl(CompilationUnitTree compilationUnit, int index);
1101    
1102    /**
1103     * Appends specified element <tt>importt</tt> to the end of imports list.
1104     *
1105     * @param compilationUnit compilation unit tree containing imports list.
1106     * @param importt element to be appended to list of imports.
1107     * @return compilation unit tree with modified imports.
1108     */

1109    public CompilationUnitTree addCompUnitImport(CompilationUnitTree compilationUnit, ImportTree importt);
1110    
1111    /**
1112     * Inserts the specified element <tt>importt</tt> at the specified
1113     * position in imports list.
1114     *
1115     * @param compilationUnit compilation unit tree containing imports list.
1116     * @param index index at which the specified element is to be inserted.
1117     * @param importt element to be inserted to list of imports.
1118     * @return compilation unit tree with modified imports.
1119     *
1120     * @throws IndexOutOfBoundsException if the index is out of range
1121     * (index &lt; 0 || index &gt; size()).
1122     */

1123    public CompilationUnitTree insertCompUnitImport(CompilationUnitTree compilationUnit, int index, ImportTree importt);
1124    
1125    /**
1126     * Removes the first occurrence in imports list of the specified
1127     * element. If this list does not contain the element, it is
1128     * unchanged.
1129     *
1130     * @param compilationUnit compilation unit tree containing import list.
1131     * @param importt element to be removed from this list, if present.
1132     * @return compilation unit tree with modified imports.
1133     */

1134    public CompilationUnitTree removeCompUnitImport(CompilationUnitTree compilationUnit, ImportTree importt);
1135    
1136    /**
1137     * Removes the element at the specified position in import list.
1138     * Returns the modified compilation unit tree.
1139     *
1140     * @param compilation unit tree containing import list.
1141     * @param index the index of the element to be removed.
1142     * @return compilation unit tree with modified imports.
1143     *
1144     * @throws IndexOutOfBoundsException if the index is out of range (index
1145     * &lt; 0 || index &gt;= size()).
1146     */

1147    public CompilationUnitTree removeCompUnitImport(CompilationUnitTree compilationUnit, int index);
1148    
1149    /** ErroneousTree */
1150    
1151    // ForLoopInitializer
1152
/**
1153     * Appends specified element <tt>initializer</tt> to the end of initializers
1154     * list.
1155     *
1156     * @param forLoop for loop tree containing initializers list.
1157     * @param initializer element to be appended to initializers list.
1158     * @return for loop tree with modified initializers.
1159     */

1160    ForLoopTree addForLoopInitializer(ForLoopTree forLoop, StatementTree initializer);
1161    
1162    /**
1163     * Inserts the specified element <tt>initializer</tt> at the specified
1164     * position in initializers list.
1165     *
1166     * @param forLoop for loop tree containing initializers list.
1167     * @param index index at which the specified element is to be inserted.
1168     * @param initializer element to be inserted to initializers list.
1169     * @return for loop tree with modified initializers.
1170     *
1171     * @throws IndexOutOfBoundsException if the index is out of range
1172     * (index &lt; 0 || index &gt; size()).
1173     */

1174    ForLoopTree insertForLoopInitializer(ForLoopTree forLoop, int index, StatementTree initializer);
1175    
1176    /**
1177     * Removes the first occurrence in initializers list of the specified
1178     * element. If this list does not contain the element, it is
1179     * unchanged.
1180     *
1181     * @param forLoop for loop tree containing initializers list.
1182     * @param initializer element to be removed from this list, if present.
1183     * @return for loop tree with modified initializers.
1184     */

1185    ForLoopTree removeForLoopInitializer(ForLoopTree forLoop, StatementTree initializer);
1186    
1187    /**
1188     * Removes the element at the specified position in initializers list.
1189     * Returns the modified for loop tree.
1190     *
1191     * @param forLoop for loop tree containing initializers list.
1192     * @param index the index of the element to be removed.
1193     * @return for loop tree with modified initializers.
1194     *
1195     * @throws IndexOutOfBoundsException if the index is out of range (index
1196     * &lt; 0 || index &gt;= size()).
1197     */

1198    ForLoopTree removeForLoopInitializer(ForLoopTree forLoop, int index);
1199    
1200    // ForLoopUpdate
1201
/**
1202     * Appends specified element <tt>update</tt> to the end of updates
1203     * list.
1204     *
1205     * @param forLoop for loop tree containing updates list.
1206     * @param update element to be appended to updates list.
1207     * @return for loop tree with modified updates.
1208     */

1209    ForLoopTree addForLoopUpdate(ForLoopTree forLoop, ExpressionStatementTree update);
1210    
1211    /**
1212     * Inserts the specified element <tt>update</tt> at the specified
1213     * position in updates list.
1214     *
1215     * @param forLoop for loop tree containing updates list.
1216     * @param index index at which the specified element is to be inserted.
1217     * @param update element to be inserted to updates list.
1218     * @return for loop tree with modified updates.
1219     *
1220     * @throws IndexOutOfBoundsException if the index is out of range
1221     * (index &lt; 0 || index &gt; size()).
1222     */

1223    ForLoopTree insertForLoopUpdate(ForLoopTree forLoop, int index, ExpressionStatementTree update);
1224    
1225    /**
1226     * Removes the first occurrence in updates list of the specified
1227     * element. If this list does not contain the element, it is
1228     * unchanged.
1229     *
1230     * @param forLoop for loop tree containing updates list.
1231     * @param update element to be removed from this list, if present.
1232     * @return for loop tree with modified updates.
1233     */

1234    ForLoopTree removeForLoopUpdate(ForLoopTree forLoop, ExpressionStatementTree update);
1235    
1236    /**
1237     * Removes the element at the specified position in updates list.
1238     * Returns the modified for loop tree.
1239     *
1240     * @param forLoop for loop tree containing updates list.
1241     * @param index the index of the element to be removed.
1242     * @return for loop tree with modified updates.
1243     *
1244     * @throws IndexOutOfBoundsException if the index is out of range (index
1245     * &lt; 0 || index &gt;= size()).
1246     */

1247    ForLoopTree removeForLoopUpdate(ForLoopTree forLoop, int index);
1248    
1249    // MethodInvocation
1250
/**
1251     * Appends specified element <tt>argument</tt> with related
1252     * <tt>typeArgument</tt> to the end of arguments/type arguments list.
1253     *
1254     * @param methodInvocation method invocation tree containing arguments list.
1255     * @param argument element to be appended to arguments list.
1256     * @param typeArgument element to be appended to type arguments list.
1257     * @return method invocation tree with modified arguments and type arguments.
1258     */

1259    MethodInvocationTree addMethodInvocationArgument(MethodInvocationTree methodInvocation, ExpressionTree argument, ExpressionTree typeArgument);
1260    
1261    /**
1262     * Inserts the specified element <tt>argument</tt> with related
1263     * <tt>typeArgument</tt> at the specified position in arguments/type arguments list.
1264     *
1265     * @param methodInvocation method invocation tree containing arguments list.
1266     * @param index index at which the specified elements is to be inserted.
1267     * @param argument element to be inserted to arguments list.
1268     * @param typeArgument element to be inserted to type arguments list.
1269     * @return method invocation tree with modified type arguments and type arguments.
1270     *
1271     * @throws IndexOutOfBoundsException if the index is out of range
1272     * (index &lt; 0 || index &gt; size()).
1273     */

1274    MethodInvocationTree insertMethodInvocationArgument(MethodInvocationTree methodInvocation, int index, ExpressionTree argument, ExpressionTree typeArgument);
1275    
1276    /** TODO: Strange method - different arguments/type arguments can be removed.
1277     * just argument should be passed to the method.
1278     * Removes the first occurrence in arguments and type arguments list
1279     * of the specified elements. If this list do not contain the elements, it is
1280     * unchanged.
1281     *
1282     * @param methodInvocation method invocation tree containing arguments list.
1283     * @param argument element to be removed from this list, if present.
1284     * @param typeArgument element to be removed from this list, if present.
1285     * @return method invocation tree with modified arguments and type arguments.
1286     */

1287    MethodInvocationTree removeMethodInvocationArgument(MethodInvocationTree methodInvocation, ExpressionTree argument, ExpressionTree typeArgument);
1288    
1289    /**
1290     * Removes the element at the specified position in arguments and
1291     * type arguments list. Returns the modified method invocation tree.
1292     *
1293     * @param methodInvocation method invocation tree containing arguments list.
1294     * @param index the index of the element to be removed.
1295     * @return method invocation tree with modified arguments and type arguments.
1296     *
1297     * @throws IndexOutOfBoundsException if the index is out of range (index
1298     * &lt; 0 || index &gt;= size()).
1299     */

1300    MethodInvocationTree removeMethodInvocationArgument(MethodInvocationTree methodInvocation, int index);
1301    
1302    // Method
1303
/**
1304     * Appends specified element <tt>parameter</tt>
1305     * to the end of parameters list.
1306     *
1307     * @param method method tree containing parameters list.
1308     * @param parameter element to be appended to parameters list.
1309     * @return method tree with modified parameters.
1310     */

1311    MethodTree addMethodParameter(MethodTree method, VariableTree parameter);
1312    
1313    /**
1314     * Inserts the specified element <tt>parameter</tt>
1315     * at the specified position in parameters list.
1316     *
1317     * @param method method tree containing parameters list.
1318     * @param index index at which the specified elements is to be inserted.
1319     * @param parameter element to be inserted to parameters list.
1320     * @return method tree with modified parameters.
1321     *
1322     * @throws IndexOutOfBoundsException if the index is out of range
1323     * (index &lt; 0 || index &gt; size()).
1324     */

1325    MethodTree insertMethodParameter(MethodTree method, int index, VariableTree parameter);
1326    
1327    /**
1328     * Removes the first occurrence in parameters list of the specified
1329     * elements. If this list do not contain the element, it is
1330     * unchanged.
1331     *
1332     * @param method method tree containing parameters list.
1333     * @param parameter element to be removed from this list, if present.
1334     * @return method tree with modified parameters and type parameters.
1335     */

1336    MethodTree removeMethodParameter(MethodTree method, VariableTree parameter);
1337    
1338    /**
1339     * Removes the element at the specified position in parameters list.
1340     * Returns the modified method tree.
1341     *
1342     * @param method method tree containing parameters list.
1343     * @param index the index of the element to be removed.
1344     * @return method tree with modified parameters.
1345     *
1346     * @throws IndexOutOfBoundsException if the index is out of range (index
1347     * &lt; 0 || index &gt;= size()).
1348     */

1349    MethodTree removeMethodParameter(MethodTree method, int index);
1350    
1351    /**
1352     * Appends specified element <tt>typeParameter</tt>
1353     * to the end of type parameters list.
1354     *
1355     * @param method method tree containing type parameters list.
1356     * @param typeParameter element to be appended to type parameters list.
1357     * @return method tree with modified type parameters.
1358     */

1359    MethodTree addMethodTypeParameter(MethodTree method, TypeParameterTree typeParameter);
1360    
1361    /**
1362     * Inserts the specified element <tt>typeParameter</tt>
1363     * at the specified position in type parameters list.
1364     *
1365     * @param method method tree containing parameters list.
1366     * @param index index at which the specified elements is to be inserted.
1367     * @param typeParameter element to be inserted to type parameters list.
1368     * @return method tree with modified type parameters.
1369     *
1370     * @throws IndexOutOfBoundsException if the index is out of range
1371     * (index &lt; 0 || index &gt; size()).
1372     */

1373    MethodTree insertMethodTypeParameter(MethodTree method, int index, TypeParameterTree typeParameter);
1374    
1375    /**
1376     * Removes the first occurrence in type parameters list of the specified
1377     * elements. If this list do not contain the element, it is
1378     * unchanged.
1379     *
1380     * @param method method tree containing type parameters list.
1381     * @param typeParameter element to be removed from this list, if present.
1382     * @return method tree with modified type parameters.
1383     */

1384    MethodTree removeMethodTypeParameter(MethodTree method, TypeParameterTree typeParameter);
1385    
1386    /**
1387     * Removes the element at the specified position in type parameters list.
1388     * Returns the modified method tree.
1389     *
1390     * @param method method tree containing type parameters list.
1391     * @param index the index of the element to be removed.
1392     * @return method tree with modified type parameters.
1393     *
1394     * @throws IndexOutOfBoundsException if the index is out of range (index
1395     * &lt; 0 || index &gt;= size()).
1396     */

1397    MethodTree removeMethodTypeParameter(MethodTree method, int index);
1398    
1399    /**
1400     * Appends specified element <tt>throwz</tt> to the end of throws
1401     * list.
1402     *
1403     * @param method method tree containing throws list.
1404     * @param throwz element to be appended to throws list.
1405     * @return method tree with modified throws.
1406     */

1407    MethodTree addMethodThrows(MethodTree method, ExpressionTree throwz);
1408    
1409    /**
1410     * Inserts the specified element <tt>throws</tt> at the specified
1411     * position in throws list.
1412     *
1413     * @param method method tree containing throws list.
1414     * @param index index at which the specified element is to be inserted.
1415     * @param throwz element to be inserted to throws list.
1416     * @return method tree with modified throws.
1417     *
1418     * @throws IndexOutOfBoundsException if the index is out of range
1419     * (index &lt; 0 || index &gt; size()).
1420     */

1421    MethodTree insertMethodThrows(MethodTree method, int index, ExpressionTree throwz);
1422    
1423    /**
1424     * Removes the first occurrence in throws list of the specified
1425     * element. If this list does not contain the element, it is
1426     * unchanged.
1427     *
1428     * @param method method tree containing throws list.
1429     * @param throwz element to be removed from this list, if present.
1430     * @return method tree with modified throws.
1431     */

1432    MethodTree removeMethodThrows(MethodTree method, ExpressionTree throwz);
1433    
1434    /**
1435     * Removes the element at the specified position in throws list.
1436     * Returns the modified method tree.
1437     *
1438     * @param method method tree containing throws list.
1439     * @param index the index of the element to be removed.
1440     * @return method tree with modified throws.
1441     *
1442     * @throws IndexOutOfBoundsException if the index is out of range (index
1443     * &lt; 0 || index &gt;= size()).
1444     */

1445    MethodTree removeMethodThrows(MethodTree method, int index);
1446    
1447    // Modifiers
1448
/**
1449     * Appends specified element <tt>annotation</tt> to the end of annotations
1450     * list.
1451     *
1452     * @param modifiers modifiers tree containing annotations list.
1453     * @param annotation element to be appended to annotations list.
1454     * @return modifiers tree with modified annotations.
1455     */

1456    ModifiersTree addModifiersAnnotation(ModifiersTree modifiers, AnnotationTree annotation);
1457    
1458    /**
1459     * Inserts the specified element <tt>annotation</tt> at the specified
1460     * position in annotations list.
1461     *
1462     * @param method modifiers tree containing annotations list.
1463     * @param index index at which the specified element is to be inserted.
1464     * @param annotation element to be inserted to annotations list.
1465     * @return modifiers tree with modified annotations.
1466     *
1467     * @throws IndexOutOfBoundsException if the index is out of range
1468     * (index &lt; 0 || index &gt; size()).
1469     */

1470    ModifiersTree insertModifiersAnnotation(ModifiersTree modifiers, int index, AnnotationTree annotation);
1471    
1472    /**
1473     * Removes the first occurrence in annotations list of the specified
1474     * element. If this list does not contain the element, it is
1475     * unchanged.
1476     *
1477     * @param method modifiers tree containing annotations list.
1478     * @param annotation element to be removed from this list, if present.
1479     * @return modifiers tree with modified annotations.
1480     */

1481    ModifiersTree removeModifiersAnnotation(ModifiersTree modifiers, AnnotationTree annotation);
1482    
1483    /**
1484     * Removes the element at the specified position in annotations list.
1485     * Returns the modified modifiers tree.
1486     *
1487     * @param method modifiers tree containing annotations list.
1488     * @param index the index of the element to be removed.
1489     * @return modifiers tree with modified annotations.
1490     *
1491     * @throws IndexOutOfBoundsException if the index is out of range (index
1492     * &lt; 0 || index &gt;= size()).
1493     */

1494    ModifiersTree removeModifiersAnnotation(ModifiersTree modifiers, int index);
1495    
1496    // NewArray
1497
/**
1498     * Appends specified element <tt>dimension</tt> to the end of dimensions
1499     * list.
1500     *
1501     * @param newArray new array tree containing dimensions list.
1502     * @param dimension element to be appended to dimensions list.
1503     * @return new array tree with modified dimensions.
1504     */

1505    NewArrayTree addNewArrayDimension(NewArrayTree newArray, ExpressionTree dimension);
1506    
1507    /**
1508     * Inserts the specified element <tt>dimension</tt> at the specified
1509     * position in dimensions list.
1510     *
1511     * @param newArray new array tree containing dimensions list.
1512     * @param index index at which the specified element is to be inserted.
1513     * @param dimension element to be inserted to dimensions list.
1514     * @return new array tree with modified dimensions.
1515     *
1516     * @throws IndexOutOfBoundsException if the index is out of range
1517     * (index &lt; 0 || index &gt; size()).
1518     */

1519    NewArrayTree insertNewArrayDimension(NewArrayTree newArray, int index, ExpressionTree dimension);
1520    
1521    /**
1522     * Removes the first occurrence in dimensions list of the specified
1523     * element. If this list does not contain the element, it is
1524     * unchanged.
1525     *
1526     * @param newArray new array tree containing dimensions list.
1527     * @param dimension element to be removed from this list, if present.
1528     * @return new array tree with modified dimensions.
1529     */

1530    NewArrayTree removeNewArrayDimension(NewArrayTree newArray, ExpressionTree dimension);
1531    
1532    /**
1533     * Removes the element at the specified position in dimensions list.
1534     * Returns the modified new array tree.
1535     *
1536     * @param newArray new array tree containing dimensions list.
1537     * @param index the index of the element to be removed.
1538     * @return new array tree with modified dimensions.
1539     *
1540     * @throws IndexOutOfBoundsException if the index is out of range (index
1541     * &lt; 0 || index &gt;= size()).
1542     */

1543    NewArrayTree removeNewArrayDimension(NewArrayTree newArray, int index);
1544
1545    // NewArrayTree
1546
/**
1547     * Appends specified element <tt>initializer</tt> to the end of initializers
1548     * list.
1549     *
1550     * @param newArray new array tree containing initializers list.
1551     * @param initializer element to be appended to initializers list.
1552     * @return new array tree with modified initializers.
1553     */

1554    NewArrayTree addNewArrayInitializer(NewArrayTree newArray, ExpressionTree initializer);
1555    
1556    /**
1557     * Inserts the specified element <tt>initializer</tt> at the specified
1558     * position in initializers list.
1559     *
1560     * @param newArray new array tree containing initializers list.
1561     * @param index index at which the specified element is to be inserted.
1562     * @param initializer element to be inserted to initializers list.
1563     * @return new array tree with modified initializers.
1564     *
1565     * @throws IndexOutOfBoundsException if the index is out of range
1566     * (index &lt; 0 || index &gt; size()).
1567     */

1568    NewArrayTree insertNewArrayInitializer(NewArrayTree newArray, int index, ExpressionTree initializer);
1569    
1570    /**
1571     * Removes the first occurrence in initializers list of the specified
1572     * element. If this list does not contain the element, it is
1573     * unchanged.
1574     *
1575     * @param newArray new array tree containing initializers list.
1576     * @param initializer element to be removed from this list, if present.
1577     * @return new array tree with modified initializers.
1578     */

1579    NewArrayTree removeNewArrayInitializer(NewArrayTree newArray, ExpressionTree initializer);
1580    
1581    /**
1582     * Removes the element at the specified position in initializers list.
1583     * Returns the modified new array tree.
1584     *
1585     * @param newArray new array tree containinginitializers list.
1586     * @param index the index of the element to be removed.
1587     * @return new array tree with modified initializers.
1588     *
1589     * @throws IndexOutOfBoundsException if the index is out of range (index
1590     * &lt; 0 || index &gt;= size()).
1591     */

1592    NewArrayTree removeNewArrayInitializer(NewArrayTree newArray, int index);
1593    
1594    // NewClass
1595
/**
1596     * Appends specified element <tt>argument</tt> with related
1597     * <tt>typeArgument</tt> to the end of arguments/type arguments list.
1598     *
1599     * @param newClass new class tree containing arguments list.
1600     * @param typeArgument element to be appended to type arguments list.
1601     * @param argument element to be appended to arguments list.
1602     * @return new class tree with modified arguments and type arguments.
1603     */

1604    NewClassTree addNewClassArgument(NewClassTree newClass, ExpressionTree typeArgument, ExpressionTree argument);
1605    
1606    /**
1607     * Inserts the specified element <tt>argument</tt> with related
1608     * <tt>typeArgument</tt> at the specified position in arguments/type arguments list.
1609     *
1610     * @param newClass new class tree containing type arguments list.
1611     * @param index index at which the specified elements is to be inserted.
1612     * @param typeArgument element to be inserted to type arguments list.
1613     * @param argument element to be inserted to arguments list.
1614     * @return new class tree with modified type arguments and type arguments.
1615     *
1616     * @throws IndexOutOfBoundsException if the index is out of range
1617     * (index &lt; 0 || index &gt; size()).
1618     */

1619    NewClassTree insertNewClassArgument(NewClassTree newClass, int index, ExpressionTree typeArgument, ExpressionTree argument);
1620    
1621    /** TODO: Strange method - different arguments/type arguments can be removed.
1622     * just argument should be passed to the method.
1623     * Removes the first occurrence in arguments and type arguments list
1624     * of the specified elements. If this list do not contain the elements, it is
1625     * unchanged.
1626     *
1627     * @param newClass new class tree containing type arguments list.
1628     * @param typeArgument element to be removed from this list, if present.
1629     * @param argument element to be removed from this list, if present.
1630     * @return new class tree with modified arguments and type arguments.
1631     */

1632    NewClassTree removeNewClassArgument(NewClassTree newClass, ExpressionTree typeArgument, ExpressionTree argument);
1633    
1634    /**
1635     * Removes the element at the specified position in arguments and
1636     * type arguments list. Returns the modified new class tree.
1637     *
1638     * @param newClass new class tree containing type arguments list.
1639     * @param index the index of the element to be removed.
1640     * @return new class tree with modified arguments and type arguments.
1641     *
1642     * @throws IndexOutOfBoundsException if the index is out of range (index
1643     * &lt; 0 || index &gt;= size()).
1644     */

1645    NewClassTree removeNewClassArgument(NewClassTree newClass, int index);
1646
1647    // ParameterizedType
1648
/**
1649     * Appends specified element <tt>argument</tt> to the end of type arguments
1650     * list.
1651     *
1652     * @param parameterizedType parameterized type tree containing type arguments list.
1653     * @param argument element to be appended to type arguments list.
1654     * @return parameterized type tree with modified type arguments.
1655     */

1656    ParameterizedTypeTree addParameterizedTypeTypeArgument(ParameterizedTypeTree parameterizedType, ExpressionTree argument);
1657    
1658    /**
1659     * Inserts the specified element <tt>argument</tt> at the specified
1660     * position in type arguments list.
1661     *
1662     * @param parameterizedType parameterized type tree containing type arguments list.
1663     * @param index index at which the specified element is to be inserted.
1664     * @param argument element to be inserted to type arguments list.
1665     * @return parameterized type tree with modified type arguments.
1666     *
1667     * @throws IndexOutOfBoundsException if the index is out of range
1668     * (index &lt; 0 || index &gt; size()).
1669     */

1670    ParameterizedTypeTree insertParameterizedTypeTypeArgument(ParameterizedTypeTree parameterizedType, int index, ExpressionTree argument);
1671    
1672    /**
1673     * Removes the first occurrence in type arguments list of the specified
1674     * element. If this list does not contain the element, it is
1675     * unchanged.
1676     *
1677     * @param parameterizedType parameterized type tree containing type arguments list.
1678     * @param argument element to be removed from this list, if present.
1679     * @return parameterized type tree with modified type arguments.
1680     */

1681    ParameterizedTypeTree removeParameterizedTypeTypeArgument(ParameterizedTypeTree parameterizedType, ExpressionTree argument);
1682    
1683    /**
1684     * Removes the element at the specified position in type arguments list.
1685     * Returns the modified parameterized type tree.
1686     *
1687     * @param parameterizedType parameterized type tree containing type arguments list.
1688     * @param index the index of the element to be removed.
1689     * @return parameterized type tree with modified type arguments.
1690     *
1691     * @throws IndexOutOfBoundsException if the index is out of range (index
1692     * &lt; 0 || index &gt;= size()).
1693     */

1694    ParameterizedTypeTree removeParameterizedTypeTypeArgument(ParameterizedTypeTree parameterizedType, int index);
1695
1696    // Switch
1697
/**
1698     * Appends specified element <tt>kejs</tt> to the end of cases
1699     * list.
1700     *
1701     * @param swic switch tree containing cases list.
1702     * @param kejs element to be appended to cases list.
1703     * @return switch tree with modified cases.
1704     */

1705    SwitchTree addSwitchCase(SwitchTree swic, CaseTree kejs);
1706    
1707    /**
1708     * Inserts the specified element <tt>kejs</tt> at the specified
1709     * position in cases list.
1710     *
1711     * @param swic switch tree containing cases list.
1712     * @param index index at which the specified element is to be inserted.
1713     * @param kejs element to be inserted to cases list.
1714     * @return switch tree with modified cases.
1715     *
1716     * @throws IndexOutOfBoundsException if the index is out of range
1717     * (index &lt; 0 || index &gt; size()).
1718     */

1719    SwitchTree insertSwitchCase(SwitchTree swic, int index, CaseTree kejs);
1720    
1721    /**
1722     * Removes the first occurrence in cases list of the specified
1723     * element. If this list does not contain the element, it is
1724     * unchanged.
1725     *
1726     * @param swic switch tree containing cases list.
1727     * @param kejs element to be removed from this list, if present.
1728     * @return switch tree with modified cases.
1729     */

1730    SwitchTree removeSwitchCase(SwitchTree swic, CaseTree kejs);
1731    
1732    /**
1733     * Removes the element at the specified position in cases list.
1734     * Returns the modified switch tree.
1735     *
1736     * @param swic switch tree containing cases list.
1737     * @param index the index of the element to be removed.
1738     * @return switch tree with modified cases.
1739     *
1740     * @throws IndexOutOfBoundsException if the index is out of range (index
1741     * &lt; 0 || index &gt;= size()).
1742     */

1743    SwitchTree removeSwitchCase(SwitchTree swic, int index);
1744    
1745    // Try
1746
/**
1747     * Appends specified element <tt>kec</tt> to the end of catches
1748     * list.
1749     *
1750     * @param traj try tree containing catches list.
1751     * @param kec element to be appended to catches list.
1752     * @return try tree with modified catches.
1753     */

1754    TryTree addTryCatch(TryTree traj, CatchTree kec);
1755    
1756    /**
1757     * Inserts the specified element <tt>kec</tt> at the specified
1758     * position in catches list.
1759     *
1760     * @param traj try tree containing catches list.
1761     * @param index index at which the specified element is to be inserted.
1762     * @param kec element to be inserted to catches list.
1763     * @return try tree with modified catches.
1764     *
1765     * @throws IndexOutOfBoundsException if the index is out of range
1766     * (index &lt; 0 || index &gt; size()).
1767     */

1768    TryTree insertTryCatch(TryTree traj, int index, CatchTree kec);
1769    
1770    /**
1771     * Removes the first occurrence in catches list of the specified
1772     * element. If this list does not contain the element, it is
1773     * unchanged.
1774     *
1775     * @param traj try tree containing catches list.
1776     * @param kec element to be removed from this list, if present.
1777     * @return try tree with modified catches.
1778     */

1779    TryTree removeTryCatch(TryTree traj, CatchTree kec);
1780    
1781    /**
1782     * Removes the element at the specified position in catches list.
1783     * Returns the modified try tree.
1784     *
1785     * @param traj try tree containing catches list.
1786     * @param index the index of the element to be removed.
1787     * @return try tree with modified catches.
1788     *
1789     * @throws IndexOutOfBoundsException if the index is out of range (index
1790     * &lt; 0 || index &gt;= size()).
1791     */

1792    TryTree removeTryCatch(TryTree traj, int index);
1793            
1794    /**
1795     * Appends specified element <tt>bound</tt> to the end of bounds
1796     * list.
1797     *
1798     * @param typeParameter type parameter tree containing bounds list.
1799     * @param bound element to be appended to bounds list.
1800     * @return type parameter tree with modified bounds.
1801     */

1802    TypeParameterTree addTypeParameterBound(TypeParameterTree typeParameter, ExpressionTree bound);
1803    
1804    /**
1805     * Inserts the specified element <tt>bound</tt> at the specified
1806     * position in bounds list.
1807     *
1808     * @param typeParameter type parameter tree containing bounds list.
1809     * @param index index at which the specified element is to be inserted.
1810     * @param bound element to be inserted to bounds list.
1811     * @return type parameter tree with modified bounds.
1812     *
1813     * @throws IndexOutOfBoundsException if the index is out of range
1814     * (index &lt; 0 || index &gt; size()).
1815     */

1816    TypeParameterTree insertTypeParameterBound(TypeParameterTree typeParameter, int index, ExpressionTree bound);
1817    
1818    /**
1819     * Removes the first occurrence in bounds list of the specified
1820     * element. If this list does not contain the element, it is
1821     * unchanged.
1822     *
1823     * @param typeParameter type parameter tree containing bounds list.
1824     * @param bound element to be removed from this list, if present.
1825     * @return type parameter tree with modified bounds.
1826     */

1827    TypeParameterTree removeTypeParameterBound(TypeParameterTree typeParameter, ExpressionTree bound);
1828    
1829    /**
1830     * Removes the element at the specified position in bounds list.
1831     * Returns the modified type parameter tree.
1832     *
1833     * @param typeParameter type parameter tree containing bounds list.
1834     * @param index the index of the element to be removed.
1835     * @return type parameter tree with modified bounds.
1836     *
1837     * @throws IndexOutOfBoundsException if the index is out of range (index
1838     * &lt; 0 || index &gt;= size()).
1839     */

1840    TypeParameterTree removeTypeParameterBound(TypeParameterTree typeParameter, int index);
1841    
1842    /**
1843     * Replaces the original <tt>node</tt>'s label with new one provided in
1844     * <tt>aLabel</tt> argument. Throws <tt>IllegalArgumentException</tt> if
1845     * <tt>node</tt>'s kind is invalid. Valid <tt>node</tt>'s kinds are:<br>
1846     * BREAK, CLASS, CONTINUE, IDENTIFIER, LABELED_STATEMENT,
1847     * MEMBER_SELECT, METHOD, TYPE_PARAMETER, VARIABLE.<p>
1848     *
1849     * Consider you want to change name of method <tt>fooMet</tt> to
1850     * <tt>fooMethod</tt>:
1851     *
1852     * <pre>
1853     * public void fooMet() throws java.io.IOException {
1854     * ...
1855     * }
1856     * </pre>
1857     *
1858     * You can get it e.g. with this code:
1859     * <pre>
1860     * MethodTree footMet = <I>contains footMet tree</I>;
1861     * MethodTree fooMethod = make.setLabel(fooMet, "fooMethod");
1862     * changes.rewrite(node, njuMethod);
1863     * </pre>
1864     *
1865     * This code will result to:
1866     * <pre>
1867     * public void fooMethod() throws java.io.IOException {
1868     * ...
1869     * }
1870     * </pre>
1871     *
1872     * @param node argument will be duplicated and its label replaced
1873     * with <tt>aLabel</tt>
1874     * @param aLabel represents new <tt>node</tt>'s name or other label
1875     * @throws java.lang.IllegalArgumentException if the user provides
1876     * illegal <tt>node</tt>'s kind, i.e. if the provided
1877     * <tt>node</tt> does not contain any name or <tt>String</tt>.
1878     * @return duplicated <tt>node</tt> with a new name
1879     */

1880    <N extends Tree> N setLabel(final N node, final CharSequence JavaDoc aLabel)
1881            throws IllegalArgumentException JavaDoc;
1882}
1883
Popular Tags