Package org.apache.sysds.runtime.controlprogram

# Class ProgramBlock

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

All Implemented Interfaces:
  `ParseInfo`

Direct Known Subclasses:
  `BasicProgramBlock`, `ForProgramBlock`, `FunctionProgramBlock`, `IfProgramBlock`, `WhileProgramBlock`

public abstract class ProgramBlock extends Object implements ParseInfo

## Field Summary

Fields
Modifier and Type
Field
Description
`int`
`_beginColumn`
`int`
`_beginLine`
`int`
`_endColumn`
`int`
`_endLine`
`String`
`_filename`
`String`
`_text`
`static boolean`
`CHECK_MATRIX_PROPERTIES`
`static final String`
`PRED_VAR`

## Constructor Summary

Constructors
Constructor
Description
`ProgramBlock(Program prog)`

## Method Summary

Modifier and Type
Method
Description
`abstract void`
`execute(ExecutionContext ec)`
Executes this program block (incl recompilation if required).
`ScalarObject`
`executePredicate(ArrayList<Instruction> inst, Hop hops, boolean requiresRecompile, Types.ValueType retType, ExecutionContext ec)`
Executes given predicate instructions (incl recompilation if required)
`int`
`getBeginColumn()`
`int`
`getBeginLine()`
`abstract ArrayList<ProgramBlock>`
`getChildBlocks()`
Get the list of child program blocks if nested; otherwise this method returns null.
`int`
`getEndColumn()`
`int`
`getEndLine()`
`Instruction`
`getExitInstruction()`
`String`
`getFilename()`
`Program`
`getProgram()`
`StatementBlock`
`getStatementBlock()`
`String`
`getText()`
`long`
`getThreadID()`
`boolean`
`hasThreadID()`
`abstract boolean`
`isNested()`
Indicates if the program block is nested, i.e., if it contains other program blocks (e.g., loops).
`static boolean`
`isThreadID(long tid)`
`String`
`printBlockErrorLocation()`
`void`
`setBeginColumn(int passed)`
`void`
`setBeginLine(int passed)`
`void`
`setEndColumn(int passed)`
`void`
`setEndLine(int passed)`
`void`
`setExitInstruction(Instruction rmVar)`
`void`
`setFilename(String passed)`
`void`
`setParseInfo(ParseInfo parseInfo)`
Set parse information.
`void`
`setStatementBlock(StatementBlock sb)`
`void`
`setText(String text)`
`void`
`setThreadID(long id)`

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

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

## Field Details

### PRED_VAR

public static final String PRED_VAR

See Also:
  - Constant Field Values

### CHECK_MATRIX_PROPERTIES

public static boolean CHECK_MATRIX_PROPERTIES

### _filename

public String _filename

### _beginLine

public int _beginLine

### _beginColumn

public int _beginColumn

### _endLine

public int _endLine

### _endColumn

public int _endColumn

### _text

public String _text

## Constructor Details

### ProgramBlock

public ProgramBlock(Program prog)

## Method Details

### getProgram

public Program getProgram()

### getStatementBlock

public StatementBlock getStatementBlock()

### setStatementBlock

public void setStatementBlock(StatementBlock sb)

### setThreadID

public void setThreadID(long id)

### hasThreadID

public boolean hasThreadID()

### isThreadID

public static boolean isThreadID(long tid)

### getThreadID

public long getThreadID()

### setExitInstruction

public void setExitInstruction(Instruction rmVar)

### getExitInstruction

public Instruction getExitInstruction()

### getChildBlocks

public abstract ArrayList<ProgramBlock> getChildBlocks()
Get the list of child program blocks if nested; otherwise this method returns null.

Returns:
  list of program blocks

### isNested

public abstract boolean isNested()
Indicates if the program block is nested, i.e., if it contains other program blocks (e.g., loops).

Returns:
  true if nested

### execute

public abstract void execute(ExecutionContext ec)
Executes this program block (incl recompilation if required).

Parameters:
  `ec` - execution context

### executePredicate

public ScalarObject executePredicate(ArrayList<Instruction> inst, Hop hops, boolean requiresRecompile, Types.ValueType retType, ExecutionContext ec)
Executes given predicate instructions (incl recompilation if required)

Parameters:
  `inst` - list of instructions
  `hops` - high-level operator
  `requiresRecompile` - true if requires recompile
  `retType` - value type of the return type
  `ec` - execution context
Returns:
  scalar object

### setFilename

public void setFilename(String passed)

Specified by:
  `setFilename` in interface `ParseInfo`

### setBeginLine

public void setBeginLine(int passed)

Specified by:
  `setBeginLine` in interface `ParseInfo`

### setBeginColumn

public void setBeginColumn(int passed)

Specified by:
  `setBeginColumn` in interface `ParseInfo`

### setEndLine

public void setEndLine(int passed)

Specified by:
  `setEndLine` in interface `ParseInfo`

### setEndColumn

public void setEndColumn(int passed)

Specified by:
  `setEndColumn` in interface `ParseInfo`

### setText

public void setText(String text)

Specified by:
  `setText` in interface `ParseInfo`

### getFilename

public String getFilename()

Specified by:
  `getFilename` in interface `ParseInfo`

### getBeginLine

public int getBeginLine()

Specified by:
  `getBeginLine` in interface `ParseInfo`

### getBeginColumn

public int getBeginColumn()

Specified by:
  `getBeginColumn` in interface `ParseInfo`

### getEndLine

public int getEndLine()

Specified by:
  `getEndLine` in interface `ParseInfo`

### getEndColumn

public int getEndColumn()

Specified by:
  `getEndColumn` in interface `ParseInfo`

### getText

public String getText()

Specified by:
  `getText` in interface `ParseInfo`

### printBlockErrorLocation

public String printBlockErrorLocation()

### setParseInfo

public void setParseInfo(ParseInfo parseInfo)
Set parse information.

Parameters:
  `parseInfo` - parse information, such as beginning line position, beginning column position, ending line position, ending column position, text, and filename