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 String
PRED_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 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
setProgram(Program prog)
void
setStatementBlock(StatementBlock sb)
void
setText(String text)
void
setThreadID(long id)
-
-
-
Field Detail
-
PRED_VAR
public static final String PRED_VAR
- See Also:
- Constant Field Values
-
_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()
-
setProgram
public void setProgram(Program prog)
-
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:
setFilename
in interfaceParseInfo
-
setBeginLine
public void setBeginLine(int passed)
- Specified by:
setBeginLine
in interfaceParseInfo
-
setBeginColumn
public void setBeginColumn(int passed)
- Specified by:
setBeginColumn
in interfaceParseInfo
-
setEndLine
public void setEndLine(int passed)
- Specified by:
setEndLine
in interfaceParseInfo
-
setEndColumn
public void setEndColumn(int passed)
- Specified by:
setEndColumn
in interfaceParseInfo
-
getFilename
public String getFilename()
- Specified by:
getFilename
in interfaceParseInfo
-
getBeginLine
public int getBeginLine()
- Specified by:
getBeginLine
in interfaceParseInfo
-
getBeginColumn
public int getBeginColumn()
- Specified by:
getBeginColumn
in interfaceParseInfo
-
getEndLine
public int getEndLine()
- Specified by:
getEndLine
in interfaceParseInfo
-
getEndColumn
public int getEndColumn()
- Specified by:
getEndColumn
in 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
-
-