Module ibm.jzos

Class ExternalDecimalAsIntField

java.lang.Object
com.ibm.jzos.fields.ExternalDecimalAsIntField
All Implemented Interfaces:
Field, IntAccessor
Direct Known Subclasses:
ZonedEmbeddedLeadingSignedIntField, ZonedEmbeddedTrailingSignedIntField, ZonedExternalLeadingSignedIntField, ZonedExternalTrailingSignedIntField, ZonedUnsignedIntField

public class ExternalDecimalAsIntField extends Object implements IntAccessor
An external (aka "display", "zoned") decimal field up to 9 digits with int accessors.

Since:
2.1.0
  • Constructor Summary

    Constructors
    Constructor
    Description
    ExternalDecimalAsIntField(int offset, int precision, boolean signed, boolean signTrailing, boolean signExternal, boolean blankWhenZero)
    Construct an instance
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals(Integer anInteger, int anInt)
    Compare an Integer, possibly null, with an int for equality.
    int
    Answer the length of the field described by the receiver
    int
    getInt(byte[] buffer)
    Answer an int value from the given byte array buffer, at the offset of this field.
    int
    getInt(byte[] buffer, int bufOffset)
    Answer an int value from the given byte array buffer, at the bufOffset + offset of this field.
    int
     
    int
    Answer the offset of this field into some array of bytes
    int
     
    boolean
     
    boolean
    Answer whether the field is signed
    boolean
     
    boolean
     
    void
    putInt(int value, byte[] buffer)
    Put an int value into the given byte array buffer, at the offset of this field.
    void
    putInt(int value, byte[] buffer, int bufOffset)
    Put an int value into the given byte array buffer, at the bufOffset + offset of this field.
    void
    setOffset(int offset)
     

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ExternalDecimalAsIntField

      public ExternalDecimalAsIntField(int offset, int precision, boolean signed, boolean signTrailing, boolean signExternal, boolean blankWhenZero)
      Construct an instance
      Parameters:
      offset - position of this field
      precision - total number of digits <= 9.
      signed - if the field has a sign somewhere
      signTrailing - true if the sign follows the field, false if it precedes it
      signExternal - true if the sign occupies a separate byte, false if it only occupies a high-order nibble Note: signTailing and signExternal are ignored if signed is not true.
  • Method Details

    • getByteLength

      public int getByteLength()
      Description copied from interface: Field
      Answer the length of the field described by the receiver
      Specified by:
      getByteLength in interface Field
      Returns:
      int
    • getOffset

      public int getOffset()
      Description copied from interface: Field
      Answer the offset of this field into some array of bytes
      Specified by:
      getOffset in interface Field
      Returns:
      int
    • setOffset

      public void setOffset(int offset)
      Specified by:
      setOffset in interface Field
      See Also:
    • getInt

      public int getInt(byte[] buffer)
      Answer an int value from the given byte array buffer, at the offset of this field.
      Specified by:
      getInt in interface IntAccessor
      Parameters:
      buffer - the byte array
      Returns:
      int
    • getInt

      public int getInt(byte[] buffer, int bufOffset)
      Answer an int value from the given byte array buffer, at the bufOffset + offset of this field.
      Specified by:
      getInt in interface IntAccessor
      Parameters:
      buffer - the byte array
      bufOffset - the additional offset into the byte array
      Returns:
      int
    • putInt

      public void putInt(int value, byte[] buffer) throws IllegalArgumentException
      Put an int value into the given byte array buffer, at the offset of this field.
      Specified by:
      putInt in interface IntAccessor
      Parameters:
      value - the signed int value
      buffer - the byte array
      Throws:
      IllegalArgumentException - if the value is out of range
    • putInt

      public void putInt(int value, byte[] buffer, int bufOffset) throws IllegalArgumentException
      Put an int value into the given byte array buffer, at the bufOffset + offset of this field.
      Specified by:
      putInt in interface IntAccessor
      Parameters:
      value - the int value
      buffer - the byte array
      bufOffset - the additional offset into the byte array
      Throws:
      IllegalArgumentException - if the value is out of range
    • isSigned

      public boolean isSigned()
      Answer whether the field is signed
      Specified by:
      isSigned in interface IntAccessor
    • equals

      public boolean equals(Integer anInteger, int anInt)
      Compare an Integer, possibly null, with an int for equality.
      Parameters:
      anInteger -
      anInt -
      Returns:
      boolean true if equal, false otherwise
    • isBlankWhenZero

      public boolean isBlankWhenZero()
    • getLength

      public int getLength()
    • getPrecision

      public int getPrecision()
    • isSignExternal

      public boolean isSignExternal()
    • isSignTrailing

      public boolean isSignTrailing()