Class IPAddr

Expand description

An base class for IPv4 and IPv6 addresses.

Constructors§

§

constructor

§

new IPAddr<T extends IPAddr<T>>(): IPAddr<T>

Methods§

source§

compare

source§

compare(other: T): number

Performs a comparison between two addresses.

If the two addresses are equal, returns 0. If the address is greater than the parameter, returns 1. If the address is less than the parameter, returns -1.

source§

eq

source§

eq(other: IPAddr<any>): boolean

Determine if the two addresses are equal.

If the two addresses are in different type, eg. one is IPv4Addr and another is IPv6Addr, the function will always return false.

source§

gt

source§

gt(other: T): boolean

Determine if the address is greater than the parameter.

If the two addresses are in different type, eg. one is IPv4Addr and another is IPv6Addr, the function will throw an error.

source§

gte

source§

gte(other: T): boolean

Determine if the address is greater than or equal to the parameter.

If the two addresses are in different type, eg. one is IPv4Addr and another is IPv6Addr, the function will throw an error.

source§

isMax

source§

isMax(): boolean

Determine if the address is the maximum possible address.

source§

isMin

source§

isMin(): boolean

Determine if the address is the minimum possible address.

source§

isSameType

source§

isSameType(other: object): boolean

Determine if the given object is an instance of the address' class.

source§

lt

source§

lt(other: T): boolean

Determine if the address is less than the parameter.

If the two addresses are in different type, eg. one is IPv4Addr and another is IPv6Addr, the function will throw an error.

source§

lte

source§

lte(other: T): boolean

Determine if the address is less than or equal to the parameter.

If the two addresses are in different type, eg. one is IPv4Addr and another is IPv6Addr, the function will throw an error.

source§

neq

source§

neq(other: IPAddr<any>): boolean

Determine if the two addresses are unequal.

If the two addresses are in different type, eg. one is IPv4Addr and another is IPv6Addr, the function will always return true.

source§

newInstance

source§

newInstance(value: BigInteger): T

Create a new instance of the address' class. This method is called by the base class most of the time.

source§

next

source§

next(): null | T

Get the next address of the address.

source§

prev

source§

prev(): null | T

Get the previous address of the address.

source§

toInt

source§

toInt(): BigInteger

Get the corresponding integer of the address.

source§

toString

source§

toString(): string

Get the string representation of the address.