public class integer extends int64
unknown value
representation and the core comparison logic.
All Progress language features related to integer/decimal data
types are implemented in the MathOps
class (except comparison
logic which is in CompareOps
. All Progress integer/decimal
features are supported including all functionality that can be accessed
via operators and built-in Progress functions.
NumberType.FormatSpec
SECS_IN_A_DAY, SECS_IN_A_MIN, SECS_IN_AN_HOUR
FORMAT_DEC_SEP, FORMAT_GROUP_SEP, SIGN_CR, SIGN_DB, SIGN_DR, SIGN_LEFT_MINUS, SIGN_LEFT_PLUS, SIGN_NONE, SIGN_PAREN, SIGN_PAREN_EMBED, SIGN_RIGHT_MINUS, SIGN_RIGHT_PLUS
Constructor and Description |
---|
integer()
Default constructor which creates an instance representing the
unknown value . |
integer(BaseDataType value)
This is a special c'tor which should be used only when converting the
value returned by a function or method with polymorphic return type into the
expected type (i.e.
|
integer(boolean value)
Constructs an instance after copying the parameter's data into the
internal representation of this class.
|
integer(java.lang.Boolean value)
Constructs an instance after copying the parameter's data into the
internal representation of this class.
|
integer(character value)
Constructs an instance after converting the string representation
of a number into an integer.
|
integer(date value)
Constructs an instance after copying the parameter's data into the
internal representation of this class.
|
integer(decimal value)
Constructs an instance after casting the parameter into the internal representation of this
class.
|
integer(double value)
Constructs an instance after casting the parameter into the internal
representation of this class.
|
integer(int value)
Constructs an instance after casting the parameter into the internal
representation of this class.
|
integer(int64 value)
Constructs an instance after casting the parameter into the internal representation of this
class.
|
integer(integer value)
Constructs an instance after casting the parameter into the internal representation of this
class.
|
integer(logical value)
Constructs an instance after copying the parameter's data into the
internal representation of this class.
|
integer(long value)
Constructs an instance after casting the parameter into the internal representation of this
class.
|
integer(java.lang.Number value)
Constructs an instance after copying the parameter's data into the
internal representation of this class.
|
integer(java.lang.String value)
Constructs an instance after converting the string representation
of a number into an integer.
|
Modifier and Type | Method and Description |
---|---|
void |
assign(NumberType value)
Sets the state (data and unknown value) of this instance based on the state of the passed
instance.
|
void |
assign(Undoable value)
Sets the state (data and unknown value) of this instance based on the
state of the passed instance.
|
protected boolean |
checkBounds(long value)
Checks if
value can be assigned to this data type. |
BaseDataType |
duplicate()
Does the same as standard
clone() method but returns an instance of
BaseDataType and doesn't throw the CloneNotSupportedException . |
int |
hashCode()
Hash code implementation which is consistent with
BaseDataType.equals(java.lang.Object) . |
BaseDataType |
instantiateDefault()
Creates a new instance of the same type that represents the default initialized value.
|
protected BaseDataType |
instantiateDefaultExtent()
Get the default initialization for an extent variable of this type.
|
BaseDataType |
instantiateUnknown()
Creates a new instance of the same type that represents the
unknown value . |
void |
readExternal(java.io.ObjectInput in)
Replacement for the default object reading method.
|
void |
writeExternal(java.io.ObjectOutput out)
Replacement for the default object writing method.
|
assign, assign, assign, buildDefaultFormat, buildExportFormat, compareTo, decrement, doubleValue, equals, getBitsWorker, getValue, increment, intValue, isUnknown, longValue, maximum, maximum, minimum, minimum, obtainDefaultFormat, setBitsWorker, setUnknown, setValue, setValue, setValue, setValue, setValue, toBigDecimal, toJavaIntegerType, toJavaLongType, toString, toString, toStringExport, toStringMessage
defaultFormatString, generateSimpleFormat, getBits, getBits, getBits, getBits, getDecimalSeparator, getDecimalSeparatorIndex, getDefaultFormat, getDigitsLeft, getDigitsRight, getEmbedIndex, getExportFormat, getGroupSeparator, getNumericDecimalPoint, getNumericFormat, getNumericSeparator, getNumGroupSeparators, getUserLeft, getUserRight, getValueTextLength, isDigitChar, isFormatChar, overrideDefaultSeparators, parseDecimal, parseDecimal, parseDecimal, parseDecimal, parseDouble, parseDouble, parseFormat, setBits, setBits, setBits, setBits, setBits, setBits, setBits, setNumericFormat, setNumericFormat, setNumericFormat, setNumericFormat, setNumericFormat, setNumericFormat, setNumericFormat, subscript, toString, toString
calcFormatLength, deepCopy, elementsOfType, formatLength, generateDefault, generateUnknown, getTypeName, incompatibleTypesOnConversion, initializeDefaultExtent, isUnknownValue, maximum, minimum, notUnknownValue, sameType
changed, checkUndoable, checkUndoable, checkUndoable, getTransLevel, isGlobal, isUndoable, markUndoable, popBlock, rollback, setGlobal
public integer()
unknown value
.public integer(BaseDataType value)
int64.assign(BaseDataType)
).value
- The value to be used for this instance.public integer(long value)
Integer.MAX_VALUE
or smaller than
Integer.MIN_VALUE
(do not fit into the 32 bit representation) it
cannot be represented and error 15747 will be raised: "Value too large to fit in INTEGER"
It is not possible to yield an unknown value
from this constructor without
calling the method int64.setUnknown()
separate.
value
- The value to be used for this instance.public integer(int value)
It is not possible to yield an unknown value
from this
constructor without calling the method int64.setUnknown()
separate.
value
- The value to be used for this instance.public integer(double value)
value
- The value to be used for this instance.public integer(boolean value)
When the parameter is true
the resulting integer value
will be 1. Otherwise the value is 0.
value
- The value to be used for this instance.public integer(int64 value)
If the parameter represents the unknown value
, this instance will also
represent the unknown value
.
value
- The value to be used for this instance.public integer(integer value)
If the parameter represents the unknown value
, this instance will also
represent the unknown value
.
value
- The value to be used for this instance.public integer(decimal value)
If the parameter represents the unknown value
, this instance will also
represent the unknown value
.
value
- The value to be used for this instance.public integer(logical value)
If the parameter's represents the unknown value
, this
instance will also represent the unknown value
.
When the parameter is true
the resulting integer value
will be 1. Otherwise the value is 0.
value
- The value to be used for this instance.public integer(java.lang.String value)
value
- The value to be used for this instance.public integer(character value)
If the parameter is unknown value
the resulting integer is
the unknown value
.
value
- The value to be used for this instance.public integer(date value)
If the parameter's represents the unknown value
, this
instance will also represent the unknown value
.
value
- The value to be used for this instance.public integer(java.lang.Number value)
If the parameter is null
, this instance will represent
the unknown value
.
value
- The value to be used for this instance.public integer(java.lang.Boolean value)
If the parameter is null
, this instance will represent
the unknown value
.
value
- The value to be used for this instance.public void assign(NumberType value)
Overrides the superclass' implementatoin to optimize for the most common use case of
copying an integer
from another integer
(vs. from a
non-integer
NumberType
). In bypassing the superclass' more general
implementation, we avoid a significantly slower implementation which performs unnecessarily
(for this case) a bounds check and BigDecimal
instantiation.
In the event value
is not an integer
instance, delegate to the
superclass' implementation.
public int hashCode()
BaseDataType.equals(java.lang.Object)
.public BaseDataType instantiateUnknown()
unknown value
.instantiateUnknown
in class int64
unknown value
.public BaseDataType instantiateDefault()
instantiateDefault
in class int64
public BaseDataType duplicate()
clone()
method but returns an instance of
BaseDataType
and doesn't throw the CloneNotSupportedException
.public void assign(Undoable value)
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
readExternal
in class int64
in
- The input source from which fields will be restored.java.io.IOException
- In case of I/O errors.java.lang.ClassNotFoundException
- If payload can't be instantiated.public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
writeExternal
in class int64
out
- The output destination to which fields will be saved.java.io.IOException
- In case of I/O errors.protected BaseDataType instantiateDefaultExtent()
instantiateDefaultExtent
in class int64
protected boolean checkBounds(long value) throws ErrorConditionException
value
can be assigned to this data type. This is important for
integer
objects where the values must fit into 32 bit storage bounds.checkBounds
in class int64
value
- The valuetrue
if value fits into 32 bit storage bounds.ErrorConditionException
- Thrown if the value
do not fit within this data-type.