Package org.apache.sysds.runtime.instructions

## Class Instruction

- java.lang.Object
- - org.apache.sysds.runtime.instructions.Instruction

- Direct Known Subclasses:
    `CPInstruction`, `FEDInstruction`, `GPUInstruction`, `SPInstruction`

      public abstract class Instruction
      extends Object

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `Instruction.IType` |

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static String` | `DATATYPE_PREFIX` |
    `static String` | `FEDERATED_INST_PREFIX` |
    `static String` | `GPU_INST_PREFIX` |
    `static String` | `INSTRUCTION_DELIM` |
    `static String` | `LITERAL_PREFIX` |
    `static String` | `OPERAND_DELIM` |
    `static String` | `SP_INST_PREFIX` |
    `static String` | `VALUETYPE_PREFIX` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `int` | `getBeginColumn()` |
    `int` | `getBeginLine()` |
    `int` | `getEndColumn()` |
    `int` | `getEndLine()` |
    `String` | `getExtendedOpcode()` |
    `String` | `getFilename()` |
    `String` | `getGraphString()` |
    `long` | `getInstID()` | Getter for instruction unique identifier
    `String` | `getInstructionString()` |
    `int` | `getLineNum()` | Getter for instruction line number
    `String` | `getOpcode()` |
    `Operator` | `getOperator()` |
    `PrivacyConstraint` | `getPrivacyConstraint()` |
    `abstract Instruction.IType` | `getType()` |
    `void` | `postprocessInstruction​(ExecutionContext ec)` | This method should be used for any tear down after executing this instruction.
    `Instruction` | `preprocessInstruction​(ExecutionContext ec)` | This method should be used for any setup before executing this instruction.
    `void` | `printMe()` |
    `abstract void` | `processInstruction​(ExecutionContext ec)` | This method should be used to execute the instruction.
    `boolean` | `requiresLabelUpdate()` |
    `void` | `setInstID​(long id)` | Setter for instruction unique identifier
    `void` | `setLocation​(String filename, int beginLine, int endLine, int beginCol, int endCol)` |
    `void` | `setLocation​(Lop lop)` |
    `void` | `setLocation​(DataIdentifier id)` |
    `void` | `setLocation​(Instruction oldInst)` |
    `void` | `setPrivacyConstraint​(Lop lop)` |
    `void` | `setPrivacyConstraint​(PrivacyConstraint pc)` |
    `String` | `toString()` |
    `void` | `updateInstructionThreadID​(String pattern, String replace)` | All instructions that have thread-specific filenames or names encoded in it should overwrite this method in order to update (1) the in-memory instruction and (2) the instruction string

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

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

- - ### Field Detail

    - #### OPERAND_DELIM

          public static final String OPERAND_DELIM

      See Also:
        Constant Field Values

    - #### DATATYPE_PREFIX

          public static final String DATATYPE_PREFIX

      See Also:
        Constant Field Values

    - #### VALUETYPE_PREFIX

          public static final String VALUETYPE_PREFIX

      See Also:
        Constant Field Values

    - #### LITERAL_PREFIX

          public static final String LITERAL_PREFIX

      See Also:
        Constant Field Values

    - #### INSTRUCTION_DELIM

          public static final String INSTRUCTION_DELIM

      See Also:
        Constant Field Values

    - #### SP_INST_PREFIX

          public static final String SP_INST_PREFIX

      See Also:
        Constant Field Values

    - #### GPU_INST_PREFIX

          public static final String GPU_INST_PREFIX

      See Also:
        Constant Field Values

    - #### FEDERATED_INST_PREFIX

          public static final String FEDERATED_INST_PREFIX

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### getFilename

          public String getFilename()

    - #### getBeginLine

          public int getBeginLine()

    - #### getEndLine

          public int getEndLine()

    - #### getBeginColumn

          public int getBeginColumn()

    - #### getEndColumn

          public int getEndColumn()

    - #### getType

          public abstract Instruction.IType getType()

    - #### setLocation

          public void setLocation​(String filename,
                                  int beginLine,
                                  int endLine,
                                  int beginCol,
                                  int endCol)

    - #### setLocation

          public void setLocation​(Lop lop)

    - #### setLocation

          public void setLocation​(DataIdentifier id)

    - #### setLocation

          public void setLocation​(Instruction oldInst)

    - #### setPrivacyConstraint

          public void setPrivacyConstraint​(Lop lop)

    - #### setPrivacyConstraint

          public void setPrivacyConstraint​(PrivacyConstraint pc)

    - #### getPrivacyConstraint

          public PrivacyConstraint getPrivacyConstraint()

    - #### getOperator

          public Operator getOperator()

    - #### getLineNum

          public int getLineNum()

      Getter for instruction line number
      Returns:
        lineNum Instruction approximate DML script line number

    - #### setInstID

          public void setInstID​(long id)

      Setter for instruction unique identifier
      Parameters:
        `id` - Instruction unique identifier

    - #### getInstID

          public long getInstID()

      Getter for instruction unique identifier
      Returns:
        instID Instruction unique identifier

    - #### printMe

          public void printMe()

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### getInstructionString

          public String getInstructionString()

    - #### getGraphString

          public String getGraphString()

    - #### getOpcode

          public String getOpcode()

    - #### getExtendedOpcode

          public String getExtendedOpcode()

    - #### requiresLabelUpdate

          public boolean requiresLabelUpdate()

    - #### updateInstructionThreadID

          public void updateInstructionThreadID​(String pattern,
                                                String replace)

      All instructions that have thread-specific filenames or names encoded in it should overwrite this method in order to update (1) the in-memory instruction and (2) the instruction string
      Parameters:
        `pattern` - ?
        `replace` - ?

    - #### preprocessInstruction

          public Instruction preprocessInstruction​(ExecutionContext ec)

      This method should be used for any setup before executing this instruction. Overwriting methods should first call the super method and subsequently do their custom setup.
      Parameters:
        `ec` - execution context
      Returns:
        instruction

    - #### processInstruction

          public abstract void processInstruction​(ExecutionContext ec)

      This method should be used to execute the instruction.
      Parameters:
        `ec` - execution context

    - #### postprocessInstruction

          public void postprocessInstruction​(ExecutionContext ec)

      This method should be used for any tear down after executing this instruction. Overwriting methods should first do their custom tear down and subsequently call the super method.
      Parameters:
        `ec` - execution context