public class ContextStatementBlock extends StatementBlock
JavaProgramElement.NameAbstractionTableDisabled| Modifier and Type | Field and Description |
|---|---|
private IExecutionContext |
executionContext
the last execution context of the context term
|
private int |
patternPrefixLength
length of this progran prefix
|
| Constructor and Description |
|---|
ContextStatementBlock(ExtList children)
creates a ContextStatementBlock
|
ContextStatementBlock(ExtList children,
IExecutionContext executionContext)
creates a ContextStatementBlock
|
ContextStatementBlock(Statement[] body,
IExecutionContext executionContext) |
ContextStatementBlock(Statement s,
IExecutionContext executionContext) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
compatibleBlockSize(int pos,
int max)
overrides the check of the superclass as unmatched elements will disappear in
the suffix of this ContextStatementBlock
|
ProgramElement |
getChildAt(int index)
Returns the child at the specified index in this node's "virtual"
child array
|
int |
getChildCount()
Returns the number of children of this node.
|
IExecutionContext |
getExecutionContext() |
private static ProgramPrefix |
getPrefixElementAt(ProgramPrefix prefix,
int i) |
TypeDeclaration |
getTypeDeclarationAt(int index) |
int |
getTypeDeclarationCount()
Get the number of type declarations in this container.
|
private MatchConditions |
makeContextInfoComplete(MatchConditions matchCond,
SourceData newSource,
ProgramPrefix prefix,
int pos,
PosInProgram relPos,
ProgramElement src,
Services services)
completes match of context block by adding the prefix end position
and the suffix start position
|
MatchConditions |
match(SourceData source,
MatchConditions matchCond)
matches the source "text" (@link SourceData#getSource()) against the pattern represented
by this object.
|
private MatchConditions |
matchInnerExecutionContext(MatchConditions matchCond,
Services services,
ExecutionContext lastExecutionContext,
ProgramPrefix prefix,
int pos,
ProgramElement src)
matches the inner most execution context in prefix, used to resolve references in
succeeding matchings
|
private PosInProgram |
matchPrefixEnd(ProgramPrefix prefix,
int pos,
PosInProgram relPos)
computes the PosInProgram of the first element, which is not part of the prefix
|
void |
prettyPrint(PrettyPrinter w)
Pretty printing the source element.
|
boolean |
requiresExplicitExecutionContextMatch() |
java.lang.String |
toString()
toString
|
void |
visit(Visitor v)
calls the corresponding method of a visitor in order to
perform some action/transformation on this element
|
computePrefixElements, equalsModRenaming, getBody, getFirstActiveChildPos, getFirstElement, getFirstElementIncludingBlocks, getInnerMostMethodFrame, getLastPrefixElement, getNextPrefixElement, getPrefixElements, getPrefixLength, getStatementAt, getStatementCount, hasNextPrefixElement, isEmptycomputeHashCode, equals, getArrayPos, matchChildrengetComments, hashCode, prettyPrintMain, reuseSignaturegetEndPosition, getLastElement, getParentClass, getPositionInfo, getRelativePosition, getStartPosition, setParentClass, toSource, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetCommentsgetEndPosition, getLastElement, getPositionInfo, getRelativePosition, getStartPositionprivate final IExecutionContext executionContext
private final int patternPrefixLength
public ContextStatementBlock(ExtList children)
children - the body of the context termpublic ContextStatementBlock(ExtList children, IExecutionContext executionContext)
children - the body of the context termexecutionContext - the required execution contextpublic ContextStatementBlock(Statement s, IExecutionContext executionContext)
public ContextStatementBlock(Statement[] body, IExecutionContext executionContext)
public boolean requiresExplicitExecutionContextMatch()
public IExecutionContext getExecutionContext()
public int getChildCount()
getChildCount in interface NonTerminalProgramElementgetChildCount in class StatementBlockpublic ProgramElement getChildAt(int index)
getChildAt in interface NonTerminalProgramElementgetChildAt in class StatementBlockindex - an index into this node's "virtual" child arrayjava.lang.ArrayIndexOutOfBoundsException - if index is out
of boundspublic void visit(Visitor v)
visit in interface SourceElementvisit in class StatementBlockv - the Visitorpublic void prettyPrint(PrettyPrinter w) throws java.io.IOException
JavaSourceElementprettyPrint in interface SourceElementprettyPrint in class StatementBlockw - a pretty printer.java.io.IOException - occasionally thrown.public java.lang.String toString()
JavaSourceElementtoString in class JavaSourceElementpublic int getTypeDeclarationCount()
StatementBlockgetTypeDeclarationCount in interface TypeDeclarationContainergetTypeDeclarationCount in class StatementBlockpublic TypeDeclaration getTypeDeclarationAt(int index)
getTypeDeclarationAt in interface TypeDeclarationContainergetTypeDeclarationAt in class StatementBlockpublic boolean compatibleBlockSize(int pos,
int max)
compatibleBlockSize in class JavaNonTerminalProgramElementpublic MatchConditions match(SourceData source, MatchConditions matchCond)
ProgramElementMatchConditions with
the found instantiations of the schemavariables. If the match
failed, null is returned instead.match in interface ProgramElementmatch in class JavaNonTerminalProgramElementsource - the SourceData with the program element to matchmatchCond - the MatchConditions found up to this pointprivate MatchConditions makeContextInfoComplete(MatchConditions matchCond, SourceData newSource, ProgramPrefix prefix, int pos, PosInProgram relPos, ProgramElement src, Services services)
private MatchConditions matchInnerExecutionContext(MatchConditions matchCond, Services services, ExecutionContext lastExecutionContext, ProgramPrefix prefix, int pos, ProgramElement src)
matchCond - the MatchCond the matchonditions already foundservices - the ServiceslastExecutionContext - the ExecutionContext if already foundprefix - the oute rmost prefixelement of the original sourcepos - an int as the number of prefix elements to disappear in the contextsrc - the original sourceprivate PosInProgram matchPrefixEnd(ProgramPrefix prefix, int pos, PosInProgram relPos)
prefix - the ProgramPrefix the outer most prefix element of the sourcepos - the number of elements to disappear in the contextrelPos - the position of the first active statement of element
prefix.getPrefixElementAt(pos);private static ProgramPrefix getPrefixElementAt(ProgramPrefix prefix, int i)