org.apache.sysds.runtime.controlprogram

## Class IfProgramBlock

- java.lang.Object
- - org.apache.sysds.runtime.controlprogram.ProgramBlock
  - - org.apache.sysds.runtime.controlprogram.IfProgramBlock

All Implemented Interfaces:
  ParseInfo

    public class IfProgramBlock
    extends ProgramBlock

### Field Summary

### Fields inherited from class org.apache.sysds.runtime.controlprogram.ProgramBlock

`_beginColumn, _beginLine, _endColumn, _endLine, _filename, _text, PRED_VAR`

### Constructor Summary

Constructors
Constructor and Description
`IfProgramBlock(Program prog, ArrayList<Instruction> predicate)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addProgramBlockElseBody(ProgramBlock pb)`
`void` `addProgramBlockIfBody(ProgramBlock pb)`
`void` `execute(ExecutionContext ec)` Executes this program block (incl recompilation if required).
`ArrayList<ProgramBlock>` `getChildBlocks()` Get the list of child program blocks if nested; otherwise this method returns null.
`ArrayList<ProgramBlock>` `getChildBlocksElseBody()`
`ArrayList<ProgramBlock>` `getChildBlocksIfBody()`
`ArrayList<Instruction>` `getPredicate()`
`boolean` `isNested()` Indicates if the program block is nested, i.e., if it contains other program blocks (e.g., loops).
`String` `printBlockErrorLocation()`
`void` `setChildBlocksElseBody(ArrayList<ProgramBlock> blocks)`
`void` `setChildBlocksIfBody(ArrayList<ProgramBlock> blocks)`
`void` `setLineageDedupPathPos(int pos)`
`void` `setPredicate(ArrayList<Instruction> predicate)`

### Methods inherited from class org.apache.sysds.runtime.controlprogram.ProgramBlock

`executePredicate, getBeginColumn, getBeginLine, getEndColumn, getEndLine, getExitInstruction, getFilename, getProgram, getStatementBlock, getText, getThreadID, hasThreadID, isThreadID, setBeginColumn, setBeginLine, setEndColumn, setEndLine, setExitInstruction, setFilename, setParseInfo, setProgram, setStatementBlock, setText, setThreadID`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.apache.sysds.parser.ParseInfo

`ctxAndFilenameToParseInfo`

### Constructor Detail

#### IfProgramBlock

    public IfProgramBlock(Program prog,
                          ArrayList<Instruction> predicate)

### Method Detail

#### getChildBlocksIfBody

    public ArrayList<ProgramBlock> getChildBlocksIfBody()

#### setChildBlocksIfBody

    public void setChildBlocksIfBody(ArrayList<ProgramBlock> blocks)

#### addProgramBlockIfBody

    public void addProgramBlockIfBody(ProgramBlock pb)

#### getChildBlocksElseBody

    public ArrayList<ProgramBlock> getChildBlocksElseBody()

#### setChildBlocksElseBody

    public void setChildBlocksElseBody(ArrayList<ProgramBlock> blocks)

#### addProgramBlockElseBody

    public void addProgramBlockElseBody(ProgramBlock pb)

#### getPredicate

    public ArrayList<Instruction> getPredicate()

#### setPredicate

    public void setPredicate(ArrayList<Instruction> predicate)

#### getChildBlocks

    public ArrayList<ProgramBlock> getChildBlocks()

Description copied from class: `ProgramBlock`
Get the list of child program blocks if nested; otherwise this method returns null.

Specified by:
  `getChildBlocks` in class `ProgramBlock`
Returns:
  list of program blocks

#### isNested

    public boolean isNested()

Description copied from class: `ProgramBlock`
Indicates if the program block is nested, i.e., if it contains other program blocks (e.g., loops).

Specified by:
  `isNested` in class `ProgramBlock`
Returns:
  true if nested

#### setLineageDedupPathPos

    public void setLineageDedupPathPos(int pos)

#### execute

    public void execute(ExecutionContext ec)

Description copied from class: `ProgramBlock`
Executes this program block (incl recompilation if required).

Specified by:
  `execute` in class `ProgramBlock`
Parameters:
  `ec` - execution context

#### printBlockErrorLocation

    public String printBlockErrorLocation()

Overrides:
  `printBlockErrorLocation` in class `ProgramBlock`