01: /*
02: * Spoon - http://spoon.gforge.inria.fr/
03: * Copyright (C) 2006 INRIA Futurs <renaud.pawlak@inria.fr>
04: *
05: * This software is governed by the CeCILL-C License under French law and
06: * abiding by the rules of distribution of free software. You can use, modify
07: * and/or redistribute the software under the terms of the CeCILL-C license as
08: * circulated by CEA, CNRS and INRIA at http://www.cecill.info.
09: *
10: * This program is distributed in the hope that it will be useful, but WITHOUT
11: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12: * FITNESS FOR A PARTICULAR PURPOSE. See the CeCILL-C License for more details.
13: *
14: * The fact that you are presently reading this means that you have had
15: * knowledge of the CeCILL-C license and that you accept its terms.
16: */
17:
18: package spoon.reflect.code;
19:
20: import java.util.List;
21:
22: import spoon.reflect.visitor.Filter;
23: import spoon.template.TemplateParameter;
24:
25: /**
26: * This code element represents a block of code, that is to say a list of
27: * statements enclosed in curly brackets. When the context calls for a return
28: * value, the block should contain a return statement as a lastly reachable
29: * statement. The returned type if any is given by <code>R</code>.
30: */
31: public interface CtBlock<R> extends CtStatement, TemplateParameter<R> {
32:
33: /**
34: * Inserts the given statement at the begining of the block.
35: */
36: void insertBegin(CtStatement statement);
37:
38: /**
39: * Inserts the given statement list at the begining of the block.
40: */
41: void insertBegin(CtStatementList<?> statements);
42:
43: /**
44: * Inserts the given statement at the end of the block.
45: */
46: void insertEnd(CtStatement statement);
47:
48: /**
49: * Inserts the given statements at the end of the block.
50: */
51: void insertEnd(CtStatementList<?> statements);
52:
53: /**
54: * Inserts the given statement before a set of insertion points given by a
55: * filter.
56: */
57: void insertBefore(Filter<? extends CtStatement> insertionPoints,
58: CtStatement statement);
59:
60: /**
61: * Inserts the given statement list before a set of insertion points given
62: * by a filter.
63: */
64: void insertBefore(Filter<? extends CtStatement> insertionPoints,
65: CtStatementList<?> statements);
66:
67: /**
68: * Inserts the given statement after a set of insertion points given by a
69: * filter.
70: */
71: void insertAfter(Filter<? extends CtStatement> insertionPoints,
72: CtStatement statement);
73:
74: /**
75: * Inserts the given statement list after a set of insertion points given by
76: * a filter.
77: */
78: void insertAfter(Filter<? extends CtStatement> insertionPoints,
79: CtStatementList<?> statements);
80:
81: /**
82: * Returns the statements enclosed by this block.
83: */
84: List<CtStatement> getStatements();
85:
86: /**
87: * Sets the statements enclosed by this block.
88: */
89: void setStatements(List<CtStatement> statements);
90:
91: }
|