dw.util
Class BigInteger
dw.util.BigInteger
The Integer class is a helper class to represent an arbitrary long integer number. The Demandware framework doesn't use this class, but in some special cases web services that declare a XML element with "xsd:integer", which is by definition an arbitrary long integer number, require the use of this class. The class is designed in a way that it can be used very similar to a desktop calculator. For example: ``` var i = new Integer( 10 ); var result = d.add( 2 ).sub( 3 ).get(); ``` The above code will return 9 as result.
API Versioned:
No longer available as of version 22.7.
Deprecated:
Replaced by BigInt.
Constructor Summary
Constructs a new Integer with the value 0.
BigInteger(value : Number)
Constructs a new Integer using the specified Number value.
BigInteger(value : String)
Constructs a new Integer using the specified string representation of a number.
Method Summary
abs() : BigInteger
Returns a new Integer with the absolute value of this Integer.
Adds a Number value to this Integer and returns the new Integer.
Adds an Integer value to this Integer and returns the new Integer.
divide(value : Number) : BigInteger
Divides this Integer by the specified Integer and returns the new Integer.
divide(value : BigInteger) : BigInteger
Divides this Integer by the specified Integer and returns the new Integer.
equals(other : Object) : boolean
Compares two Integer values whether they are equivalent.
get() : Number
Returns the value of the Integer as a Number.
hashCode() : Number
Calculates the hash code for this Integer;
multiply(value : Number) : BigInteger
Multiples the specified Number value with this Integer and returns the new Integer.
multiply(value : BigInteger) : BigInteger
Multiples the specified Integer value with this Integer and returns the new Integer.
negate() : BigInteger
Returns a new Integer with the negated value of this Integer.
subtract(value : Number) : BigInteger
Subtracts the specified Number value from this Integer and returns the new Integer.
subtract(value : BigInteger) : BigInteger
Subtracts the specified Integer value from this Integer and returns the new Integer.
toString() : String
Returns a string representation of this object.
valueOf() : Object
The valueOf() method is called by the ECMAScript interpret to return the "natural" value of an object.
Methods inherited from class Object
Constructor Detail
BigInteger
public BigInteger()
Constructs a new Integer with the value 0.

BigInteger
public BigInteger(value : Number)
Constructs a new Integer using the specified Number value.
Parameters:
value - the value to use.

BigInteger
public BigInteger(value : String)
Constructs a new Integer using the specified string representation of a number.
Parameters:
value - the value to use.

Method Detail
abs
abs() : BigInteger
Returns a new Integer with the absolute value of this Integer.
Returns:
the new Integer

Adds a Number value to this Integer and returns the new Integer.
Parameters:
value - the value to add to this Integer.
Returns:
the new Integer with the value added.

Adds an Integer value to this Integer and returns the new Integer.
Parameters:
value - the value to add to this Integer.
Returns:
the new Integer with the value added.

divide
divide(value : Number) : BigInteger
Divides this Integer by the specified Integer and returns the new Integer.
Parameters:
value - the value to use to divide this Integer.
Returns:
the new Integer.

divide
divide(value : BigInteger) : BigInteger
Divides this Integer by the specified Integer and returns the new Integer.
Parameters:
value - the value to use to divide this Integer.
Returns:
the new Integer.

equals
equals(other : Object) : boolean
Compares two Integer values whether they are equivalent.
Parameters:
other - the object to compare against this Integer.

get
get() : Number
Returns the value of the Integer as a Number.
Returns:
the value of the Integer.

hashCode
hashCode() : Number
Calculates the hash code for this Integer;

multiply
multiply(value : Number) : BigInteger
Multiples the specified Number value with this Integer and returns the new Integer.
Parameters:
value - the value to multiply with this Integer.
Returns:
the new Integer.

multiply
multiply(value : BigInteger) : BigInteger
Multiples the specified Integer value with this Integer and returns the new Integer.
Parameters:
value - the value to multiply with this Integer.
Returns:
the new Integer.

negate
negate() : BigInteger
Returns a new Integer with the negated value of this Integer.
Returns:
the new Integer

subtract
subtract(value : Number) : BigInteger
Subtracts the specified Number value from this Integer and returns the new Integer.
Parameters:
value - the value to add to this Integer.
Returns:
the new Integer with the value subtraced.

subtract
subtract(value : BigInteger) : BigInteger
Subtracts the specified Integer value from this Integer and returns the new Integer.
Parameters:
value - the value to add to this Integer.
Returns:
the new Integer with the value subtraced.

toString
toString() : String
Returns a string representation of this object.
Returns:
a string representation of this object.

valueOf
valueOf() : Object
The valueOf() method is called by the ECMAScript interpret to return the "natural" value of an object. The Inetger object returns its current value as number. With this behavior script snippets can be written like: ``` var i = new Integer( 10 ); var x = 1 + d.add( 2 ); ``` where x will be at the end 13.
Returns:
the value of this object.

X Privacy Update: We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used. By continuing to use this site you are giving us your consent to do this. Privacy Policy.