Home Reference Source
``import Integer from 'neo4j-driver/lib/v1/integer.js'``
public class

# Integer

this class was deprecated. This class will be removed or made internal in a future version of the driver.

Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as signed integers. See exported functions for more convenient ways of operating integers. Use `int()` function to create new integers, `isInt()` to check if given object is integer, `inSafeRange()` to check if it is safe to convert given value to native number, `toNumber()` and `toString()` to convert given integer to number or string respectively.

## Constructor Summary

 Public Constructor public

## Member Summary

 Public Members public high: number The high 32 bits as a signed value. public low: number The low 32 bits as a signed value.

## Method Summary

 Public Methods public add(addend: Integer | number | string): Integer Returns the sum of this and the specified Integer. public and(other: Integer | number | string): Integer Returns the bitwise AND of this Integer and the specified. public compare(other: Integer | number | string): number Compares this Integer's value with the specified's. public div(divisor: Integer | number | string): Integer Returns this Integer divided by the specified. public equals(other: Integer | number | string): boolean Tests if this Integer's value equals the specified's. public getHighBits(): number Gets the high 32 bits as a signed integer. public getLowBits(): number Gets the low 32 bits as a signed integer. public getNumBitsAbs(): number Gets the number of bits needed to represent the absolute value of this Integer. public greaterThan(other: Integer | number | string): boolean Tests if this Integer's value is greater than the specified's. public greaterThanOrEqual(other: Integer | number | string): boolean Tests if this Integer's value is greater than or equal the specified's. public inSafeRange(): * public isEven(): boolean Tests if this Integer's value is even. public isNegative(): boolean Tests if this Integer's value is negative. public isOdd(): boolean Tests if this Integer's value is odd. public isPositive(): boolean Tests if this Integer's value is positive. public isZero(): boolean Tests if this Integer's value equals zero. public lessThan(other: Integer | number | string): boolean Tests if this Integer's value is less than the specified's. public lessThanOrEqual(other: Integer | number | string): boolean Tests if this Integer's value is less than or equal the specified's. public modulo(divisor: Integer | number | string): Integer Returns this Integer modulo the specified. public multiply(multiplier: Integer | number | string): Integer Returns the product of this and the specified Integer. public negate(): Integer Negates this Integer's value. public not(): Integer Returns the bitwise NOT of this Integer. public notEquals(other: Integer | number | string): boolean Tests if this Integer's value differs from the specified's. public or(other: Integer | number | string): Integer Returns the bitwise OR of this Integer and the specified. public shiftLeft(numBits: number | !Integer): Integer Returns this Integer with bits shifted to the left by the given amount. public shiftRight(numBits: number | !Integer): Integer Returns this Integer with bits arithmetically shifted to the right by the given amount. public subtract(subtrahend: Integer | number | string): Integer Returns the difference of this and the specified Integer. public toInt(): number Converts the Integer to an exact javascript Number, assuming it is a 32 bit integer. public toNumber(): number Converts the Integer to a the nearest floating-point representation of this value (double, 53 bit mantissa). public toNumberOrInfinity(): number Converts the Integer to native number or -Infinity/+Infinity when it does not fit. public toString(radix: number=): string Converts the Integer to a string written in the specified radix. public xor(other: Integer | number | string): Integer Returns the bitwise XOR of this Integer and the given one.

## Public Members

### publichigh: number source

The high 32 bits as a signed value.

### publiclow: number source

The low 32 bits as a signed value.

## Public Methods

Returns the sum of this and the specified Integer.

#### Params:

 Name Type Attribute Description addend Integer | number | string nullable: false Addend

#### Return:

 Integer (nullable: false) Sum

### publicand(other: Integer | number | string): Integer source

Returns the bitwise AND of this Integer and the specified.

#### Params:

 Name Type Attribute Description other Integer | number | string nullable: false Other Integer

#### Return:

 Integer (nullable: false)

### publiccompare(other: Integer | number | string): number source

Compares this Integer's value with the specified's.

#### Params:

 Name Type Attribute Description other Integer | number | string nullable: false Other value

#### Return:

 number 0 if they are the same, 1 if the this is greater and -1 if the given one is greater

### publicdiv(divisor: Integer | number | string): Integer source

Returns this Integer divided by the specified.

#### Params:

 Name Type Attribute Description divisor Integer | number | string nullable: false Divisor

#### Return:

 Integer (nullable: false) Quotient

### publicequals(other: Integer | number | string): boolean source

Tests if this Integer's value equals the specified's.

#### Params:

 Name Type Attribute Description other Integer | number | string nullable: false Other value

