Package be.gaudry.model
Class UnitUtils
java.lang.Object
be.gaudry.model.UnitUtils
Allows to use and output units like time, length, weight, etc.
Provided by the broldev.core.model project.
- Since:
- 1.0 Jun 10, 2008, broldev.core.model 0.0.1-SNAPSHOT dependency
- Version:
- 1.1 May 18, 2011
- Author:
- Steph GAUDRY
-
Field Summary
Modifier and TypeFieldDescriptionstatic char
Default value of "uninitialized" char.static int[]
Powers of 10 prefixes according to the SI(International System of Units).static int[]
Powers of 2 prefixes according to the SI(International System of Units).static String[]
String representations of the electronic data quantity scale for the power of 10 prefixes according to the SI(International System of Units) "o", "ko", "Mo", "Go", "To"static String[]
String representations of the electronic data quantity scale for the power of 2 prefixes according to the SI(International System of Units) "o", "kio", "Mio", "Gio", "Tio"static String[]
String representations of the time scale TODO internationalize this -
Method Summary
Modifier and TypeMethodDescriptionstatic String
getDelay(long start, long stop)
static String
getDelay(long start, long stop, boolean nanoseconds)
static String
getLengthString(long length)
Returns a user friendly representation of the length, using the binary units multiples (1ko=1024octets).static String
getLengthString(long length, boolean useBinary)
-
Field Details
-
UNITS_OF_FILE_LENGTH_P2
String representations of the electronic data quantity scale for the power of 2 prefixes according to the SI(International System of Units) "o", "kio", "Mio", "Gio", "Tio" -
UNIT_MULTIPLES_P2
public static final int[] UNIT_MULTIPLES_P2Powers of 2 prefixes according to the SI(International System of Units). \nExample: UNITS_MULTIPLES_P2[2]=20 is used for theMio
to represent x*220 octets -
UNITS_OF_FILE_LENGTH_P10
String representations of the electronic data quantity scale for the power of 10 prefixes according to the SI(International System of Units) "o", "ko", "Mo", "Go", "To" -
UNIT_MULTIPLES_P10
public static final int[] UNIT_MULTIPLES_P10Powers of 10 prefixes according to the SI(International System of Units). \nExample: UNITS_MULTIPLES_P2[2]=6 is used for theMo
to represent x*106 octets -
UNITS_OF_TIME_SHORT
String representations of the time scale TODO internationalize this -
DEFAULT_CHAR
public static final char DEFAULT_CHARDefault value of "uninitialized" char. This is a not printable character with ASCII value 0.- See Also:
- Constant Field Values
-
-
Method Details
-
getDelay
- Parameters:
start
-stop
-- Returns:
- String representation of the delay
-
getDelay
- Parameters:
start
-stop
-nanoseconds
-- Returns:
- String representation of the delay
-
getLengthString
Returns a user friendly representation of the length, using the binary units multiples (1ko=1024octets).- Parameters:
length
-- Returns:
- String representation of the length
- See Also:
getLengthString(long, false) for another representation (1kio=1000octets)
-
getLengthString
- Parameters:
length
-useBinary
- true to compute for a binary representation (1kio=1024octets), false to compute as common representation (1ko=1000octets)- Returns:
- String representation of the length
- Since:
- 1.1 May 18, 2011
-