[DEPRECATED] Script: Class dw.util.BigInteger

Class 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

BigInteger()

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.

add(value : Number) : BigInteger

Adds a Number value to this Integer and returns the new Integer.

add(value : BigInteger) : BigInteger

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

assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values

Constructor Detail

BigInteger

publicBigInteger()

Constructs a new Integer with the value 0.


BigInteger

publicBigInteger(value : Number)

Constructs a new Integer using the specified Number value.

Parameters:

value - the value to use.


BigInteger

publicBigInteger(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

add

add(value : Number) : BigInteger

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.


add

add(value : BigInteger) : BigInteger

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.