Package org.eclipse.mat.query
Class Bytes
- java.lang.Object
-
- org.eclipse.mat.query.Bytes
-
- All Implemented Interfaces:
Comparable<Object>
public final class Bytes extends Object implements Comparable<Object>
Logical representation of a number of bytes. This class is immutable, so operations such as add will return new instances.- Since:
- 1.5
-
-
Constructor Summary
Constructors Constructor Description Bytes(long bytes)Create an immutable instance of a logical representation of a number ofbytes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Bytesadd(long add)Add a number of bytes to the current value fromgetValue()and return a new instance ofBytes.intcompareTo(Object y)If comparing to another instances ofBytes, compare the values returned bygetValue().booleanequals(Object o)If comparing to another instances ofBytes, return true if the results ofgetValue()are the same.longgetValue()Get the underlying number of bytes as a long.inthashCode()StringtoString()
-
-
-
Method Detail
-
getValue
public long getValue()
Get the underlying number of bytes as a long.- Returns:
- The underlying number of bytes as a long.
-
toString
public String toString()
- Overrides:
toStringin classObject- See Also:
Long.toString()
-
hashCode
public int hashCode()
- Overrides:
hashCodein classObject- See Also:
Long.hashCode()
-
equals
public boolean equals(Object o)
If comparing to another instances ofBytes, return true if the results ofgetValue()are the same.
-
add
public Bytes add(long add)
Add a number of bytes to the current value fromgetValue()and return a new instance ofBytes.- Parameters:
add- The amount of bytes to add.- Returns:
- A new instance of
Byteswith the previous value summed withadd.
-
compareTo
public int compareTo(Object y)
If comparing to another instances ofBytes, compare the values returned bygetValue().- Specified by:
compareToin interfaceComparable<Object>
-
-