Class IfThenElse

    • Constructor Detail

      • IfThenElse

        public IfThenElse​(NodeList<CFG,​Statement,​Edge> cfgMatrix,
                          Statement condition,
                          Statement firstFollower,
                          java.util.Collection<Statement> trueBranch,
                          java.util.Collection<Statement> falseBranch)
        Builds the if-then-else.
        Parameters:
        cfgMatrix - the matrix of the cfg containing this if-then-else
        condition - the condition of the if-then-else
        firstFollower - the first statement after the if-then-else exits one of the branches
        trueBranch - the statements in the true branch
        falseBranch - the statements in the false branch
    • Method Detail

      • bodyStatements

        public java.util.Collection<Statement> bodyStatements()
        Description copied from class: ControlFlowStructure
        Yields all the Statements contained in the body of this structure (thus excluding the condition and the first follower).
        Specified by:
        bodyStatements in class ControlFlowStructure
        Returns:
        the statements of the body of this structure
      • getTrueBranch

        public java.util.Collection<Statement> getTrueBranch()
        Yields the Statements contained in the true branch of this if-then-else.
        Returns:
        the true branch of the if-then-else
      • getFalseBranch

        public java.util.Collection<Statement> getFalseBranch()
        Yields the Statements contained in the false branch of this if-then-else.
        Returns:
        the false branch of the if-then-else
      • contains

        public boolean contains​(Statement st)
        Description copied from class: ControlFlowStructure
        Yields true if the given statement is part of the body of this structure. Note that this method will return false if st is either the condition of the first follower of this structure.
        Specified by:
        contains in class ControlFlowStructure
        Parameters:
        st - the statement to check
        Returns:
        true if st is in the body of this structure
      • getTargetedStatements

        public java.util.Collection<Statement> getTargetedStatements()
        Description copied from class: ControlFlowStructure
        Yields all the statements that are targeted by some node in this structure. This always comprises destination nodes of conditional branches, and join points where more than one branch converge. Equivalently, these can be characterized as targets of conditional or unconditional branches and followers of conditional or unconditional branches.
        Specified by:
        getTargetedStatements in class ControlFlowStructure
        Returns:
        the targeted statements