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 Details

    • PRED_VAR

      public static final String PRED_VAR
      See Also:
    • 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