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_beginColumnint_beginLineint_endColumnint_endLineString_filenameString_textstatic booleanCHECK_MATRIX_PROPERTIESstatic StringPRED_VAR 
- 
Constructor Summary
Constructors Constructor Description ProgramBlock(Program prog) 
- 
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidexecute(ExecutionContext ec)Executes this program block (incl recompilation if required).ScalarObjectexecutePredicate(ArrayList<Instruction> inst, Hop hops, boolean requiresRecompile, Types.ValueType retType, ExecutionContext ec)Executes given predicate instructions (incl recompilation if required)intgetBeginColumn()intgetBeginLine()abstract ArrayList<ProgramBlock>getChildBlocks()Get the list of child program blocks if nested; otherwise this method returns null.intgetEndColumn()intgetEndLine()InstructiongetExitInstruction()StringgetFilename()ProgramgetProgram()StatementBlockgetStatementBlock()StringgetText()longgetThreadID()booleanhasThreadID()abstract booleanisNested()Indicates if the program block is nested, i.e., if it contains other program blocks (e.g., loops).static booleanisThreadID(long tid)StringprintBlockErrorLocation()voidsetBeginColumn(int passed)voidsetBeginLine(int passed)voidsetEndColumn(int passed)voidsetEndLine(int passed)voidsetExitInstruction(Instruction rmVar)voidsetFilename(String passed)voidsetParseInfo(ParseInfo parseInfo)Set parse information.voidsetStatementBlock(StatementBlock sb)voidsetText(String text)voidsetThreadID(long id) 
 - 
 
- 
- 
Field Detail
- 
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 Detail
- 
ProgramBlock
public ProgramBlock(Program prog)
 
 - 
 
- 
Method Detail
- 
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 instructionshops- high-level operatorrequiresRecompile- true if requires recompileretType- value type of the return typeec- execution context- Returns:
 - scalar object
 
 
- 
setFilename
public void setFilename(String passed)
- Specified by:
 setFilenamein interfaceParseInfo
 
- 
setBeginLine
public void setBeginLine(int passed)
- Specified by:
 setBeginLinein interfaceParseInfo
 
- 
setBeginColumn
public void setBeginColumn(int passed)
- Specified by:
 setBeginColumnin interfaceParseInfo
 
- 
setEndLine
public void setEndLine(int passed)
- Specified by:
 setEndLinein interfaceParseInfo
 
- 
setEndColumn
public void setEndColumn(int passed)
- Specified by:
 setEndColumnin interfaceParseInfo
 
- 
getFilename
public String getFilename()
- Specified by:
 getFilenamein interfaceParseInfo
 
- 
getBeginLine
public int getBeginLine()
- Specified by:
 getBeginLinein interfaceParseInfo
 
- 
getBeginColumn
public int getBeginColumn()
- Specified by:
 getBeginColumnin interfaceParseInfo
 
- 
getEndLine
public int getEndLine()
- Specified by:
 getEndLinein interfaceParseInfo
 
- 
getEndColumn
public int getEndColumn()
- Specified by:
 getEndColumnin interfaceParseInfo
 
- 
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
 
 - 
 
 -