|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.cts.IdentifiableComponent
org.cts.units.Unit
public class Unit
According to wikipedia, a unit of measurement is a standardised quantity of a physical property, used as a factor to express occurring quantities of that property. This interface is not a complete definition of what units are and what one can do with them, but rather a simple definition for conversion purposes as used ni geodesy. See JSR-275 for a complete package.
| Field Summary | |
|---|---|
static Unit |
ARC_MINUTE
|
static Unit |
ARC_SECOND
|
static Unit |
CENTIMETER
|
static Unit |
DECIMETER
|
static Unit |
DEGREE
|
static Unit |
FOOT
|
static Unit |
GRAD
|
static Unit |
KILOMETER
|
static Unit |
METER
|
static Unit |
MILLIMETER
|
static Unit |
RADIAN
|
static Unit |
SECOND
|
static Unit |
UNIT
|
static Unit |
USFOOT
|
static Unit |
YARD
|
| Fields inherited from interface org.cts.Identifiable |
|---|
DEFAULT, LOCAL, UNKNOWN |
| Constructor Summary | |
|---|---|
Unit(Quantity quantity,
double scale,
double offset,
Identifier id)
Creates a new Unit for the Quantity Q. |
|
Unit(Quantity quantity,
double scale,
Identifier id)
Creates a new unit for this quantity. |
|
Unit(Quantity quantity,
Identifier id)
Creates a base unit for this quantity. |
|
| Method Summary | |
|---|---|
boolean |
equals(Object o)
Returns true if this Unit can be considered as equals to another one. |
double |
fromBaseUnit(double measure)
Convert a measure from base unit(s) into this unit. |
Unit |
getBaseUnit()
Return the base unit for measures of the same quantity. |
static Unit |
getBaseUnit(Quantity quantity)
Static method returning the base Unit for this quantity Class. |
ArrayList<String> |
getNames()
Return a list of the names of the unit (ex : metre, meter). |
double |
getOffset()
Returns the offset from base unit to this (ex. temperature). |
Quantity |
getQuantity()
Returns the Quantity measured by this Unit. |
double |
getScale()
Returns the scale of this unit compared to the base unit. |
String |
getSymbol()
Return the preferred symbol to use with this unit. |
static Unit |
getUnit(Quantity quantity,
String symbol)
Static method returning a Unit from its symbol and quantity Class. |
int |
hashCode()
Returns the hash code for this Unit. |
boolean |
isComparable(Unit anotherUnit)
Returns true if quantity measured by this unit and quantity measured by anotherUnit are equals. |
void |
setScale(double scale)
Set factor or scale. |
double |
toBaseUnit(double measure)
Convert a measure from this unit into base unit(s). |
String |
toString()
String representation of this Unit. |
String |
toWKT()
Returns a WKT representation of the unit. |
| Methods inherited from class org.cts.IdentifiableComponent |
|---|
addAlias, addRemark, getAliases, getAuthorityKey, getAuthorityName, getCode, getComponent, getIdentifier, getName, getRemarks, getShortName, setIdentifier, setRemarks, setShortName |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final Unit RADIAN
public static final Unit DEGREE
public static final Unit ARC_MINUTE
public static final Unit ARC_SECOND
public static final Unit GRAD
public static final Unit METER
public static final Unit MILLIMETER
public static final Unit CENTIMETER
public static final Unit DECIMETER
public static final Unit KILOMETER
public static final Unit FOOT
public static final Unit USFOOT
public static final Unit YARD
public static final Unit UNIT
public static final Unit SECOND
| Constructor Detail |
|---|
public Unit(Quantity quantity,
Identifier id)
quantity - the quantity measured by this unitid - the identifier of this unit
public Unit(Quantity quantity,
double scale,
Identifier id)
quantity - the quantity measured by this unitscale - the scale factor of this unit compared to the base unitid - the identifier of this unit
public Unit(Quantity quantity,
double scale,
double offset,
Identifier id)
quantity - the quantity measured by this unitscale - the scale factor of this unit compared to the base unitoffset - the shift factor of this unit compared to the base unitid - the identifier of this unit| Method Detail |
|---|
public static Unit getUnit(Quantity quantity,
String symbol)
quantity - the Quantity measured by the Unit to be foundsymbol - the symbol of the Unit to be found
public static Unit getBaseUnit(Quantity quantity)
quantity - the quantity Class of the Unit to be found
public ArrayList<String> getNames()
public Quantity getQuantity()
public double getScale()
public double getOffset()
public double toBaseUnit(double measure)
measure - the measure to convert into base unitpublic double fromBaseUnit(double measure)
measure - the measure to convert into this unitpublic String getSymbol()
public void setScale(double scale)
scale - the scale to set to the unit.public Unit getBaseUnit()
public boolean isComparable(Unit anotherUnit)
anotherUnit - another unitpublic String toWKT()
public String toString()
toString in class IdentifiableComponentpublic boolean equals(Object o)
equals in class IdentifiableComponento - the object to compare this Unit againstpublic int hashCode()
hashCode in class IdentifiableComponent
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||