Package org.eclipse.cdt.core

## Interface IAddress

All Superinterfaces:
  `Comparable<Object>`

All Known Implementing Classes:
  `Addr32`, `Addr64`

    public interface IAddress
    extends Comparable<Object>

Represents C/C++ address in CDT. All implementors of this interface should be immutable, i.e. all methods should not modify objects, they should return new object. Please see Addr32 and Addr64 classes to see how this interface should be extended

### Method Summary

All Methods Instance Methods Abstract Methods
`IAddress` `add​(long offset)` Adds offset to address and returns new address object which is the result Note: This method has an offset limit of Long.MAX and Long.MIN, which under some addressing schemes may impose an unnecessary limitation, see `IAddress.add(BigInteger offset)` to handle larger offsets.
`IAddress` `add​(BigInteger offset)` Adds offset to address and returns new address object which is the result
`BigInteger` `distanceTo​(IAddress other)` Returns distance to address.
`boolean` `equals​(Object addr)` Returns whether this address equals the given object.
`int` `getCharsNum()` Returns amount of symbols in hex representation.
`BigInteger` `getMaxOffset()` Returns maximal offset possible for address.
`int` `getSize()` Returns the address size in bytes.
`BigInteger` `getValue()` Returns the value of the address.
`boolean` `isMax()` Return true if address is maximal, i.e.
`boolean` `isZero()` Return true if address is zero, i.e.
`String` `toBinaryAddressString()` Converts address to the binary representation with '0b' prefix and with all leading zeros.
`String` `toHexAddressString()` Converts address to the hex representation with '0x' prefix and with all leading zeros.
`String` `toString()` Identical to toString(10)
`String` `toString​(int radix)` Converts address to string as an unsigned number with given radix

### Methods inherited from interface java.lang.Comparable

`compareTo`

### Method Detail

#### add

    IAddress add​(BigInteger offset)

Adds offset to address and returns new address object which is the result

Parameters:
  `offset` - to add
Returns:
  the new address

#### add

    IAddress add​(long offset)

Adds offset to address and returns new address object which is the result
Note: This method has an offset limit of Long.MAX and Long.MIN, which under some addressing schemes may impose an unnecessary limitation, see `IAddress.add(BigInteger offset)` to handle larger offsets.

Parameters:
  `offset` - to add
Returns:
  the new address

#### getMaxOffset

    BigInteger getMaxOffset()

Returns maximal offset possible for address. The offset should be identical for all addresses of given class.

Returns:
  the max offset for this address class

#### distanceTo

    BigInteger distanceTo​(IAddress other)

Returns distance to address. Distance may be positive or negative

Parameters:
  `other` - address which distance is calculated to.
Returns:
  distance to address

#### getValue

    BigInteger getValue()

Returns the value of the address.

#### equals

    boolean equals​(Object addr)

Returns whether this address equals the given object.

Overrides:
  `equals` in class `Object`
Parameters:
  `addr` - the other object
Returns:
  `true` if the addresses are equivalent, and `false` if they are not

#### isZero

    boolean isZero()

Return true if address is zero, i.e. minimal possible

Returns:
  true is address is zero

#### isMax

    boolean isMax()

Return true if address is maximal, i.e. maximal possible

Returns:
  true if address is maximal

#### toString

    String toString​(int radix)

Converts address to string as an unsigned number with given radix

Parameters:
  `radix` - to use for string conversion
Returns:
  a string representation of address

#### toString

    String toString()

Identical to toString(10)

Overrides:
  `toString` in class `Object`
Returns:
  a string representation of address using a radix of 10

#### toHexAddressString

    String toHexAddressString()

Converts address to the hex representation with '0x' prefix and with all leading zeros. The length of returned string should be the same for all addresses of given class. I.e. 10 for 32-bit addresses and 18 for 64-bit addresses

#### toBinaryAddressString

    String toBinaryAddressString()

Converts address to the binary representation with '0b' prefix and with all leading zeros. The length of returned string should be the same for all addresses of given class. I.e. 34 for 32-bit addresses and 66 for 64-bit addresses

#### getCharsNum

    int getCharsNum()

Returns amount of symbols in hex representation. Is identical to toHexAddressString().length(). It is present for performance purpose.

Returns:
  the number of character symbols to represent this address in hex.

#### getSize

    int getSize()

Returns the address size in bytes.

Returns:
  the number of bytes required to hold this address.