Package org.eclipse.mat.query
Class Bytes
java.lang.Object
org.eclipse.mat.query.Bytes
- All Implemented Interfaces:
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
ConstructorDescriptionBytes
(long bytes) Create an immutable instance of a logical representation of a number ofbytes
. -
Method Summary
Modifier and TypeMethodDescriptionadd
(long add) Add a number of bytes to the current value fromgetValue()
and return a new instance ofBytes
.int
If comparing to another instances ofBytes
, compare the values returned bygetValue()
.boolean
If comparing to another instances ofBytes
, return true if the results ofgetValue()
are the same.long
getValue()
Get the underlying number of bytes as a long.int
hashCode()
toString()
-
Constructor Details
-
Bytes
public Bytes(long bytes) Create an immutable instance of a logical representation of a number ofbytes
.- Parameters:
bytes
- The number of bytes to represent.
-
-
Method Details
-
getValue
public long getValue()Get the underlying number of bytes as a long.- Returns:
- The underlying number of bytes as a long.
-
toString
-
hashCode
public int hashCode() -
equals
If comparing to another instances ofBytes
, return true if the results ofgetValue()
are the same. -
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
Bytes
with the previous value summed withadd
.
-
compareTo
If comparing to another instances ofBytes
, compare the values returned bygetValue()
.- Specified by:
compareTo
in interfaceComparable<Object>
-