Class Opcode

  • All Implemented Interfaces:
    AstNode, Xmir

    public final class Opcode
    extends Object
    implements AstNode
    Opcode output node.
    Since:
    0.1
    • Constructor Detail

      • Opcode

        public Opcode​(int opcode,
                      Object... operands)
        Constructor.
        Parameters:
        opcode - Opcode
        operands - Opcode operands
      • Opcode

        public Opcode​(int opcode,
                      boolean counting)
        Constructor.
        Parameters:
        opcode - Opcode
        counting - Opcodes counting
      • Opcode

        public Opcode​(int opcode,
                      List<Object> operands)
        Constructor.
        Parameters:
        opcode - Opcode
        operands - Opcode operands
      • Opcode

        public Opcode​(org.eolang.jeo.representation.xmir.XmlNode node)
        Constructor.
        Parameters:
        node - XMIR node.
      • Opcode

        public Opcode​(org.eolang.jeo.representation.xmir.XmlInstruction instruction)
        Constructor.
        Parameters:
        instruction - XMIR instruction.
      • Opcode

        public Opcode​(int bytecode,
                      List<Object> operands,
                      boolean counting)
        Constructor.
        Parameters:
        bytecode - Bytecode
        operands - Opcode operands
        counting - Opcodes counting
    • Method Detail

      • toXmir

        public Iterable<org.xembly.Directive> toXmir()
        Description copied from interface: Xmir
        Convert node to XMIR.
        Specified by:
        toXmir in interface Xmir
        Returns:
        XMIR XML.
      • opcodes

        public List<AstNode> opcodes()
        Description copied from interface: AstNode
        Bytecode instructions.
        Specified by:
        opcodes in interface AstNode
        Returns:
        List of opcodes.
      • opcode

        public int opcode()
        Opcode number.
        Returns:
        Opcode number.
      • params

        public List<Object> params()
        Opcode operands.
        Returns:
        Opcode operands.
      • operand

        public Object operand​(int index)
        Instruction operand.
        Parameters:
        index - Operand index.
        Returns:
        Instruction operand.
      • pretty

        public String pretty()
        Pretty representation.
        Returns:
        Human-readable string that represents the opcode.
      • disableCounting

        public static void disableCounting()
        Disable opcodes counting. It is useful for tests.
        To do:
        #65:30min Remove public static method 'disableCounting()' from Opcode. Currently it is used in tests. We should find another way to disable opcodes counting in tests. When we find the way to do it, we should remove this method.