#### Return:

 boolean

### publicgetHighBits(): number source

Gets the high 32 bits as a signed integer.

#### Return:

 number Signed high bits

### publicgetLowBits(): number source

Gets the low 32 bits as a signed integer.

#### Return:

 number Signed low bits

### publicgetNumBitsAbs(): number source

Gets the number of bits needed to represent the absolute value of this Integer.

 number

### publicgreaterThan(other: Integer | number | string): boolean source

Tests if this Integer's value is greater than the specified's.

#### Params:

 Name Type Attribute Description other Integer | number | string nullable: false Other value

#### Return:

 boolean

### publicgreaterThanOrEqual(other: Integer | number | string): boolean source

Tests if this Integer's value is greater than or equal the specified's.

#### Params:

 Name Type Attribute Description other Integer | number | string nullable: false Other value

#### Return:

 boolean

 *

### publicisEven(): boolean source

Tests if this Integer's value is even.

#### Return:

 boolean

### publicisNegative(): boolean source

Tests if this Integer's value is negative.

#### Return:

 boolean

### publicisOdd(): boolean source

Tests if this Integer's value is odd.

#### Return:

 boolean

### publicisPositive(): boolean source

Tests if this Integer's value is positive.

#### Return:

 boolean

### publicisZero(): boolean source

Tests if this Integer's value equals zero.

#### Return:

 boolean

### publiclessThan(other: Integer | number | string): boolean source

Tests if this Integer's value is less than the specified's.

#### Params:

 Name Type Attribute Description other Integer | number | string nullable: false Other value

#### Return:

 boolean

### publiclessThanOrEqual(other: Integer | number | string): boolean source

Tests if this Integer's value is less than or equal the specified's.

#### Params:

 Name Type Attribute Description other Integer | number | string nullable: false Other value

#### Return:

 boolean

### publicmodulo(divisor: Integer | number | string): Integer source

Returns this Integer modulo the specified.

#### Params:

 Name Type Attribute Description divisor Integer | number | string nullable: false Divisor

#### Return:

 Integer (nullable: false) Remainder

### publicmultiply(multiplier: Integer | number | string): Integer source

Returns the product of this and the specified Integer.

#### Params:

 Name Type Attribute Description multiplier Integer | number | string nullable: false Multiplier

#### Return:

 Integer (nullable: false) Product

### publicnegate(): Integer source

Negates this Integer's value.

#### Return:

 Integer (nullable: false) Negated Integer

### publicnot(): Integer source

Returns the bitwise NOT of this Integer.

#### Return:

 Integer (nullable: false)

### publicnotEquals(other: Integer | number | string): boolean source

Tests if this Integer's value differs from the specified's.

#### Params:

 Name Type Attribute Description other Integer | number | string nullable: false Other value

#### Return:

 boolean

### publicor(other: Integer | number | string): Integer source

Returns the bitwise OR of this Integer and the specified.

#### Params:

 Name Type Attribute Description other Integer | number | string nullable: false Other Integer

#### Return:

 Integer (nullable: false)

### publicshiftLeft(numBits: number | !Integer): Integer source

Returns this Integer with bits shifted to the left by the given amount.

#### Params:

 Name Type Attribute Description numBits number | !Integer Number of bits

#### Return:

 Integer (nullable: false) Shifted Integer

### publicshiftRight(numBits: number | !Integer): Integer source

Returns this Integer with bits arithmetically shifted to the right by the given amount.

#### Params:

 Name Type Attribute Description numBits number | !Integer Number of bits

#### Return:

 Integer (nullable: false) Shifted Integer

### publicsubtract(subtrahend: Integer | number | string): Integer source

Returns the difference of this and the specified Integer.

#### Params:

 Name Type Attribute Description subtrahend Integer | number | string nullable: false Subtrahend

#### Return:

 Integer (nullable: false) Difference

### publictoInt(): number source

Converts the Integer to an exact javascript Number, assuming it is a 32 bit integer.

 number

### publictoNumber(): number source

Converts the Integer to a the nearest floating-point representation of this value (double, 53 bit mantissa).

 number

### publictoNumberOrInfinity(): number source

Converts the Integer to native number or -Infinity/+Infinity when it does not fit.

#### Return:

 number

Converts the Integer to a string written in the specified radix.

 string

#### Throw:

 RangeError If `radix` is out of range

### publicxor(other: Integer | number | string): Integer source

Returns the bitwise XOR of this Integer and the given one.

#### Params:

 Name Type Attribute Description other Integer | number | string nullable: false Other Integer

#### Return:

 Integer (nullable: false)