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, isEmpty
computeHashCode, equals, getArrayPos, matchChildren
getComments, hashCode, prettyPrintMain, reuseSignature
getEndPosition, getLastElement, getParentClass, getPositionInfo, getRelativePosition, getStartPosition, setParentClass, toSource, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getComments
getEndPosition, getLastElement, getPositionInfo, getRelativePosition, getStartPosition
private 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 NonTerminalProgramElement
getChildCount
in class StatementBlock
public ProgramElement getChildAt(int index)
getChildAt
in interface NonTerminalProgramElement
getChildAt
in class StatementBlock
index
- an index into this node's "virtual" child arrayjava.lang.ArrayIndexOutOfBoundsException
- if index is out
of boundspublic void visit(Visitor v)
visit
in interface SourceElement
visit
in class StatementBlock
v
- the Visitorpublic void prettyPrint(PrettyPrinter w) throws java.io.IOException
JavaSourceElement
prettyPrint
in interface SourceElement
prettyPrint
in class StatementBlock
w
- a pretty printer.java.io.IOException
- occasionally thrown.public java.lang.String toString()
JavaSourceElement
toString
in class JavaSourceElement
public int getTypeDeclarationCount()
StatementBlock
getTypeDeclarationCount
in interface TypeDeclarationContainer
getTypeDeclarationCount
in class StatementBlock
public TypeDeclaration getTypeDeclarationAt(int index)
getTypeDeclarationAt
in interface TypeDeclarationContainer
getTypeDeclarationAt
in class StatementBlock
public boolean compatibleBlockSize(int pos, int max)
compatibleBlockSize
in class JavaNonTerminalProgramElement
public MatchConditions match(SourceData source, MatchConditions matchCond)
ProgramElement
MatchConditions
with
the found instantiations of the schemavariables. If the match
failed, null is returned instead.match
in interface ProgramElement
match
in class JavaNonTerminalProgramElement
source
- 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)