Package org.eclipse.cdt.utils
Class Addr32
- java.lang.Object
-
- org.eclipse.cdt.utils.Addr32
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<java.lang.Object>,IAddress
public class Addr32 extends java.lang.Object implements IAddress, java.io.Serializable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static Addr32MAXstatic java.math.BigIntegerMAX_OFFSETstatic Addr32ZERO
-
Constructor Summary
Constructors Constructor Description Addr32(byte[] addrBytes)Addr32(long rawaddress)Addr32(long rawaddress, boolean truncate)Addr32(java.lang.String addr)Addr32(java.lang.String addr, boolean truncate)Addr32(java.lang.String addr, int radix)Addr32(java.lang.String addr, int radix, boolean truncate)
-
Method Summary
All Methods Instance Methods Concrete 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 resultintcompareTo(java.lang.Object other)java.math.BigIntegerdistanceTo(IAddress other)Returns distance to address.booleanequals(java.lang.Object x)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.inthashCode()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.StringtoOctalAddressString()java.lang.StringtoString()Identical to toString(10)java.lang.StringtoString(int radix)Converts address to string as an unsigned number with given radix
-
-
-
Constructor Detail
-
Addr32
public Addr32(byte[] addrBytes)
-
Addr32
public Addr32(long rawaddress)
-
Addr32
public Addr32(long rawaddress, boolean truncate)
-
Addr32
public Addr32(java.lang.String addr)
-
Addr32
public Addr32(java.lang.String addr, boolean truncate)
-
Addr32
public Addr32(java.lang.String addr, int radix)
-
Addr32
public Addr32(java.lang.String addr, int radix, boolean truncate)
-
-
Method Detail
-
add
public IAddress add(java.math.BigInteger offset)
Description copied from interface:IAddressAdds offset to address and returns new address object which is the result
-
add
public IAddress add(long offset)
Description copied from interface:IAddressAdds 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.
-
getMaxOffset
public java.math.BigInteger getMaxOffset()
Description copied from interface:IAddressReturns maximal offset possible for address. The offset should be identical for all addresses of given class.- Specified by:
getMaxOffsetin interfaceIAddress- Returns:
- the max offset for this address class
-
getValue
public java.math.BigInteger getValue()
Description copied from interface:IAddressReturns the value of the address.
-
distanceTo
public java.math.BigInteger distanceTo(IAddress other)
Description copied from interface:IAddressReturns distance to address. Distance may be positive or negative- Specified by:
distanceToin interfaceIAddress- Parameters:
other- address which distance is calculated to.- Returns:
- distance to address
-
compareTo
public int compareTo(java.lang.Object other)
- Specified by:
compareToin interfacejava.lang.Comparable<java.lang.Object>
-
isMax
public boolean isMax()
Description copied from interface:IAddressReturn true if address is maximal, i.e. maximal possible
-
isZero
public boolean isZero()
Description copied from interface:IAddressReturn true if address is zero, i.e. minimal possible
-
toString
public java.lang.String toString()
Description copied from interface:IAddressIdentical to toString(10)
-
toString
public java.lang.String toString(int radix)
Description copied from interface:IAddressConverts address to string as an unsigned number with given radix
-
equals
public boolean equals(java.lang.Object x)
Description copied from interface:IAddressReturns whether this address equals the given object.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toHexAddressString
public java.lang.String toHexAddressString()
Description copied from interface:IAddressConverts 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- Specified by:
toHexAddressStringin interfaceIAddress
-
toOctalAddressString
public java.lang.String toOctalAddressString()
- Since:
- 5.4
-
toBinaryAddressString
public java.lang.String toBinaryAddressString()
Description copied from interface:IAddressConverts 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- Specified by:
toBinaryAddressStringin interfaceIAddress
-
getCharsNum
public int getCharsNum()
Description copied from interface:IAddressReturns amount of symbols in hex representation. Is identical to toHexAddressString().length(). It is present for performance purpose.- Specified by:
getCharsNumin interfaceIAddress- Returns:
- the number of character symbols to represent this address in hex.
-
-