Package org.pkl.core
Class DataSize
- java.lang.Object
-
- org.pkl.core.DataSize
-
- All Implemented Interfaces:
java.io.Serializable,Value
public final class DataSize extends java.lang.Object implements Value
Java representation of apkl.base#DataSizevalue.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DataSize(double value, DataSizeUnit unit)Constructs a new data size with the given value and unit.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Taccept(ValueConverter<T> converter)Invokes the given converters's convert method for thisValue.voidaccept(ValueVisitor visitor)Invokes the given visitor's visit method for thisValue.DataSizeconvertTo(DataSizeUnit other)Returns a new data size with the given unit and this value converted to the given unit.doubleconvertValueTo(DataSizeUnit other)Returns the value of this data size converted to the given unit.booleanequals(@Nullable java.lang.Object obj)PClassInfo<?>getClassInfo()Returns information about the Pkl class associated with thisValue.DataSizeUnitgetUnit()Returns the unit of this data size.doublegetValue()Returns the value of this data size.inthashCode()doubleinBytes()Returns the value of this data size measured inDataSizeUnit.BYTES.doubleinGibibytes()Returns the value of this data size measured inDataSizeUnit.GIBIBYTES.doubleinGigabytes()Returns the value of this data size measured inDataSizeUnit.GIGABYTES.doubleinKibibytes()Returns the value of this data size measured inDataSizeUnit.KIBIBYTES.doubleinKilobytes()Returns the value of this data size measured inDataSizeUnit.KILOBYTES.doubleinMebibytes()Returns the value of this data size measured inDataSizeUnit.MEBIBYTES.doubleinMegabytes()Returns the value of this data size measured inDataSizeUnit.MEGABYTES.doubleinPebibytes()Returns the value of this data size measured inDataSizeUnit.PEBIBYTES.doubleinPetabytes()Returns the value of this data size measured inDataSizeUnit.PETABYTES.doubleinTebibytes()Returns the value of this data size measured inDataSizeUnit.TEBIBYTES.doubleinTerabytes()Returns the value of this data size measured inDataSizeUnit.TERABYTES.longinWholeBytes()Returns the value of this data size measured in wholeDataSizeUnit.BYTES.longinWholeGibibytes()Returns the value of this data size measured in wholeDataSizeUnit.GIBIBYTES.longinWholeGigabytes()Returns the value of this data size measured in wholeDataSizeUnit.GIGABYTES.longinWholeKibibytes()Returns the value of this data size measured in wholeDataSizeUnit.KIBIBYTES.longinWholeKilobytes()Returns the value of this data size measured in wholeDataSizeUnit.KILOBYTES.longinWholeMebibytes()Returns the value of this data size measured in wholeDataSizeUnit.MEBIBYTES.longinWholeMegabytes()Returns the value of this data size measured in wholeDataSizeUnit.MEGABYTES.longinWholePebibytes()Returns the value of this data size measured in wholeDataSizeUnit.PEBIBYTES.longinWholePetabytes()Returns the value of this data size measured in wholeDataSizeUnit.PETABYTES.longinWholeTebibytes()Returns the value of this data size measured in wholeDataSizeUnit.TEBIBYTES.longinWholeTerabytes()Returns the value of this data size measured in wholeDataSizeUnit.TERABYTES.static DataSizeofBytes(double value)Constructs a new data size with the given value and unitDataSizeUnit.BYTES.static DataSizeofGibibytes(double value)Constructs a new data size with the given value and unitDataSizeUnit.GIBIBYTES.static DataSizeofGigabytes(double value)Constructs a new data size with the given value and unitDataSizeUnit.GIGABYTES.static DataSizeofKibibytes(double value)Constructs a new data size with the given value and unitDataSizeUnit.KIBIBYTES.static DataSizeofKilobytes(double value)Constructs a new data size with the given value and unitDataSizeUnit.KILOBYTES.static DataSizeofMebibytes(double value)Constructs a new data size with the given value and unitDataSizeUnit.MEBIBYTES.static DataSizeofMegabytes(double value)Constructs a new data size with the given value and unitDataSizeUnit.MEGABYTES.static DataSizeofPebibytes(double value)Constructs a new data size with the given value and unitDataSizeUnit.PEBIBYTES.static DataSizeofPetabytes(double value)Constructs a new data size with the given value and unitDataSizeUnit.PETABYTES.static DataSizeofTebibytes(double value)Constructs a new data size with the given value and unitDataSizeUnit.TEBIBYTES.static DataSizeofTerabytes(double value)Constructs a new data size with the given value and unitDataSizeUnit.TERABYTES.java.lang.StringtoString()
-
-
-
Constructor Detail
-
DataSize
public DataSize(double value, DataSizeUnit unit)Constructs a new data size with the given value and unit.
-
-
Method Detail
-
ofBytes
public static DataSize ofBytes(double value)
Constructs a new data size with the given value and unitDataSizeUnit.BYTES.
-
ofKilobytes
public static DataSize ofKilobytes(double value)
Constructs a new data size with the given value and unitDataSizeUnit.KILOBYTES.
-
ofKibibytes
public static DataSize ofKibibytes(double value)
Constructs a new data size with the given value and unitDataSizeUnit.KIBIBYTES.
-
ofMegabytes
public static DataSize ofMegabytes(double value)
Constructs a new data size with the given value and unitDataSizeUnit.MEGABYTES.
-
ofMebibytes
public static DataSize ofMebibytes(double value)
Constructs a new data size with the given value and unitDataSizeUnit.MEBIBYTES.
-
ofGigabytes
public static DataSize ofGigabytes(double value)
Constructs a new data size with the given value and unitDataSizeUnit.GIGABYTES.
-
ofGibibytes
public static DataSize ofGibibytes(double value)
Constructs a new data size with the given value and unitDataSizeUnit.GIBIBYTES.
-
ofTerabytes
public static DataSize ofTerabytes(double value)
Constructs a new data size with the given value and unitDataSizeUnit.TERABYTES.
-
ofTebibytes
public static DataSize ofTebibytes(double value)
Constructs a new data size with the given value and unitDataSizeUnit.TEBIBYTES.
-
ofPetabytes
public static DataSize ofPetabytes(double value)
Constructs a new data size with the given value and unitDataSizeUnit.PETABYTES.
-
ofPebibytes
public static DataSize ofPebibytes(double value)
Constructs a new data size with the given value and unitDataSizeUnit.PEBIBYTES.
-
getValue
public double getValue()
Returns the value of this data size. The value is relative to the unit and may be negative.
-
getUnit
public DataSizeUnit getUnit()
Returns the unit of this data size.
-
inBytes
public double inBytes()
Returns the value of this data size measured inDataSizeUnit.BYTES.
-
inKilobytes
public double inKilobytes()
Returns the value of this data size measured inDataSizeUnit.KILOBYTES.
-
inKibibytes
public double inKibibytes()
Returns the value of this data size measured inDataSizeUnit.KIBIBYTES.
-
inMegabytes
public double inMegabytes()
Returns the value of this data size measured inDataSizeUnit.MEGABYTES.
-
inMebibytes
public double inMebibytes()
Returns the value of this data size measured inDataSizeUnit.MEBIBYTES.
-
inGigabytes
public double inGigabytes()
Returns the value of this data size measured inDataSizeUnit.GIGABYTES.
-
inGibibytes
public double inGibibytes()
Returns the value of this data size measured inDataSizeUnit.GIBIBYTES.
-
inTerabytes
public double inTerabytes()
Returns the value of this data size measured inDataSizeUnit.TERABYTES.
-
inTebibytes
public double inTebibytes()
Returns the value of this data size measured inDataSizeUnit.TEBIBYTES.
-
inPetabytes
public double inPetabytes()
Returns the value of this data size measured inDataSizeUnit.PETABYTES.
-
inPebibytes
public double inPebibytes()
Returns the value of this data size measured inDataSizeUnit.PEBIBYTES.
-
inWholeBytes
public long inWholeBytes()
Returns the value of this data size measured in wholeDataSizeUnit.BYTES.
-
inWholeKilobytes
public long inWholeKilobytes()
Returns the value of this data size measured in wholeDataSizeUnit.KILOBYTES.
-
inWholeKibibytes
public long inWholeKibibytes()
Returns the value of this data size measured in wholeDataSizeUnit.KIBIBYTES.
-
inWholeMegabytes
public long inWholeMegabytes()
Returns the value of this data size measured in wholeDataSizeUnit.MEGABYTES.
-
inWholeMebibytes
public long inWholeMebibytes()
Returns the value of this data size measured in wholeDataSizeUnit.MEBIBYTES.
-
inWholeGigabytes
public long inWholeGigabytes()
Returns the value of this data size measured in wholeDataSizeUnit.GIGABYTES.
-
inWholeGibibytes
public long inWholeGibibytes()
Returns the value of this data size measured in wholeDataSizeUnit.GIBIBYTES.
-
inWholeTerabytes
public long inWholeTerabytes()
Returns the value of this data size measured in wholeDataSizeUnit.TERABYTES.
-
inWholeTebibytes
public long inWholeTebibytes()
Returns the value of this data size measured in wholeDataSizeUnit.TEBIBYTES.
-
inWholePetabytes
public long inWholePetabytes()
Returns the value of this data size measured in wholeDataSizeUnit.PETABYTES.
-
inWholePebibytes
public long inWholePebibytes()
Returns the value of this data size measured in wholeDataSizeUnit.PEBIBYTES.
-
convertTo
public DataSize convertTo(DataSizeUnit other)
Returns a new data size with the given unit and this value converted to the given unit.
-
convertValueTo
public double convertValueTo(DataSizeUnit other)
Returns the value of this data size converted to the given unit.
-
accept
public void accept(ValueVisitor visitor)
Invokes the given visitor's visit method for thisValue.
-
accept
public <T> T accept(ValueConverter<T> converter)
Invokes the given converters's convert method for thisValue.
-
getClassInfo
public PClassInfo<?> getClassInfo()
Returns information about the Pkl class associated with thisValue.- Specified by:
getClassInfoin interfaceValue
-
equals
public boolean equals(@Nullable java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-