public class Unit extends IdentifiableComponent implements Serializable
| Modifier and Type | Field and Description |
|---|---|
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 |
DEFAULT, LOCAL, UNKNOWN| Constructor and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
addAlias, addRemark, getAliases, getAuthorityKey, getAuthorityName, getCode, getComponent, getIdentifier, getName, getRemarks, getShortName, setIdentifier, setRemarks, setShortNamepublic 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
public Unit(Quantity quantity, Identifier id)
quantity - the quantity measured by this unitid - the identifier of this unitpublic 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 unitpublic 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 unitpublic static Unit getUnit(Quantity quantity, String symbol)
quantity - the Quantity measured by the Unit to be foundsymbol - the symbol of the Unit to be foundpublic static Unit getBaseUnit(Quantity quantity)
quantity - the quantity Class of the Unit to be foundpublic 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 IdentifiableComponentCopyright © 2019 CNRS. All rights reserved.