|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.monitoring.counters.Unit
public class Unit
Units allow monitored data to have get typed. A primary unit is the
finest unit for a data type. A primary unit can have derived units,
that represent the same data type, but with a scale factor.
A primary Unit is created with the Unit(String)
constructor.
A derived Unit is created with the Unit(String, Unit, long)
constructor.
getDerived()
can be
used to retrieve the complete list, and getDerived(String)
to retrieve a
derived unit by it's name.
Nested Class Summary | |
---|---|
static class |
Unit.Binary
Binary data units |
static class |
Unit.Time
Time based units |
Field Summary | |
---|---|
static Unit |
DECA
|
static Unit |
GIGA
|
static Unit |
HECTO
|
static Unit |
KILO
|
static Unit |
MEGA
|
Set<Unit> |
primaryUnits
|
static Unit |
TERA
|
static Unit |
UNARY
unit for basic item counters & gauges |
Constructor Summary | |
---|---|
Unit(String name)
Constructor for a primary unit |
|
Unit(String name,
Unit derived,
long scale)
Constructor for a derived unit |
Method Summary | |
---|---|
int |
compareTo(Unit o)
|
double |
convert(double value,
Unit unit)
Convert value from unit to this unit (if conpatible) |
boolean |
equals(Object obj)
|
static Unit |
get(String name)
|
List<Unit> |
getDerived()
|
Unit |
getDerived(String name)
|
String |
getName()
|
Unit |
getPrimary()
|
long |
getScale()
|
int |
hashCode()
|
boolean |
isCompatible(Unit unit)
|
boolean |
isPrimary()
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Unit UNARY
public static final Unit DECA
public static final Unit HECTO
public static final Unit KILO
public static final Unit MEGA
public static final Unit GIGA
public static final Unit TERA
public Set<Unit> primaryUnits
Constructor Detail |
---|
public Unit(String name)
name
- public Unit(String name, Unit derived, long scale)
name
- derived
- the unit this unit is derived fromscale
- the scale factor to convert to derived unitMethod Detail |
---|
public static Unit get(String name)
public Unit getDerived(String name)
public List<Unit> getDerived()
public String getName()
public long getScale()
public double convert(double value, Unit unit)
value
- value to convertunit
- unit of value
public boolean isPrimary()
public boolean isCompatible(Unit unit)
public Unit getPrimary()
public int compareTo(Unit o)
compareTo
in interface Comparable<Unit>
public String toString()
toString
in class Object
public int hashCode()
hashCode
in class Object
Object.hashCode()
public boolean equals(Object obj)
equals
in class Object
Object.equals(java.lang.Object)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |