org.eclipse.cdt.core
Interface IAddress

All Superinterfaces:
java.lang.Comparable

public interface IAddress
extends java.lang.Comparable

Represents C/C++ address in CDT. All implementors of this inteface 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
 IAddress add(java.math.BigInteger offset)
          Adds offset to address and returns new address object which is the result
 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 schems may impose an unnesseary limitation, see IAddressa.add(BigInteger offset) to handle larger offsets.
 java.math.BigInteger distanceTo(IAddress other)
          Returns distance to address.
 boolean equals(java.lang.Object addr)
          Returns whether this address equals the given object.
 int getCharsNum()
          Returns amount of symbols in hex representation.
 java.math.BigInteger getMaxOffset()
          Returns maximal offset possible for address.
 int getSize()
          Returns the address size in bytes.
 java.math.BigInteger getValue()
          Returns the value of the address.
 boolean isMax()
          Return true if address is maximal, i.e. maximal possible
 boolean isZero()
          Return true if address is zero, i.e. minimal possible
 java.lang.String toBinaryAddressString()
          Converts address to the binary representation with '0b' prefix and with all leading zeros.
 java.lang.String toHexAddressString()
          Converts address to the hex representation with '0x' prefix and with all leading zeros.
 java.lang.String toString()
          Identical to toString(10)
 java.lang.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(java.math.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 schems may impose an unnesseary limitation, see IAddressa.add(BigInteger offset) to handle larger offsets.

Parameters:
offset - to add
Returns:
the new address

getMaxOffset

java.math.BigInteger getMaxOffset()
Returns maximal offset possible for address. The offset should be Identicall for all addresses of given class.

Returns:
the max offset for this address class

distanceTo

java.math.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

java.math.BigInteger getValue()
Returns the value of the address.

Returns:

equals

boolean equals(java.lang.Object addr)
Returns whether this address equals the given object.

Overrides:
equals in class java.lang.Object
Parameters:
obj - 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

java.lang.String toString(int radix)
Converts address to string as an unsigned number with given radix

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

toString

java.lang.String toString()
Identical to toString(10)

Overrides:
toString in class java.lang.Object
Returns:
a string representation of address using a radix of 10

toHexAddressString

java.lang.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

Returns:

toBinaryAddressString

java.lang.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

Returns:

getCharsNum

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

Returns:
the nmber os chararcter 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.