public class ProgramContextAdder extends Object
ContextStatementBlockInstantiation
is wrapped
around a given ProgramElement
.Modifier and Type | Field and Description |
---|---|
static ProgramContextAdder |
INSTANCE
singleton instance of the program context adder
|
Modifier | Constructor and Description |
---|---|
private |
ProgramContextAdder()
an empty private constructor to ensure the singleton property
|
public static final ProgramContextAdder INSTANCE
private ProgramContextAdder()
public JavaNonTerminalProgramElement start(JavaNonTerminalProgramElement context, StatementBlock putIn, ContextStatementBlockInstantiation ct)
protected JavaNonTerminalProgramElement wrap(JavaNonTerminalProgramElement context, StatementBlock putIn, IntIterator prefixPos, int prefixDepth, PosInProgram prefix, PosInProgram suffix)
private final StatementBlock createWrapperBody(JavaNonTerminalProgramElement wrapper, StatementBlock putIn, PosInProgram suffix)
putIn
and
adds succeeding children of the innermost non terminal element
(usually statement block) in the context.wrapper
- the JavaNonTerminalProgramElement with the context
that has to be wrapped around the content of putIn
putIn
- the StatementBlock with content that has to be
wrapped by the elements hidden in the contextsuffix
- the PosInProgram describing the position of the
first element before the suffix of the contextputIn
together with the succeeding context elements
of the innermost context statement block (attention:
in a case like
{{{oldStmnt; list of further stmnt;}} moreStmnts; }
only the underscored part is returned
{{ __{putIn;....}__ }moreStmnts;}
adding the other braces including the moreStmnts;
part has to be done elsewhere.protected StatementBlock createStatementBlockWrapper(StatementBlock wrapper, JavaNonTerminalProgramElement replacement)
wrapper
- the StatementBlock where to replace the first
statementreplacement
- the StatementBlock that replaces the first
statement of the blockprotected Try createTryStatementWrapper(StatementBlock body, Try old)
protected MethodFrame createMethodFrameWrapper(MethodFrame old, StatementBlock body)
protected LabeledStatement createLabeledStatementWrapper(LabeledStatement old, JavaNonTerminalProgramElement body)
protected SynchronizedBlock createSynchronizedBlockWrapper(SynchronizedBlock old, StatementBlock body)