Package org.codehaus.groovy.classgen.asm

## Class BinaryExpressionWriter

- java.lang.Object
- - org.codehaus.groovy.classgen.asm.BinaryExpressionWriter

- Direct Known Subclasses:
    `BinaryFloatExpressionHelper`, `BinaryIntExpressionHelper`, `BinaryLongExpressionHelper`, `BinaryObjectExpressionHelper`

      public abstract class BinaryExpressionWriter
      extends Object

  Base class for writing primitive typed operations

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected static int[]` | `stdCompareCodes` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `BinaryExpressionWriter​(WriterController controller, MethodCaller arraySet, MethodCaller arrayGet)` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `arrayGet​(int operation, boolean simulate)` |
    `boolean` | `arraySet​(boolean simulate)` |
    `protected abstract void` | `doubleTwoOperands​(org.objectweb.asm.MethodVisitor mv)` |
    `protected MethodCaller` | `getArrayGetCaller()` |
    `protected ClassNode` | `getArrayGetResultType()` |
    `protected MethodCaller` | `getArraySetCaller()` |
    `protected abstract int` | `getBitwiseOperationBytecode​(int type)` |
    `protected abstract int` | `getCompareCode()` |
    `WriterController` | `getController()` | return writer controller
    `protected abstract ClassNode` | `getDevisionOpResultType()` |
    `protected abstract ClassNode` | `getNormalOpResultType()` |
    `protected abstract int` | `getShiftOperationBytecode​(int type)` |
    `protected abstract int` | `getStandardOperationBytecode​(int type)` |
    `protected abstract void` | `removeTwoOperands​(org.objectweb.asm.MethodVisitor mv)` |
    `void` | `setArraySetAndGet​(MethodCaller arraySet, MethodCaller arrayGet)` |
    `protected boolean` | `supportsDivision()` |
    `boolean` | `write​(int operation, boolean simulate)` |
    `protected boolean` | `writeBitwiseOp​(int type, boolean simulate)` | writes some the bitwise operations.
    `protected boolean` | `writeDivision​(boolean simulate)` |
    `protected abstract void` | `writeMinusMinus​(org.objectweb.asm.MethodVisitor mv)` |
    `protected abstract void` | `writePlusPlus​(org.objectweb.asm.MethodVisitor mv)` |
    `boolean` | `writePostOrPrefixMethod​(int operation, boolean simulate)` |
    `protected boolean` | `writeShiftOp​(int type, boolean simulate)` | Write shifting operations.
    `protected boolean` | `writeSpaceship​(int type, boolean simulate)` |
    `protected boolean` | `writeStdCompare​(int type, boolean simulate)` | writes some int standard operations for compares
    `protected boolean` | `writeStdOperators​(int type, boolean simulate)` |

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### stdCompareCodes

          protected static final int[] stdCompareCodes

  - ### Constructor Detail

    - #### BinaryExpressionWriter

          public BinaryExpressionWriter​(WriterController controller,
                                        MethodCaller arraySet,
                                        MethodCaller arrayGet)

  - ### Method Detail

    - #### getController

          public WriterController getController()

      return writer controller
      Since:
        2.5.0

    - #### getCompareCode

          protected abstract int getCompareCode()

    - #### writeStdCompare

          protected boolean writeStdCompare​(int type,
                                            boolean simulate)

      writes some int standard operations for compares
      Parameters:
        `type` - the token type
      Returns:
        true if a successful std operator write

    - #### doubleTwoOperands

          protected abstract void doubleTwoOperands​(org.objectweb.asm.MethodVisitor mv)

    - #### removeTwoOperands

          protected abstract void removeTwoOperands​(org.objectweb.asm.MethodVisitor mv)

    - #### writeSpaceship

          protected boolean writeSpaceship​(int type,
                                           boolean simulate)

    - #### getNormalOpResultType

          protected abstract ClassNode getNormalOpResultType()

    - #### getStandardOperationBytecode

          protected abstract int getStandardOperationBytecode​(int type)

    - #### writeStdOperators

          protected boolean writeStdOperators​(int type,
                                              boolean simulate)

    - #### writeDivision

          protected boolean writeDivision​(boolean simulate)

    - #### supportsDivision

          protected boolean supportsDivision()

    - #### getDevisionOpResultType

          protected abstract ClassNode getDevisionOpResultType()

    - #### getBitwiseOperationBytecode

          protected abstract int getBitwiseOperationBytecode​(int type)

    - #### writeBitwiseOp

          protected boolean writeBitwiseOp​(int type,
                                           boolean simulate)

      writes some the bitwise operations. type is one of BITWISE_OR, BITWISE_AND, BITWISE_XOR
      Parameters:
        `type` - the token type
      Returns:
        true if a successful bitwise operation write

    - #### getShiftOperationBytecode

          protected abstract int getShiftOperationBytecode​(int type)

    - #### writeShiftOp

          protected boolean writeShiftOp​(int type,
                                         boolean simulate)

      Write shifting operations. Type is one of LEFT_SHIFT, RIGHT_SHIFT, or RIGHT_SHIFT_UNSIGNED
      Parameters:
        `type` - the token type
      Returns:
        true on a successful shift operation write

    - #### write

          public boolean write​(int operation,
                               boolean simulate)

    - #### getArrayGetCaller

          protected MethodCaller getArrayGetCaller()

    - #### getArrayGetResultType

          protected ClassNode getArrayGetResultType()

    - #### getArraySetCaller

          protected MethodCaller getArraySetCaller()

    - #### setArraySetAndGet

          public void setArraySetAndGet​(MethodCaller arraySet,
                                        MethodCaller arrayGet)

    - #### arrayGet

          public boolean arrayGet​(int operation,
                                  boolean simulate)

    - #### arraySet

          public boolean arraySet​(boolean simulate)

    - #### writePostOrPrefixMethod

          public boolean writePostOrPrefixMethod​(int operation,
                                                 boolean simulate)

    - #### writePlusPlus

          protected abstract void writePlusPlus​(org.objectweb.asm.MethodVisitor mv)

    - #### writeMinusMinus

          protected abstract void writeMinusMinus​(org.objectweb.asm.MethodVisitor mv)