Interface IJavaCompound
- All Superinterfaces:
IJavaElement
,IJavaExpression
,IJavaStatement
- All Known Subinterfaces:
IJavaBlock
,IJavaDoWhile
,IJavaFor
,IJavaForEach
,IJavaIf
,IJavaSwitch
,IJavaSynchronizedBlock
,IJavaTry
,IJavaWhile
Java AST interface to represent compound statements.
Compound statements contain more statements, laid out in blocks
. A block is
the simplest type of compound. Compounds include if-conditionals, loops, switches, etc.
-
Field Summary
Fields inherited from interface com.pnfsoftware.jeb.core.units.code.java.IJavaElement
FLAG_BUILT, FLAG_FIELD_REFERENCES_OUTERCLASS, FLAG_LAMBDA_CLASS, FLAG_LAMBDA_IMPL, FLAG_OPTIONAL_RENDERING, FLAG_SECOND_PARAMETER_IS_OUTER_REF, FLAG_STICKY
-
Method Summary
Modifier and TypeMethodDescriptionDuplicate this element.Generate a flat list of AST and pseudo-AST elements that make up this block.Get the list of blocks contained in this compound.getSubElements
(boolean excludeSubBlocks) This specialized version ofIJavaElement.getSubElements()
allows the caller to exclude collecting sub-blocks of this compound.boolean
insertAt
(int target_offset, IJavaStatement insert_stm) Insert a statement at a particular offset within the AST.void
reset()
Reset the compound.Methods inherited from interface com.pnfsoftware.jeb.core.units.code.java.IJavaElement
addFlags, addTag, canCauseException, collectAllPhysicalOffsets, generate, getData, getElementType, getFlags, getOrigin, getPhysicalMethodIndex, getPhysicalOffset, getReconAnon, getReconEnum, getReconEnummap, getReconLambda, getSubElements, getTags, hasFlags, hasPhysicalMethodIndex, hasPhysicalOffset, isReconArtifact, removeFlags, removeTag, replaceSubElement, setData, setFlags, setLambdaRecon, setOrigin, setPhysicalMethodIndex, setPhysicalOffset, setReconAnon, setReconEnum, setReconEnummap, toShortString, visitDepthPost, visitDepthPost, visitDepthPost, visitDepthPost, visitDepthPre, visitDepthPre, visitDepthPre
Methods inherited from interface com.pnfsoftware.jeb.core.units.code.java.IJavaStatement
getIntermediateOffset, setIntermediateOffset
-
Method Details
-
getBlocks
List<IJavaBlock> getBlocks()Get the list of blocks contained in this compound.Caveat: if this compound is a block itself, the returned list is not empty, it contains self.
- Returns:
- the list of blocks
-
insertAt
Insert a statement at a particular offset within the AST. This function recurses down the AST tree, inside the blocks, to find the exact location where the statement should be inserted.- Parameters:
target_offset
-insert_stm
-- Returns:
-
generateFlatList
List<IJavaStatement> generateFlatList()Generate a flat list of AST and pseudo-AST elements that make up this block. This function allows the caller to get a flat representation of the AST, much like a programmer would view a source code. Note that the statements returned can be pseudo statements, ie, they're not real statements. For example, a flat view of a conditional block would return pseudo-statements to represent the "if" line, the "else if" lines, and the "else" line.- Returns:
- a list of statements and pseudo-statements
-
reset
void reset()Reset the compound. Internal use. -
getSubElements
This specialized version ofIJavaElement.getSubElements()
allows the caller to exclude collecting sub-blocks of this compound.- Parameters:
excludeSubBlocks
-- Returns:
-
duplicate
IJavaCompound duplicate()Description copied from interface:IJavaElement
Duplicate this element.- Specified by:
duplicate
in interfaceIJavaElement
- Specified by:
duplicate
in interfaceIJavaExpression
- Specified by:
duplicate
in interfaceIJavaStatement
- Returns:
- a (possibly) duplicated object of the same type
-