Package org.eclipse.cdt.core
Interface IAddress
-
- All Superinterfaces:
java.lang.Comparable<java.lang.Object>
public interface IAddress extends java.lang.Comparable<java.lang.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 Modifier and Type Method Description IAddressadd(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, seeIAddress.add(BigInteger offset)to handle larger offsets.IAddressadd(java.math.BigInteger offset)Adds offset to address and returns new address object which is the resultjava.math.BigIntegerdistanceTo(IAddress other)Returns distance to address.booleanequals(java.lang.Object addr)Returns whether this address equals the given object.intgetCharsNum()Returns amount of symbols in hex representation.java.math.BigIntegergetMaxOffset()Returns maximal offset possible for address.intgetSize()Returns the address size in bytes.java.math.BigIntegergetValue()Returns the value of the address.booleanisMax()Return true if address is maximal, i.e.booleanisZero()Return true if address is zero, i.e.java.lang.StringtoBinaryAddressString()Converts address to the binary representation with '0b' prefix and with all leading zeros.java.lang.StringtoHexAddressString()Converts address to the hex representation with '0x' prefix and with all leading zeros.java.lang.StringtoString()Identical to toString(10)java.lang.StringtoString(int radix)Converts address to string as an unsigned number with given radix
-
-
-
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 schemes may impose an unnecessary limitation, seeIAddress.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 identical 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.
-
equals
boolean equals(java.lang.Object addr)
Returns whether this address equals the given object.- Overrides:
equalsin classjava.lang.Object- Parameters:
addr- the other object- Returns:
trueif the addresses are equivalent, andfalseif 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 string conversion- Returns:
- a string representation of address
-
toString
java.lang.String toString()
Identical to toString(10)- Overrides:
toStringin classjava.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
-
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
-
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.
-
-