com.pmease.quickbuild.plugin.report.engine.util.quantity
Enum Data
java.lang.Object
java.lang.Enum<Data>
com.pmease.quickbuild.plugin.report.engine.util.quantity.Data
- All Implemented Interfaces:
- Unit<Data>, java.io.Serializable, java.lang.Comparable<Data>
public enum Data
- extends java.lang.Enum<Data>
- implements Unit<Data>
Provides a unit to allow conversions and unambiguous passing around of data
Amount
s. The kilo/mega/giga/... hierarchy is built on base 2 so that
the hierarchy increases by a factor of 1024 instead of 1000 as typical in
metric units. Additionally, units are divided in 2 hierarchies one based on
bits and the other on bytes. Thus Kb
represents kilobits; so 1 Kb =
1024 bits, and KB
represents kilobytes so 1 KB = 1024 bytes or 8192
bits.
Method Summary |
static java.lang.String |
formatBytes(double bytes)
|
static java.lang.String |
formatBytes(double bytes,
java.lang.String pattern)
|
double |
multiplier()
Returns the weight of this unit relative to other units in the same
hierarchy. |
static Data |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. |
static Data[] |
values()
Returns an array containing the constants of this enum type, in
the order they're declared. |
Methods inherited from class java.lang.Enum |
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
BITS
public static final Data BITS
Kb
public static final Data Kb
Mb
public static final Data Mb
Gb
public static final Data Gb
BYTES
public static final Data BYTES
KB
public static final Data KB
MB
public static final Data MB
GB
public static final Data GB
TB
public static final Data TB
PB
public static final Data PB
values
public static Data[] values()
- Returns an array containing the constants of this enum type, in
the order they're declared. This method may be used to iterate
over the constants as follows:
for(Data c : Data.values())
System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in
the order they're declared
valueOf
public static Data valueOf(java.lang.String name)
- Returns the enum constant of this type with the specified name.
The string must match exactly an identifier used to declare an
enum constant in this type. (Extraneous whitespace characters are
not permitted.)
- Parameters:
name
- the name of the enum constant to be returned.
- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant
with the specified name
multiplier
public double multiplier()
- Description copied from interface:
Unit
- Returns the weight of this unit relative to other units in the same
hierarchy. Typically the smallest unit in the hierarchy returns 1, but
this need not be the case. It is only required that each unit of the
hierarchy return a multiplier relative to a common base unit for the
hierarchy.
- Specified by:
multiplier
in interface Unit<Data>
formatBytes
public static java.lang.String formatBytes(double bytes)
formatBytes
public static java.lang.String formatBytes(double bytes,
java.lang.String pattern)
Copyright © 2005-2010 PMEase Inc. All Rights Reserved.