java.lang.Object
com.ibm.jzos.fields.ExternalDecimalAsLongField
- All Implemented Interfaces:
Field
,LongAccessor
- Direct Known Subclasses:
ZonedEmbeddedLeadingSignedLongField
,ZonedEmbeddedTrailingSignedLongField
,ZonedExternalLeadingSignedLongField
,ZonedExternalTrailingSignedLongField
,ZonedUnsignedLongField
An external (aka "display", "zoned") decimal field up to 18 digits with long accessors.
- Since:
- 2.1.0
-
Constructor Summary
ConstructorsConstructorDescriptionExternalDecimalAsLongField
(int offset, int precision, boolean signed, boolean signTrailing, boolean signExternal, boolean blankWhenZero) Construct an instance -
Method Summary
Modifier and TypeMethodDescriptionboolean
Compare a Long, possibly null, with a long for equality.int
Answer the length of the field described by the receiverint
long
getLong
(byte[] buffer) Answer a long value from the given byte array buffer, at the offset of this field.long
getLong
(byte[] buffer, int bufOffset) Answer a long value from the given byte array buffer, at the bufOffset + offset of this field.int
Answer the offset of this field into some array of bytesint
boolean
boolean
isSigned()
Answer whether the field is signedboolean
boolean
void
putLong
(long value, byte[] buffer) Put a long value into the given byte array buffer, at the offset of this field.void
putLong
(long value, byte[] buffer, int bufOffset) Put a long value into the given byte array buffer, at the bufOffset + offset of this field.void
setOffset
(int offset) void
setSignExternal
(boolean signExternal)
-
Constructor Details
-
ExternalDecimalAsLongField
public ExternalDecimalAsLongField(int offset, int precision, boolean signed, boolean signTrailing, boolean signExternal, boolean blankWhenZero) Construct an instance- Parameters:
offset
- position of this fieldprecision
- total number of digits <= 18.signed
- if the field has a sign somewheresignTrailing
- true if the sign follows the field, false if it precedes itsignExternal
- true if the sign occupies a separate byte, false if it only occupies a high-order nibble Note: signTrailing 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 interfaceField
- Returns:
- int
-
getOffset
public int getOffset()Description copied from interface:Field
Answer the offset of this field into some array of bytes -
setOffset
public void setOffset(int offset) -
getLong
public long getLong(byte[] buffer) Answer a long value from the given byte array buffer, at the offset of this field.- Specified by:
getLong
in interfaceLongAccessor
- Parameters:
buffer
- the byte array- Returns:
- long
-
getLong
public long getLong(byte[] buffer, int bufOffset) Answer a long value from the given byte array buffer, at the bufOffset + offset of this field. TODO need to verify proper runtime optimization of this method.- Specified by:
getLong
in interfaceLongAccessor
- Parameters:
buffer
- the byte arraybufOffset
- the additional offset into the byte array- Returns:
- long
-
putLong
Put a long value into the given byte array buffer, at the offset of this field.- Specified by:
putLong
in interfaceLongAccessor
- Parameters:
value
- the long valuebuffer
- the byte array- Throws:
IllegalArgumentException
- if the value is out of range
-
putLong
Put a long value into the given byte array buffer, at the bufOffset + offset of this field.- Specified by:
putLong
in interfaceLongAccessor
- Parameters:
value
- the long valuebuffer
- the byte arraybufOffset
- 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 interfaceLongAccessor
-
equals
Compare a Long, possibly null, with a long for equality.- Parameters:
aLong
-along
-- Returns:
- boolean true if equal, false otherwise
-
isBlankWhenZero
public boolean isBlankWhenZero() -
isSignExternal
public boolean isSignExternal() -
isSignTrailing
public boolean isSignTrailing() -
getLength
public int getLength() -
getPrecision
public int getPrecision() -
setSignExternal
public void setSignExternal(boolean signExternal)
-